Changeset 41167c
- Timestamp:
- Oct 25, 2010, 9:10:22 AM (14 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:
- 81126a
- Parents:
- c96c66
- Location:
- src/UIElements/QT4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/QT4/QTDialog.cpp
rc96c66 r41167c 26 26 #include <limits> 27 27 28 #include <QtGui/QDoubleSpinBox> 28 29 #include <Qt/qboxlayout.h> 30 #include <Qt/qcombobox.h> 31 #include <Qt/qdialogbuttonbox.h> 29 32 #include <Qt/qlabel.h> 30 #include <Qt/qspinbox.h>31 #include <QtGui/QDoubleSpinBox>32 33 #include <Qt/qlineedit.h> 33 34 #include <Qt/qlistwidget.h> 34 #include <Qt/qdialogbuttonbox.h>35 35 #include <Qt/qpushbutton.h> 36 #include <Qt/qcombobox.h> 36 #include <Qt/qspinbox.h> 37 #include <Qt/qtablewidget.h> 37 38 38 39 #include <boost/lexical_cast.hpp> … … 118 119 } 119 120 120 void QTDialog::queryBox(const char* title, std::string){ 121 void QTDialog::queryBox(const char* title, std::string) 122 { 123 registerQuery(new BoxQTQuery(title,inputLayout,this)); 124 } 125 126 void QTDialog::queryInt(const char *title,string) 127 { 128 registerQuery(new IntQTQuery(title,inputLayout,this)); 129 } 130 131 void QTDialog::queryInts(const char *title,string) 132 { 133 registerQuery(new IntsQTQuery(title,inputLayout,this)); 134 } 135 136 void QTDialog::queryDouble(const char* title,string) 137 { 138 registerQuery(new DoubleQTQuery(title,inputLayout,this)); 139 } 140 141 void QTDialog::queryDoubles(const char* title,string) 142 { 143 registerQuery(new DoublesQTQuery(title,inputLayout,this)); 144 } 145 146 void QTDialog::queryString(const char* title,string) 147 { 148 registerQuery(new StringQTQuery(title,inputLayout,this)); 149 } 150 151 void QTDialog::queryStrings(const char* title,string) 152 { 153 registerQuery(new StringsQTQuery(title,inputLayout,this)); 154 } 155 156 void QTDialog::queryMolecule(const char *title,string) 157 { 158 registerQuery(new MoleculeQTQuery(title,inputLayout,this)); 159 } 160 161 void QTDialog::queryMolecules(const char *title,string) 162 { 121 163 // TODO 122 164 ASSERT(false, "Not implemented yet"); 123 165 } 124 166 125 126 void QTDialog::queryInt(const char *title,string) 127 { 128 registerQuery(new IntQTQuery(title,inputLayout,this)); 129 } 130 131 void QTDialog::queryInts(const char *title,string) 132 { 133 registerQuery(new IntsQTQuery(title,inputLayout,this)); 134 } 135 136 void QTDialog::queryDouble(const char* title,string) 137 { 138 registerQuery(new DoubleQTQuery(title,inputLayout,this)); 139 } 140 141 void QTDialog::queryDoubles(const char* title,string) 142 { 143 registerQuery(new DoublesQTQuery(title,inputLayout,this)); 144 } 145 146 void QTDialog::queryString(const char* title,string) 147 { 148 registerQuery(new StringQTQuery(title,inputLayout,this)); 149 } 150 151 void QTDialog::queryStrings(const char* title,string) 152 { 153 registerQuery(new StringsQTQuery(title,inputLayout,this)); 154 } 155 156 void QTDialog::queryMolecule(const char *title,string) 157 { 158 registerQuery(new MoleculeQTQuery(title,inputLayout,this)); 159 } 160 161 void QTDialog::queryMolecules(const char *title,string) 167 void QTDialog::queryVector(const char* title, bool check,string) 168 { 169 registerQuery(new VectorQTQuery(title,check,inputLayout,this)); 170 } 171 172 void QTDialog::queryVectors(const char* title, bool check,string) 162 173 { 163 174 // TODO … … 165 176 } 166 177 167 void QTDialog::query Vector(const char* title, bool check,string)168 { 169 registerQuery(new VectorQTQuery(title,check,inputLayout,this));170 } 171 172 void QTDialog::query Vectors(const char* title, bool check,string)178 void QTDialog::queryElement(const char* title, std::string) 179 { 180 registerQuery(new ElementQTQuery(title,inputLayout,this)); 181 } 182 183 void QTDialog::queryElements(const char* title, std::string) 173 184 { 174 185 // TODO … … 176 187 } 177 188 178 void QTDialog::queryElement(const char* title, std::string)179 {180 registerQuery(new ElementQTQuery(title,inputLayout,this));181 }182 183 void QTDialog::queryElements(const char* title, std::string)184 {185 // TODO186 ASSERT(false, "Not implemented yet");187 }188 189 189 void QTDialog::queryFile(const char* title, std::string) 190 190 { … … 193 193 194 194 /************************** Query Objects *******************************/ 195 196 QTDialog::BoxQTQuery::BoxQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) : 197 Dialog::BoxQuery(_title), 198 parent(_parent) 199 { 200 thisLayout = new QHBoxLayout(); 201 titleLabel = new QLabel(QString(getTitle().c_str())); 202 203 // init input table 204 inputTable = new QTableWidget(3,3, _dialog); 205 QStringList CoordinateList; 206 CoordinateList << "x" << "y" << "z"; 207 inputTable->setHorizontalHeaderLabels(CoordinateList); 208 inputTable->setVerticalHeaderLabels(CoordinateList); 209 210 pipe = new BoxQTQueryPipe(tmp,_dialog, inputTable); 211 212 // fill the box with current matrix 213 const Matrix &domain = World::getInstance().getDomain().getM(); 214 for (int i=0;i<3;i++) 215 for (int j=0;j<3;j++) { 216 QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(domain.at(i,j))); 217 inputTable->setItem(i,j,newItem); 218 pipe->update(i,j); 219 } 220 221 parent->addLayout(thisLayout); 222 thisLayout->addWidget(titleLabel); 223 thisLayout->addWidget(inputTable); 224 225 connect(inputTable,SIGNAL(cellChanged(int,int)),pipe,SLOT(update(int,int))); 226 } 227 228 QTDialog::BoxQTQuery::~BoxQTQuery() 229 { 230 delete pipe; 231 } 232 233 bool QTDialog::BoxQTQuery::handle() { 234 return true; 235 } 236 195 237 196 238 QTDialog::AtomQTQuery::AtomQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) : … … 931 973 } 932 974 975 BoxQTQueryPipe::BoxQTQueryPipe(Box &_content, QTDialog *_dialog, QTableWidget *_inputTable) : 976 content(_content), 977 dialog(_dialog), 978 inputTable(_inputTable) 979 { 980 tmpM = new Matrix(); 981 tmpM->zero(); 982 } 983 984 BoxQTQueryPipe::~BoxQTQueryPipe() 985 { 986 delete tmpM; 987 } 988 989 void BoxQTQueryPipe::update(int row, int column) 990 { 991 tmpM->at(row, column) = inputTable->item(row, column)->text().toDouble(); 992 content.setM(*tmpM); 993 dialog->update(); 994 } 995 996 933 997 AtomQTQueryPipe::AtomQTQueryPipe(atom **_content, QTDialog *_dialog, QComboBox *_theBox) : 934 998 content(_content), -
src/UIElements/QT4/QTDialog.hpp
rc96c66 r41167c 25 25 class QLineEdit; 26 26 class QListWidget; 27 class QTableWidget; 27 28 class QComboBox; 28 29 class QDialogButtonBox; 29 30 31 class Matrix; 30 32 31 33 // Forward declarations for plumbing 32 34 template<typename T> class QTQueryListPipe; 33 35 class BooleanQTQueryPipe; 36 class BoxQTQueryPipe; 34 37 class StringQTQueryPipe; 35 38 class StringsQTQueryPipe; … … 166 169 }; 167 170 171 class BoxQTQuery : public Dialog::BoxQuery { 172 public: 173 BoxQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog); 174 virtual ~BoxQTQuery(); 175 virtual bool handle(); 176 private: 177 QBoxLayout *parent; 178 QBoxLayout *thisLayout; 179 QLabel *titleLabel; 180 QTableWidget *inputTable; 181 182 BoxQTQueryPipe *pipe; 183 }; 184 168 185 class AtomQTQuery : public Dialog::AtomQuery { 169 186 public: … … 406 423 }; 407 424 425 class BoxQTQueryPipe : public QWidget { 426 Q_OBJECT 427 public: 428 BoxQTQueryPipe(Box &_content, QTDialog *_dialog, QTableWidget *_inputTable); 429 virtual ~BoxQTQueryPipe(); 430 431 public slots: 432 void update(int,int); 433 434 private: 435 Box &content; 436 QTDialog *dialog; 437 QTableWidget *inputTable; 438 439 Matrix *tmpM; 440 }; 441 442 408 443 class AtomQTQueryPipe : public QWidget { 409 444 Q_OBJECT
Note:
See TracChangeset
for help on using the changeset viewer.