Changeset 7993fe for src/UIElements
- Timestamp:
- Mar 24, 2016, 2:58:04 PM (9 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:
- 24eb6b
- Parents:
- 924259
- git-author:
- Frederik Heber <heber@…> (03/18/16 09:39:37)
- git-committer:
- Frederik Heber <heber@…> (03/24/16 14:58:04)
- Location:
- src/UIElements/Views/Qt4/MoleculeList
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.cpp
r924259 r7993fe 41 41 QtMoleculeItem::QtMoleculeItem( 42 42 QtObservedMolecule::ptr &_ObservedMolecule, 43 const enum MoveTypes _movetype, 44 const emitDirtyState_t _emitDirtyState) : 43 const enum MoveTypes _movetype) : 45 44 ObservedMolecule(_ObservedMolecule), 46 45 movetype(_movetype), 47 dirty(true), 48 emitDirtyState(_emitDirtyState) 46 dirty(true) 49 47 { 50 48 setFlags(flags() | Qt::ItemIsSelectable); -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp
r924259 r7993fe 47 47 enum COLUMNTYPES {NAME,VISIBILITY,ATOMCOUNT,FORMULA,OCCURRENCE,COLUMNTYPES_MAX}; 48 48 49 //!> typedef for callback function to model to inform when we need update50 typedef const boost::function<void (51 const moleculeId_t _id,52 const QtMoleculeItem::COLUMNTYPES _type,53 const enum MoveTypes)> emitDirtyState_t;54 55 49 QtMoleculeItem( 56 50 QtObservedMolecule::ptr &_ObservedMolecule, 57 const enum MoveTypes _movetype, 58 const emitDirtyState_t _emitDirtyState); 51 const enum MoveTypes _movetype); 59 52 virtual ~QtMoleculeItem(); 60 53 … … 99 92 //!> states that this item needs to be updated 100 93 bool dirty; 101 102 //!> bound callback function to inform model about change103 const emitDirtyState_t emitDirtyState;104 94 }; 105 95 -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeItemFactory.cpp
r924259 r7993fe 61 61 QList<QStandardItem *> 62 62 QtMoleculeItemFactory::createMoleculeItems( 63 QtObservedMolecule::ptr &_ObservedMolecule, 64 const QtMoleculeItem::emitDirtyState_t &_emitDirtyState) 63 QtObservedMolecule::ptr &_ObservedMolecule) 65 64 { 66 65 QList<QStandardItem *> molItems; 67 molItems << new QtMoleculeItem_name(_ObservedMolecule , _emitDirtyState);68 molItems << new QtMoleculeItem_visibility(_ObservedMolecule , _emitDirtyState);69 molItems << new QtMoleculeItem_atomcount(_ObservedMolecule , _emitDirtyState);70 molItems << new QtMoleculeItem_formula(_ObservedMolecule , _emitDirtyState);71 molItems << new QtMoleculeItem_occurrence(_ObservedMolecule , _emitDirtyState);66 molItems << new QtMoleculeItem_name(_ObservedMolecule); 67 molItems << new QtMoleculeItem_visibility(_ObservedMolecule); 68 molItems << new QtMoleculeItem_atomcount(_ObservedMolecule); 69 molItems << new QtMoleculeItem_formula(_ObservedMolecule); 70 molItems << new QtMoleculeItem_occurrence(_ObservedMolecule); 72 71 return molItems; 73 72 } -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeItemFactory.hpp
r924259 r7993fe 46 46 * 47 47 * \param _ObservedMolecule observed representation of the molecule 48 * \param _emitDirtyState callback function to model to inform about required state update49 48 * \return list of prepared items to be appended to a group item 50 49 */ 51 50 QList<QStandardItem *> createMoleculeItems( 52 QtObservedMolecule::ptr &_ObservedMolecule, 53 const QtMoleculeItem::emitDirtyState_t &_emitDirtyState); 51 QtObservedMolecule::ptr &_ObservedMolecule); 54 52 55 53 /** Creates all QtMoleculeItem's that make up a row of a group item. -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.cpp
r924259 r7993fe 73 73 QStandardItemModel(_parent), 74 74 update_timer(NULL), 75 board(_board), 76 callback_DirtyItems(boost::bind(&QtMoleculeList::informDirtyState, this, _1, _2, _3)) 75 board(_board) 77 76 { 78 77 setColumnCount(QtMoleculeItemFactory::COLUMNCOUNT); … … 313 312 { 314 313 QList<QStandardItem *> molItems = 315 QtMoleculeItemFactory::getInstance().createMoleculeItems( 316 _ObservedMolecule, 317 callback_DirtyItems); 314 QtMoleculeItemFactory::getInstance().createMoleculeItems(_ObservedMolecule); 318 315 QtMoleculeItem *mol_item = dynamic_cast<QtMoleculeItem *>(molItems.front()); 319 316 ASSERT( mol_item != NULL, -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp
r924259 r7993fe 135 135 MoleculeItemBiMap_t MoleculeItemBiMap; 136 136 137 //!> callback function to hand over to items that inform about requiring update138 const QtMoleculeItem::emitDirtyState_t callback_DirtyItems;139 140 137 typedef std::map<moleculeId_t, unsigned int> KilledItemsPerMolecule_t; 141 138 //!> takes note of how many items have already been killed for a specific row/molecule -
src/UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.cpp
r924259 r7993fe 42 42 QtObservedInstanceBoard *_board, 43 43 QWidget * _parent) : 44 QWidget(_parent) 44 QWidget(_parent), 45 board(_board) 45 46 { 46 47 connect(_board, SIGNAL(moleculeInserted(QtObservedMolecule::ptr)), 47 this, S IGNAL(MoleculeInserted(QtObservedMolecule::ptr)));48 this, SLOT(moleculeInserted(QtObservedMolecule::ptr))); 48 49 connect(_board, SIGNAL(moleculeRemoved(const moleculeId_t)), 49 this, SIGNAL(MoleculeRemoved(const moleculeId_t))); 50 this, SLOT(moleculeRemoved(const moleculeId_t))); 51 } 52 53 void QtObservedMoleculeObserver::moleculeInserted(const QtObservedMolecule::ptr _molecule) 54 { 55 connect( _molecule.get(), SIGNAL(formulaChanged()), this, SLOT(formulaChanged())); 56 connect( _molecule.get(), SIGNAL(nameChanged()), this, SLOT(nameChanged())); 57 emit MoleculeInserted(_molecule); 58 } 59 60 void QtObservedMoleculeObserver::moleculeRemoved(const moleculeId_t _moleculeid) 61 { 62 const QtObservedMolecule::ptr mol = board->getObservedMolecule(_moleculeid); 63 disconnect( mol.get(), SIGNAL(formulaChanged()), this, SLOT(formulaChanged())); 64 disconnect( mol.get(), SIGNAL(nameChanged()), this, SLOT(nameChanged())); 65 emit MoleculeRemoved(_moleculeid); 50 66 } 51 67 52 68 void QtObservedMoleculeObserver::formulaChanged() 53 69 { 54 QtObservedMolecule * const walker= static_cast<QtObservedMolecule *>(sender());55 emit FormulaChanged( walker->getRef());70 QtObservedMolecule * const mol = static_cast<QtObservedMolecule *>(sender()); 71 emit FormulaChanged(mol->getRef()); 56 72 } 57 73 58 74 void QtObservedMoleculeObserver::nameChanged() 59 75 { 60 QtObservedMolecule * const walker= static_cast<QtObservedMolecule *>(sender());61 emit NameChanged( walker->getRef());76 QtObservedMolecule * const mol = static_cast<QtObservedMolecule *>(sender()); 77 emit NameChanged(mol->getRef()); 62 78 } -
src/UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.hpp
r924259 r7993fe 38 38 39 39 signals: 40 void FormulaChanged(const QtObservedMolecule::ptr _ atom);41 void NameChanged(const QtObservedMolecule::ptr _ atom);40 void FormulaChanged(const QtObservedMolecule::ptr _molecule); 41 void NameChanged(const QtObservedMolecule::ptr _molecule); 42 42 43 43 // relayed signals 44 void MoleculeInserted(const QtObservedMolecule::ptr _ atom);45 void MoleculeRemoved(const atomId_t _atomid);44 void MoleculeInserted(const QtObservedMolecule::ptr _molecule); 45 void MoleculeRemoved(const moleculeId_t _molid); 46 46 47 47 private slots: … … 50 50 void nameChanged(); 51 51 52 void moleculeInserted(const QtObservedMolecule::ptr _molecule); 53 void moleculeRemoved(const moleculeId_t _molid); 54 55 private: 56 //!> ref to get object from index 57 QtObservedInstanceBoard * const board; 52 58 }; 53 59 -
src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_atomcount.hpp
r924259 r7993fe 27 27 28 28 QtMoleculeItem_atomcount( 29 QtObservedMolecule::ptr &_ObservedMolecule, 30 const emitDirtyState_t &_emitDirtyState) : 31 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::NeedsMove, _emitDirtyState) 29 QtObservedMolecule::ptr &_ObservedMolecule) : 30 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::NeedsMove) 32 31 { 33 32 // cannot call pure virtual function in QtMoleculeItem's cstor -
src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_formula.hpp
r924259 r7993fe 29 29 30 30 QtMoleculeItem_formula( 31 QtObservedMolecule::ptr &_ObservedMolecule, 32 const emitDirtyState_t &_emitDirtyState) : 33 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::NeedsMove, _emitDirtyState) 31 QtObservedMolecule::ptr &_ObservedMolecule) : 32 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::NeedsMove) 34 33 { 35 34 // cannot call pure virtual function in QtMoleculeItem's cstor -
src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_name.hpp
r924259 r7993fe 27 27 28 28 QtMoleculeItem_name( 29 QtObservedMolecule::ptr &_ObservedMolecule, 30 const emitDirtyState_t &_emitDirtyState) : 31 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove, _emitDirtyState) 29 QtObservedMolecule::ptr &_ObservedMolecule) : 30 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove) 32 31 { 33 32 // cannot call pure virtual function in QtMoleculeItem's cstor -
src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_occurrence.hpp
r924259 r7993fe 27 27 28 28 QtMoleculeItem_occurrence( 29 QtObservedMolecule::ptr &_ObservedMolecule, 30 const emitDirtyState_t &_emitDirtyState) : 31 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove, _emitDirtyState) 29 QtObservedMolecule::ptr &_ObservedMolecule) : 30 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove) 32 31 { 33 32 // cannot call pure virtual function in QtMoleculeItem's cstor -
src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_visibility.hpp
r924259 r7993fe 27 27 28 28 QtMoleculeItem_visibility( 29 QtObservedMolecule::ptr &_ObservedMolecule, 30 const emitDirtyState_t &_emitDirtyState) : 31 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove, _emitDirtyState) 29 QtObservedMolecule::ptr &_ObservedMolecule) : 30 QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove) 32 31 { 33 32 setFlags(flags() | Qt::ItemIsUserCheckable);
Note:
See TracChangeset
for help on using the changeset viewer.