source: src/UIElements/Views/QT4/QTMoleculeView.cpp@ bcf653

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 bcf653 was bcf653, checked in by Frederik Heber <heber@…>, 14 years ago

Added copyright note to each .cpp file and an extensive one to builder.cpp.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010 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 "Helpers/MemDebug.hpp"
25
26#include "molecule.hpp"
27
28using namespace std;
29
30/***************** Basic structure for tab layout ***********/
31
32QTMoleculeView::QTMoleculeView() :
33 QTabWidget()
34{
35 allPage = new QTAllMoleculePage();
36 addTab(allPage,QString("All Molecules"));
37
38 connect(this,SIGNAL(addMolecule(molecule*)),allPage,SLOT(addMolecule(molecule*)));
39 connect(this,SIGNAL(removeMolecule(molecule*)),allPage,SLOT(removeMolecule(molecule*)));
40}
41
42QTMoleculeView::~QTMoleculeView()
43{}
44
45void QTMoleculeView::moleculeSelected(molecule *mol){
46 if(!pages.count(mol)){
47 string molName = mol->GetName();
48 QTMoleculePage *molPage = new QTMoleculePage(mol,molName);
49 addTab(molPage,QString(molName.c_str()));
50 pages[mol] = molPage;
51
52 connect(molPage,SIGNAL(nameChanged(QTMoleculePage*,std::string)),this,SLOT(nameChanged(QTMoleculePage*,std::string)));
53
54 emit addMolecule(mol);
55 }
56}
57
58void QTMoleculeView::moleculeUnSelected(molecule *mol){
59 if(pages.count(mol)){
60 QTMoleculePage *molPage = pages[mol];
61 removeTab(indexOf(molPage));
62 pages.erase(mol);
63 delete molPage;
64 emit removeMolecule(mol);
65 }
66}
67
68void QTMoleculeView::nameChanged(QTMoleculePage *page, std::string name){
69 setTabText(indexOf(page),QString(name.c_str()));
70}
71
72/************************ Tab for all Molecules ********************/
73
74QTAllMoleculePage::QTAllMoleculePage() :
75 Observer("QTAllMoleculePage")
76{}
77
78void QTAllMoleculePage::addMolecule(molecule *mol){}
79
80void QTAllMoleculePage::removeMolecule(molecule *mol){}
81
82void QTAllMoleculePage::update(Observable *subject){}
83
84void QTAllMoleculePage::subjectKilled(Observable *subject){}
85
86/************************ Tab for single Molecules *****************/
87
88QTMoleculePage::QTMoleculePage(molecule *_mol, string _name) :
89 Observer("QTMoleculePage"),
90 mol(_mol), name(_name)
91{
92 mol->signOn(this);
93}
94
95QTMoleculePage::~QTMoleculePage(){
96 mol->signOff(this);
97}
98
99void QTMoleculePage::update(Observable *subject){
100 if(name != mol->GetName()){
101 name = mol->GetName();
102 emit nameChanged(this,name);
103 }
104}
105
106void QTMoleculePage::subjectKilled(Observable *subject){}
Note: See TracBrowser for help on using the repository browser.