Changeset 6f5dfe for src/UIElements/QT4
- Timestamp:
- Oct 22, 2010, 4:13:36 PM (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:
- bd2390, db7cb0
- Parents:
- e4decc
- Location:
- src/UIElements/QT4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/QT4/QTDialog.cpp
re4decc r6f5dfe 179 179 // TODO 180 180 ASSERT(false, "Not implemented yet"); 181 } 182 183 void QTDialog::queryFile(const char* title, std::string){ 184 registerQuery(new FileQTQuery(title,inputLayout,this)); 181 185 } 182 186 … … 622 626 } 623 627 628 QTDialog::FileQTQuery::FileQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog) : 629 Dialog::FileQuery(_title), 630 parent(_parent) 631 { 632 633 filenameLineEdit = new QLineEdit(_dialog); 634 filenameLineEdit->setText(QString()); 635 filenameLineEdit->setReadOnly(true); 636 637 filedialogButton = new QPushButton("&Choose", _dialog); 638 639 pipe = new FileQTQueryPipe(tmp,_dialog,filenameLineEdit,filedialogButton); 640 641 thisLayout = new QHBoxLayout(); 642 parent->addLayout(thisLayout); 643 thisLayout->addWidget(filenameLineEdit); 644 thisLayout->addWidget(filedialogButton); 645 646 QObject::connect(filedialogButton,SIGNAL(clicked()),pipe,SLOT(showFileDialog())); 647 } 648 649 QTDialog::FileQTQuery::~FileQTQuery() 650 { 651 delete pipe; 652 } 653 654 bool QTDialog::FileQTQuery::handle(){ 655 return true; 656 } 657 624 658 /*************************** Plumbing *******************************/ 625 659 … … 862 896 } 863 897 864 898 FileQTQueryPipe::FileQTQueryPipe(const boost::filesystem::path &_content, QTDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton) : 899 content(_content), 900 dialog(_dialog), 901 filenameLineEdit(_filenameLineEdit), 902 filedialogButton(_filedialogButton) 903 {} 904 905 FileQTQueryPipe::~FileQTQueryPipe() 906 {} 907 908 void FileQTQueryPipe::update() { 909 QStringList ListOfFilenames = theFileDialog->selectedFiles(); 910 std::cout << "Selected File is " << ListOfFilenames.at(0).toStdString() << std::endl; 911 content = ListOfFilenames.at(0).toStdString(); 912 dialog->update(); 913 } 914 915 void FileQTQueryPipe::showFileDialog() { 916 filedialogButton->setFlat(true); 917 if (theFileDialog == NULL) { 918 theFileDialog = new QFileDialog(NULL, tr("Open input file"), QString(), tr("ParallelCarParrinello (*.conf);;MassivelyParallelQuantumChemistry (*.mpqc);;ParticleDataBase (*.pdb);;XYZ (*.xyz)")); 919 theFileDialog->setAcceptMode(QFileDialog::AcceptOpen); 920 theFileDialog->setFileMode(QFileDialog::ExistingFile); 921 theFileDialog->setViewMode(QFileDialog::List); 922 } 923 theFileDialog->show(); 924 925 filenameLineEdit->setText(QString()); 926 filedialogButton->setFlat(false); 927 } 928 929 930 -
src/UIElements/QT4/QTDialog.hpp
re4decc r6f5dfe 11 11 #include "UIElements/Dialog.hpp" 12 12 #include <QtGui/QDialog> 13 #include <QtGui/QFileDialog> 14 15 #include <boost/filesystem.hpp> 13 16 14 17 class QBoxLayout; … … 37 40 class VectorQTQueryPipe; 38 41 class VectorsQTQueryPipe; 42 class FileQTQueryPipe; 39 43 40 44 class QTDialog : public QDialog, public Dialog … … 62 66 virtual void queryElement(const char*,std::string = ""); 63 67 virtual void queryElements(const char*,std::string = ""); 68 virtual void queryFile(const char*,std::string = ""); 64 69 65 70 virtual bool display(); … … 271 276 272 277 ElementsQTQueryPipe *pipe; 278 }; 279 280 class FileQTQuery : public Dialog::FileQuery { 281 public: 282 FileQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog); 283 virtual ~FileQTQuery(); 284 virtual bool handle(); 285 private: 286 QBoxLayout *parent; 287 QBoxLayout *thisLayout; 288 QLineEdit *filenameLineEdit; 289 QPushButton *filedialogButton; 290 291 FileQTQueryPipe *pipe; 273 292 }; 274 293 … … 477 496 QComboBox *theBox; 478 497 }; 498 499 class FileQTQueryPipe : public QWidget { 500 Q_OBJECT 501 public: 502 FileQTQueryPipe(const boost::filesystem::path &_content, QTDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton); 503 virtual ~FileQTQueryPipe(); 504 505 public slots: 506 void update(); 507 void showFileDialog(); 508 509 private: 510 boost::filesystem::path content; 511 QTDialog *dialog; 512 QLineEdit *filenameLineEdit; 513 QPushButton *filedialogButton; 514 QFileDialog *theFileDialog; 515 }; 516 479 517 #endif /* QTDIALOG_HPP_ */
Note:
See TracChangeset
for help on using the changeset viewer.