source: src/UIElements/Views/Qt4/QtMoleculeView.cpp@ f99714

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

Added additional check in CodeCheck's project disclaimer for current year in copyright.

  • had to modify all .cpp files to update to 2011.
  • Property mode set to 100644
File size: 2.5 KB
RevLine 
[bcf653]1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
[d103d3]4 * Copyright (C) 2010-2011 University of Bonn. All rights reserved.
[bcf653]5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
[b47bfc]8/*
[4cf323d]9 * QtMoleculeView.cpp
[b47bfc]10 *
11 * Created on: Mar 4, 2010
12 * Author: crueger
13 */
14
[bf3817]15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
[bbbad5]19
[4cf323d]20#include "Views/Qt4/QtMoleculeView.hpp"
[b47bfc]21
22#include <iostream>
23
[ad011c]24#include "CodePatterns/MemDebug.hpp"
[bbbad5]25
26#include "molecule.hpp"
[b47bfc]27
28using namespace std;
29
30/***************** Basic structure for tab layout ***********/
31
[4cf323d]32QtMoleculeView::QtMoleculeView() :
[b47bfc]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
[4cf323d]42QtMoleculeView::~QtMoleculeView()
[b47bfc]43{}
44
[4cf323d]45void QtMoleculeView::moleculeSelected(molecule *mol){
[b47bfc]46 if(!pages.count(mol)){
[fa60dd]47 string molName = mol->name;
[b47bfc]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
[4cf323d]58void QtMoleculeView::moleculeUnSelected(molecule *mol){
[b47bfc]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
[4cf323d]68void QtMoleculeView::nameChanged(QTMoleculePage *page, std::string name){
[b47bfc]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){
[fa60dd]100 if(name != mol->name){
101 name = mol->name;
[b47bfc]102 emit nameChanged(this,name);
103 }
104}
105
106void QTMoleculePage::subjectKilled(Observable *subject){}
Note: See TracBrowser for help on using the repository browser.