Changeset 41167c


Ignore:
Timestamp:
Oct 25, 2010, 9:10:22 AM (14 years ago)
Author:
Frederik Heber <heber@…>
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
Message:

Added BoxQTQuery.

Location:
src/UIElements/QT4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/QT4/QTDialog.cpp

    rc96c66 r41167c  
    2626#include <limits>
    2727
     28#include <QtGui/QDoubleSpinBox>
    2829#include <Qt/qboxlayout.h>
     30#include <Qt/qcombobox.h>
     31#include <Qt/qdialogbuttonbox.h>
    2932#include <Qt/qlabel.h>
    30 #include <Qt/qspinbox.h>
    31 #include <QtGui/QDoubleSpinBox>
    3233#include <Qt/qlineedit.h>
    3334#include <Qt/qlistwidget.h>
    34 #include <Qt/qdialogbuttonbox.h>
    3535#include <Qt/qpushbutton.h>
    36 #include <Qt/qcombobox.h>
     36#include <Qt/qspinbox.h>
     37#include <Qt/qtablewidget.h>
    3738
    3839#include <boost/lexical_cast.hpp>
     
    118119}
    119120
    120 void QTDialog::queryBox(const char* title, std::string){
     121void QTDialog::queryBox(const char* title, std::string)
     122{
     123  registerQuery(new BoxQTQuery(title,inputLayout,this));
     124}
     125
     126void QTDialog::queryInt(const char *title,string)
     127{
     128  registerQuery(new IntQTQuery(title,inputLayout,this));
     129}
     130
     131void QTDialog::queryInts(const char *title,string)
     132{
     133  registerQuery(new IntsQTQuery(title,inputLayout,this));
     134}
     135
     136void QTDialog::queryDouble(const char* title,string)
     137{
     138  registerQuery(new DoubleQTQuery(title,inputLayout,this));
     139}
     140
     141void QTDialog::queryDoubles(const char* title,string)
     142{
     143  registerQuery(new DoublesQTQuery(title,inputLayout,this));
     144}
     145
     146void QTDialog::queryString(const char* title,string)
     147{
     148  registerQuery(new StringQTQuery(title,inputLayout,this));
     149}
     150
     151void QTDialog::queryStrings(const char* title,string)
     152{
     153  registerQuery(new StringsQTQuery(title,inputLayout,this));
     154}
     155
     156void QTDialog::queryMolecule(const char *title,string)
     157{
     158  registerQuery(new MoleculeQTQuery(title,inputLayout,this));
     159}
     160
     161void QTDialog::queryMolecules(const char *title,string)
     162{
    121163  // TODO
    122164  ASSERT(false, "Not implemented yet");
    123165}
    124166
    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)
     167void QTDialog::queryVector(const char* title, bool check,string)
     168{
     169  registerQuery(new VectorQTQuery(title,check,inputLayout,this));
     170}
     171
     172void QTDialog::queryVectors(const char* title, bool check,string)
    162173{
    163174  // TODO
     
    165176}
    166177
    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)
     178void QTDialog::queryElement(const char* title, std::string)
     179{
     180  registerQuery(new ElementQTQuery(title,inputLayout,this));
     181}
     182
     183void QTDialog::queryElements(const char* title, std::string)
    173184{
    174185  // TODO
     
    176187}
    177188
    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   // TODO
    186   ASSERT(false, "Not implemented yet");
    187 }
    188 
    189189void QTDialog::queryFile(const char* title, std::string)
    190190{
     
    193193
    194194/************************** Query Objects *******************************/
     195
     196QTDialog::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
     228QTDialog::BoxQTQuery::~BoxQTQuery()
     229{
     230  delete pipe;
     231}
     232
     233bool QTDialog::BoxQTQuery::handle() {
     234  return true;
     235}
     236
    195237
    196238QTDialog::AtomQTQuery::AtomQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) :
     
    931973}
    932974
     975BoxQTQueryPipe::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
     984BoxQTQueryPipe::~BoxQTQueryPipe()
     985{
     986  delete tmpM;
     987}
     988
     989void 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
    933997AtomQTQueryPipe::AtomQTQueryPipe(atom **_content, QTDialog *_dialog, QComboBox *_theBox) :
    934998  content(_content),
  • src/UIElements/QT4/QTDialog.hpp

    rc96c66 r41167c  
    2525class QLineEdit;
    2626class QListWidget;
     27class QTableWidget;
    2728class QComboBox;
    2829class QDialogButtonBox;
    2930
     31class Matrix;
    3032
    3133// Forward declarations for plumbing
    3234template<typename T> class QTQueryListPipe;
    3335class BooleanQTQueryPipe;
     36class BoxQTQueryPipe;
    3437class StringQTQueryPipe;
    3538class StringsQTQueryPipe;
     
    166169    };
    167170
     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
    168185    class AtomQTQuery : public Dialog::AtomQuery {
    169186    public:
     
    406423};
    407424
     425class BoxQTQueryPipe : public QWidget {
     426  Q_OBJECT
     427public:
     428  BoxQTQueryPipe(Box &_content, QTDialog *_dialog, QTableWidget *_inputTable);
     429  virtual ~BoxQTQueryPipe();
     430
     431public slots:
     432  void update(int,int);
     433
     434private:
     435  Box &content;
     436  QTDialog *dialog;
     437  QTableWidget *inputTable;
     438
     439  Matrix *tmpM;
     440};
     441
     442
    408443class AtomQTQueryPipe : public QWidget {
    409444  Q_OBJECT
Note: See TracChangeset for help on using the changeset viewer.