source: src/UIElements/Views/Qt4/QtMoleculeView.cpp@ 7b6bcfe

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
Last change on this file since 7b6bcfe was 7b6bcfe, checked in by Michael Ankele <ankele@…>, 13 years ago

QtMoleculeView: pages for hovering atom and molecule (no information yet)

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
8/*
9 * QtMoleculeView.cpp
10 *
11 * Created on: Mar 4, 2010
12 * Author: crueger
13 */
14
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "Views/Qt4/QtMoleculeView.hpp"
21
22#include <iostream>
23
24#include "CodePatterns/MemDebug.hpp"
25
26#include "molecule.hpp"
27
28using namespace std;
29
30/***************** Basic structure for tab layout ***********/
31
32QtMoleculeView::QtMoleculeView() :
33 QTabWidget(),
34 page_mol(NULL), page_atom(NULL)
35{
36 /*allPage = new QTAllMoleculePage();
37 addTab(allPage,QString("All Molecules"));
38
39 connect(this,SIGNAL(addMolecule(molecule*)),allPage,SLOT(addMolecule(molecule*)));
40 connect(this,SIGNAL(removeMolecule(molecule*)),allPage,SLOT(removeMolecule(molecule*)));*/
41}
42
43QtMoleculeView::~QtMoleculeView()
44{}
45
46/*void QtMoleculeView::moleculeSelected(molecule *mol){
47 if(!pages.count(mol)){
48 string molName = mol->name;
49 QTMoleculePage *molPage = new QTMoleculePage(mol,molName);
50 addTab(molPage,QString(molName.c_str()));
51 pages[mol] = molPage;
52
53 connect(molPage,SIGNAL(nameChanged(QTMoleculePage*,std::string)),this,SLOT(nameChanged(QTMoleculePage*,std::string)));
54
55 emit addMolecule(mol);
56 }
57}
58
59void QtMoleculeView::moleculeUnSelected(molecule *mol){
60 if(pages.count(mol)){
61 QTMoleculePage *molPage = pages[mol];
62 removeTab(indexOf(molPage));
63 pages.erase(mol);
64 delete molPage;
65 emit removeMolecule(mol);
66 }
67}
68
69void QtMoleculeView::nameChanged(QTMoleculePage *page, std::string name){
70 setTabText(indexOf(page),QString(name.c_str()));
71}*/
72
73void QtMoleculeView::nameChanged(QTMoleculePage *page, std::string name){}
74
75void QtMoleculeView::atomHover(const atom *_atom)
76{
77 // Remove old tabs.
78 if (page_atom){
79 removeTab(indexOf(page_atom));
80 delete(page_atom);
81 page_atom = NULL;
82 }
83 if (page_mol){
84 removeTab(indexOf(page_mol));
85 delete(page_mol);
86 page_mol = NULL;
87 }
88
89
90 // Show new tabs.
91 if (_atom){
92 page_atom = new QTAtomPage(_atom, "test");
93 addTab(page_atom, "atom...");
94 }
95}
96
97/************************ Tab for single Atoms ********************/
98
99QTAtomPage::QTAtomPage(const atom *_atom,std::string _name) :
100 Observer("QTAtomPage"),
101 atomRef(_atom), name(_name)
102{
103 atomRef->signOn(this);
104}
105
106QTAtomPage::~QTAtomPage()
107{
108 atomRef->signOff(this);
109}
110
111void QTAtomPage::update(Observable *subject){
112 /*if(name != atomRef->name){
113 name = atomRef->name;
114 emit nameChanged(this,name);
115 }*/
116}
117
118void QTAtomPage::subjectKilled(Observable *subject){}
119
120/************************ Tab for single Molecules *****************/
121
122QTMoleculePage::QTMoleculePage(const molecule *_mol, std::string _name) :
123 Observer("QTMoleculePage"),
124 mol(_mol), name(_name)
125{
126 mol->signOn(this);
127}
128
129QTMoleculePage::~QTMoleculePage(){
130 mol->signOff(this);
131}
132
133void QTMoleculePage::update(Observable *subject){
134 if(name != mol->name){
135 name = mol->name;
136 emit nameChanged(this,name);
137 }
138}
139
140void QTMoleculePage::subjectKilled(Observable *subject){}
Note: See TracBrowser for help on using the repository browser.