Changeset 739ee9
- Timestamp:
- Jan 10, 2015, 5:14:32 PM (10 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 34e7fdb
- Parents:
- 8c001a
- git-author:
- Frederik Heber <heber@…> (11/05/14 22:00:40)
- git-committer:
- Frederik Heber <heber@…> (01/10/15 17:14:32)
- Location:
- src/UIElements
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/QtMainWindow.cpp
r8c001a r739ee9 146 146 settings.endGroup(); 147 147 148 qRegisterMetaType<moleculeId_t>("moleculeId_t"); 149 148 150 connect(glWorldView,SIGNAL(hoverChanged(const atom*)), infoBox,SLOT(atomHover(const atom*))); 151 connect(moleculeList,SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool)), glWorldView, SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool))); 149 152 } 150 153 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp
r8c001a r739ee9 82 82 m_hovering = false; 83 83 m_selected = false; 84 m_visible = true; 84 85 m_material = 0; 85 86 initStaticMaterials(); … … 328 329 } 329 330 } 331 332 void GLMoleculeObject::setVisible(bool value) 333 { 334 if (value != m_visible){ 335 m_visible = value; 336 emit changed(); 337 } 338 } -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp
r8c001a r739ee9 74 74 void setSelected(bool value); 75 75 76 bool visible() const { return m_visible; } 77 void setVisible(bool value); 78 76 79 void initStaticMaterials(); 77 80 virtual void initialize(QGLView *view, QGLPainter *painter); … … 124 127 bool m_hovering; 125 128 bool m_selected; 129 bool m_visible; 126 130 }; 127 131 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r8c001a r739ee9 74 74 World::getInstance().signOn(this, World::SelectionChanged); 75 75 updateBoundingBox(); 76 77 // initially, atoms and bonds should be visible 78 m_visible = false; 76 79 77 80 init(); … … 256 259 void GLMoleculeObject_molecule::draw(QGLPainter *painter, const QVector4D &cameraPlane) 257 260 { 258 // Draw all of the mesh objects that we have as children. 259 GLMoleculeObject::draw(painter, cameraPlane); 260 foreach (QObject *obj, children()) { 261 GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj); 262 if (meshobj) 263 meshobj->draw(painter, cameraPlane); 264 } 261 // draw either molecule's mesh or all atoms and bonds 262 if (m_visible) { 263 GLMoleculeObject::draw(painter, cameraPlane); 264 } else { 265 // Draw all of the mesh objects that we have as children. 266 foreach (QObject *obj, children()) { 267 GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj); 268 if (meshobj) 269 meshobj->draw(painter, cameraPlane); 270 } 271 } 265 272 } 266 273 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r8c001a r739ee9 286 286 } 287 287 288 void GLWorldScene::moleculesVisibilityChanged(const moleculeId_t _id, bool _visible) 289 { 290 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_id); 291 ASSERT( iter != MoleculesinSceneMap.end(), 292 "GLWorldScene::moleculeInserted() - molecule's id "+toString(_id)+" is unknown."); 293 294 GLMoleculeObject_molecule *molObject = iter->second; 295 molObject->setVisible(_visible); 296 297 emit changed(); 298 emit changeOccured(); 299 } 300 288 301 /** Adds a bond to the scene. 289 302 * -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r8c001a r739ee9 92 92 void removeShape(); 93 93 void update(); 94 void moleculesVisibilityChanged(const moleculeId_t _id, bool _visible); 94 95 95 96 public: -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r8c001a r739ee9 92 92 //connect(this, SIGNAL(changed()), this, SLOT(updateGL())); 93 93 connect(this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled())); 94 connect(this, SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool)), worldscene, SLOT(moleculesVisibilityChanged(const moleculeId_t,bool))); 94 95 95 96 // sign on to changes in the world -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
r8c001a r739ee9 64 64 void ShapeAdded(); 65 65 void ShapeRemoved(); 66 void moleculesVisibilityChanged(const moleculeId_t,bool); 66 67 67 68 protected: -
src/UIElements/Views/Qt4/QtMoleculeList.cpp
r8c001a r739ee9 55 55 // these attributes are skipped so far 56 56 const int QtMoleculeList::COLUMNCOUNT = COLUMNTYPES_MAX; 57 const char *QtMoleculeList::COLUMNNAMES[QtMoleculeList::COLUMNCOUNT]={"Name"," Atoms","Formula","Occurrence"/*,"Size"*/};57 const char *QtMoleculeList::COLUMNNAMES[QtMoleculeList::COLUMNCOUNT]={"Name","Visibility", "Atoms","Formula","Occurrence"/*,"Size"*/}; 58 58 59 59 QtMoleculeList::QtMoleculeList(QWidget * _parent) : … … 81 81 //connect(this,SIGNAL(cellChanged(int,int)),this,SLOT(moleculeChanged(int,int))); 82 82 connect(selectionModel(),SIGNAL(selectionChanged(QItemSelection, QItemSelection)),this,SLOT(rowsSelected(QItemSelection, QItemSelection))); 83 83 connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(visibilityChanged(QTreeWidgetItem*, int))); 84 84 } 85 85 … … 128 128 formula.push_back((*iter)->getFormula()); 129 129 groupItem = new QTreeWidgetItem(this); 130 groupItem->setText(0, QString("default")); 131 groupItem->setText(1, QString::number(0)); 132 groupItem->setText(2, QString("")); 133 groupItem->setText(3, "0"); 130 groupItem->setText(NAME, QString("default")); 131 // groupItem->setFlags(groupItem->flags() | Qt::ItemIsUserCheckable); 132 // groupItem->setCheckState(VISIBILITY, Qt::Checked); 133 groupItem->setText(ATOMCOUNT, QString::number(0)); 134 groupItem->setText(FORMULA, QString("")); 135 groupItem->setText(OCCURRENCE, "0"); 134 136 groupItem->setData(0, Qt::UserRole, QVariant(-1)); 135 137 } … … 137 139 // add molecule 138 140 QTreeWidgetItem *molItem = new QTreeWidgetItem(groupItem); 139 molItem->setText(0, QString((*iter)->getName().c_str())); 140 molItem->setText(1, QString::number((*iter)->getAtomCount())); 141 molItem->setText(2, QString((*iter)->getFormula().toString().c_str())); 141 molItem->setText(NAME, QString((*iter)->getName().c_str())); 142 molItem->setFlags(groupItem->flags() | Qt::ItemIsUserCheckable); 143 molItem->setCheckState(VISIBILITY, Qt::Unchecked); 144 molItem->setText(ATOMCOUNT, QString::number((*iter)->getAtomCount())); 145 molItem->setText(FORMULA, QString((*iter)->getFormula().toString().c_str())); 142 146 const int index = (*iter)->getId(); 143 147 molItem->setData(0, Qt::UserRole, QVariant(index)); … … 146 150 147 151 // increase group occurrence 148 int count = groupItem->text( 3).toInt() + 1;149 groupItem->setText( 3, QString::number(count));152 int count = groupItem->text(4).toInt() + 1; 153 groupItem->setText(OCCURRENCE, QString::number(count)); 150 154 } 151 155 dirty = false; … … 161 165 162 166 void QtMoleculeList::subjectKilled(Observable *publisher) { 167 } 168 169 void QtMoleculeList::visibilityChanged(QTreeWidgetItem* item, int column) 170 { 171 if (column == VISIBILITY) { 172 const moleculeId_t molid = item->data(0, Qt::UserRole).toInt(); 173 const bool visible = item->checkState(VISIBILITY); 174 emit moleculesVisibilityChanged(molid, visible); 175 } 163 176 } 164 177 -
src/UIElements/Views/Qt4/QtMoleculeList.hpp
r8c001a r739ee9 18 18 #include "CodePatterns/Observer/Observer.hpp" 19 19 20 #include "types.hpp" 21 20 22 class molecule; 21 23 class MoleculeListClass; … … 36 38 37 39 static const int COLUMNCOUNT; 38 enum {NAME, ATOMCOUNT,FORMULA,OCCURRENCE,COLUMNTYPES_MAX} COLUMNTYPES;40 enum {NAME,VISIBILITY,ATOMCOUNT,FORMULA,OCCURRENCE,COLUMNTYPES_MAX} COLUMNTYPES; 39 41 static const char *COLUMNNAMES[]; 40 42 41 43 private slots: 42 44 void moleculeChanged(); 45 void visibilityChanged(QTreeWidgetItem*, int); 43 46 44 47 void rowsSelected(const QItemSelection & selected, const QItemSelection & deselected); … … 47 50 void moleculeSelected(molecule*); 48 51 void moleculeUnSelected(molecule*); 52 void moleculesVisibilityChanged(const moleculeId_t, bool); 49 53 50 54 private:
Note:
See TracChangeset
for help on using the changeset viewer.