Ignore:
Timestamp:
Jul 17, 2012, 12:17:28 PM (13 years ago)
Author:
Michael Ankele <ankele@…>
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:
7772aa
Parents:
4f7473
git-author:
Michael Ankele <ankele@…> (06/19/12 13:46:00)
git-committer:
Michael Ankele <ankele@…> (07/17/12 12:17:28)
Message:

QtMoleculeView using a timer to delay the display after hovering

Location:
src/UIElements/Views/Qt4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/QtMoleculeView.cpp

    r4f7473 r4a2f3e  
    3434QtMoleculeView::QtMoleculeView() :
    3535    QTabWidget(),
     36    curAtom(NULL), nextAtom(NULL),
    3637    page_mol(NULL), page_atom(NULL)
    3738{
    38   /*allPage = new QTAllMoleculePage();
    39   addTab(allPage,QString("All Molecules"));
     39  timer = new QTimer(this);
     40  timer->setSingleShot(true);
    4041
    41   connect(this,SIGNAL(addMolecule(molecule*)),allPage,SLOT(addMolecule(molecule*)));
    42   connect(this,SIGNAL(removeMolecule(molecule*)),allPage,SLOT(removeMolecule(molecule*)));*/
     42  connect(timer, SIGNAL(timeout()), this, SLOT(timerTimeout()));
    4343}
    4444
     
    4646{}
    4747
    48 /*void QtMoleculeView::moleculeSelected(molecule *mol){
    49   if(!pages.count(mol)){
    50     string molName = mol->name;
    51     QTMoleculePage *molPage = new QTMoleculePage(mol,molName);
    52     addTab(molPage,QString(molName.c_str()));
    53     pages[mol] = molPage;
    54 
    55     connect(molPage,SIGNAL(nameChanged(QTMoleculePage*,std::string)),this,SLOT(nameChanged(QTMoleculePage*,std::string)));
    56 
    57     emit addMolecule(mol);
    58   }
    59 }
    60 
    61 void QtMoleculeView::moleculeUnSelected(molecule *mol){
    62   if(pages.count(mol)){
    63     QTMoleculePage *molPage = pages[mol];
    64     removeTab(indexOf(molPage));
    65     pages.erase(mol);
    66     delete molPage;
    67     emit removeMolecule(mol);
    68   }
    69 }
    70 
    71 void QtMoleculeView::nameChanged(QTMoleculePage *page, std::string name){
    72   setTabText(indexOf(page),QString(name.c_str()));
    73 }*/
    74 
    7548void QtMoleculeView::nameChanged(QTMoleculePage *page, std::string name){}
    7649
    7750void QtMoleculeView::atomHover(const atom *_atom)
    7851{
     52  nextAtom = _atom;
     53  timer->start(500);
     54}
     55
     56void QtMoleculeView::timerTimeout()
     57{
     58  if (nextAtom)
     59    showAtom(nextAtom);
     60}
     61
     62void QtMoleculeView::showAtom(const atom *_atom)
     63{
     64  curAtom = _atom;
     65
    7966  // Remove old tabs.
    8067  if (page_atom){
     
    9178
    9279  // Show new tabs.
    93   if (_atom){
    94     page_atom = new QTAtomPage(_atom);
     80  if (curAtom){
     81    page_atom = new QTAtomPage(curAtom);
    9582    addTab(page_atom, "Atom");
    9683
    97     page_mol = new QTMoleculePage(_atom->getMolecule());
     84    page_mol = new QTMoleculePage(curAtom->getMolecule());
    9885    addTab(page_mol, "Molecule");
    9986  }
  • src/UIElements/Views/Qt4/QtMoleculeView.hpp

    r4f7473 r4a2f3e  
    1818#include <QtGui/QTabWidget>
    1919#include <QtGui/QTreeWidget>
     20#include <QTimer>
    2021#include "CodePatterns/Observer/Observer.hpp"
    2122
     
    3435  virtual ~QtMoleculeView();
    3536
     37  void showAtom(const atom *_atom);
     38
    3639public slots:
    3740  void atomHover(const atom *_atom);
     41  void timerTimeout();
    3842
    3943  void nameChanged(QTMoleculePage *page, std::string name);
    4044
    4145private:
     46  const atom *curAtom;
     47  const atom *nextAtom;
    4248  QTMoleculePage *page_mol;
    4349  QTAtomPage *page_atom;
     50
     51  QTimer *timer;
    4452};
    4553
Note: See TracChangeset for help on using the changeset viewer.