Changeset f4b6bc9 for src/UIElements/Qt4


Ignore:
Timestamp:
Apr 4, 2018, 4:59:24 PM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
Children:
0aae02
Parents:
775f3f
git-author:
Frederik Heber <frederik.heber@…> (07/06/17 22:18:13)
git-committer:
Frederik Heber <frederik.heber@…> (04/04/18 16:59:24)
Message:

Query::handle() no longer returns bool but has internal result flag.

  • we use this flag conditionally in setResult(), i.e. if the handle() has failed, then we should not set its result which might overwrite a present default value in the parameter.
  • this fixes the problem with StepWorldTime which has a default value of 1 but which was overwritten with 0 because of the non-conditionally calling of setResult().
  • this required change of "output-types" default parameter to an empty vector. So far, we were just lucky that this actually worked.
  • also StoreSaturatedFragmentAction needed the same change as default values have to be consistent over the specific token.
Location:
src/UIElements/Qt4
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/QtDialog.cpp

    r775f3f rf4b6bc9  
    7878  update();
    7979  if(exec()) {
     80    // handleAll() basically just sets handleSuccess to true
     81    handleAll();
     82    // setAll() will then set the Parameter<> using the internal temp value of the QtQuery instances
    8083    setAll();
    8184    return true;
  • src/UIElements/Qt4/Query/AtomQtQuery.cpp

    r775f3f rf4b6bc9  
    7575  int idx = data.toInt();
    7676  temp = const_cast<const World &>(World::getInstance()).getAtom(AtomById(idx));
     77  QtQuery<const atom *>::handle();
    7778  dialog->update();
    7879}
  • src/UIElements/Qt4/Query/AtomsQtQuery.cpp

    r775f3f rf4b6bc9  
    7272void QtDialog::AtomsQtQuery::onAddElement() {
    7373  addElement();
     74  QtQuery<std::vector<const atom *> >::handle();
    7475}
    7576
    7677void QtDialog::AtomsQtQuery::onRemoveElement() {
    7778  removeElements();
     79  QtQuery<std::vector<const atom *> >::handle();
    7880}
    7981
  • src/UIElements/Qt4/Query/BooleanQtQuery.cpp

    r775f3f rf4b6bc9  
    6969void QtDialog::BooleanQtQuery::onUpdate(int state) {
    7070  temp = (state == Qt::Checked);
     71  QtQuery<bool>::handle();
    7172  dialog->update();
    7273}
  • src/UIElements/Qt4/Query/DoubleQtQuery.cpp

    r775f3f rf4b6bc9  
    7070void QtDialog::DoubleQtQuery::onUpdate(double newDbl) {
    7171  temp = newDbl;
     72  QtQuery<double>::handle();
    7273  dialog->update();
    7374}
  • src/UIElements/Qt4/Query/DoublesQtQuery.cpp

    r775f3f rf4b6bc9  
    7272void QtDialog::DoublesQtQuery::onAddElement() {
    7373  addElement();
     74  QtQuery<std::vector<double> >::handle();
    7475}
    7576
    7677void QtDialog::DoublesQtQuery::onRemoveElement() {
    7778  removeElements();
     79  QtQuery<std::vector<double> >::handle();
    7880}
    7981
  • src/UIElements/Qt4/Query/ElementQtQuery.cpp

    r775f3f rf4b6bc9  
    7979  int idx = data.toInt();
    8080  temp = World::getInstance().getPeriode()->FindElement(idx);
     81  QtQuery<const element *>::handle();
    8182  dialog->update();
    8283}
  • src/UIElements/Qt4/Query/ElementsQtQuery.cpp

    r775f3f rf4b6bc9  
    7373void QtDialog::ElementsQtQuery::onAddElement() {
    7474  addElement();
     75  QtQuery<std::vector<const element *> >::handle();
    7576}
    7677
    7778void QtDialog::ElementsQtQuery::onRemoveElement() {
    7879  removeElements();
     80  QtQuery<std::vector<const element *> >::handle();
    7981}
    8082
  • src/UIElements/Qt4/Query/EmptyQtQuery.cpp

    r775f3f rf4b6bc9  
    5858}
    5959
    60 bool QtDialog::EmptyQtQuery::handle(){
    61   return true;
     60void QtDialog::EmptyQtQuery::handle(){
     61  return;
    6262}
    6363
  • src/UIElements/Qt4/Query/FileQtQuery.cpp

    r775f3f rf4b6bc9  
    113113  std::cout << "Selected File is " << ListOfFilenames.at(0).toStdString() << std::endl;
    114114  temp = ListOfFilenames.at(0).toStdString();
     115  QtQuery<boost::filesystem::path>::handle();
    115116  filenameLineEdit->setText(QString::fromStdString(temp.string()));
    116117  dialog->update();
  • src/UIElements/Qt4/Query/FilesQtQuery.cpp

    r775f3f rf4b6bc9  
    7373void QtDialog::FilesQtQuery::onAddElement() {
    7474  addElement();
     75  QtQuery<std::vector<boost::filesystem::path> >::handle();
    7576}
    7677
    7778void QtDialog::FilesQtQuery::onRemoveElement() {
    7879  removeElements();
     80  QtQuery<std::vector<boost::filesystem::path> >::handle();
    7981}
    8082
  • src/UIElements/Qt4/Query/IntQtQuery.cpp

    r775f3f rf4b6bc9  
    6868void QtDialog::IntQtQuery::onUpdate(int newInt) {
    6969  temp = newInt;
     70  QtQuery<int>::handle();
    7071  dialog->update();
    7172}
  • src/UIElements/Qt4/Query/IntsQtQuery.cpp

    r775f3f rf4b6bc9  
    7272void QtDialog::IntsQtQuery::onAddElement() {
    7373  addElement();
     74  QtQuery<std::vector<int> >::handle();
    7475}
    7576
    7677void QtDialog::IntsQtQuery::onRemoveElement() {
    7778  removeElements();
     79  QtQuery<std::vector<int> >::handle();
    7880}
    7981
  • src/UIElements/Qt4/Query/KeyValuePairQtQuery.cpp

    r775f3f rf4b6bc9  
    8888void QtDialog::KeyValuePairQtQuery::onUpdate(const QString& newText) {
    8989  temp = newText.toStdString();
     90  QtQuery<KeyValuePair>::handle();
    9091  dialog->update();
    9192}
     
    9394void QtDialog::KeyValuePairQtQuery::onUpdateCombo(int newIndex) {
    9495  temp = comboBox->itemText(newIndex).toStdString();
     96  QtQuery<KeyValuePair>::handle();
    9597  dialog->update();
    9698}
  • src/UIElements/Qt4/Query/KeyValuePairsQtQuery.cpp

    r775f3f rf4b6bc9  
    7373void QtDialog::KeyValuePairsQtQuery::onAddElement() {
    7474  addElement();
     75  QtQuery<std::vector<KeyValuePair> >::handle();
    7576}
    7677
    7778void QtDialog::KeyValuePairsQtQuery::onRemoveElement() {
    7879  removeElements();
     80  QtQuery<std::vector<KeyValuePair> >::handle();
    7981}
    8082
  • src/UIElements/Qt4/Query/MoleculeQtQuery.cpp

    r775f3f rf4b6bc9  
    7979  int idx = data.toInt();
    8080  temp = const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(idx));
     81  QtQuery<const molecule *>::handle();
    8182  dialog->update();
    8283}
  • src/UIElements/Qt4/Query/MoleculesQtQuery.cpp

    r775f3f rf4b6bc9  
    7272void QtDialog::MoleculesQtQuery::onAddElement() {
    7373  addElement();
     74  QtQuery<std::vector<const molecule *> >::handle();
    7475}
    7576
    7677void QtDialog::MoleculesQtQuery::onRemoveElement() {
    7778  removeElements();
     79  QtQuery<std::vector<const molecule *> >::handle();
    7880}
    7981
  • src/UIElements/Qt4/Query/QtQuery.hpp

    r775f3f rf4b6bc9  
    4343    Dialog::TQuery<T>(_param, _title, _description) {}
    4444  // QtQueries are interactive - no need for handle().
    45   virtual bool handle(){  return true;  }
     45  virtual ~QtQuery() {}
     46  virtual void handle(){ Dialog::TQuery<T>::handleSuccess = true; }
    4647};
    4748
     
    186187  EmptyQtQuery(const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
    187188  virtual ~EmptyQtQuery();
    188   virtual bool handle();
     189  virtual void handle();
    189190private:
    190191  QBoxLayout *parent;
  • src/UIElements/Qt4/Query/RealSpaceMatrixQtQuery.cpp

    r775f3f rf4b6bc9  
    8383{
    8484  temp.at(row, column) = inputTable->item(row, column)->text().toDouble();
     85  QtQuery<RealSpaceMatrix>::handle();
    8586  dialog->update();
    8687}
  • src/UIElements/Qt4/Query/StringQtQuery.cpp

    r775f3f rf4b6bc9  
    8787void QtDialog::StringQtQuery::onUpdate(const QString& newText) {
    8888  temp = newText.toStdString();
     89  QtQuery<std::string>::handle();
    8990  dialog->update();
    9091}
     
    9293void QtDialog::StringQtQuery::onUpdateCombo(int newIndex) {
    9394  temp = comboBox->itemText(newIndex).toStdString();
     95  QtQuery<std::string>::handle();
    9496  dialog->update();
    9597}
  • src/UIElements/Qt4/Query/StringsQtQuery.cpp

    r775f3f rf4b6bc9  
    7272void QtDialog::StringsQtQuery::onAddElement() {
    7373  addElement();
     74  QtQuery<std::vector<std::string> >::handle();
    7475}
    7576
    7677void QtDialog::StringsQtQuery::onRemoveElement() {
    7778  removeElements();
     79  QtQuery<std::vector<std::string> >::handle();
    7880}
    7981
  • src/UIElements/Qt4/Query/UnsignedIntQtQuery.cpp

    r775f3f rf4b6bc9  
    7070void QtDialog::UnsignedIntQtQuery::onUpdate(int newUnsignedInt) {
    7171  temp = newUnsignedInt;
     72  QtQuery<unsigned int>::handle();
    7273  dialog->update();
    7374}
  • src/UIElements/Qt4/Query/UnsignedIntsQtQuery.cpp

    r775f3f rf4b6bc9  
    7272void QtDialog::UnsignedIntsQtQuery::onAddElement() {
    7373  addElement();
     74  QtQuery<std::vector<unsigned int> >::handle();
    7475}
    7576
    7677void QtDialog::UnsignedIntsQtQuery::onRemoveElement() {
    7778  removeElements();
     79  QtQuery<std::vector<unsigned int> >::handle();
    7880}
    7981
  • src/UIElements/Qt4/Query/VectorQtQuery.cpp

    r775f3f rf4b6bc9  
    165165  const QString itemtext = nameComboBox->itemText(index);
    166166  temp = itemtext.toStdString();
     167  QtQuery<Vector>::handle();
    167168  dialog->update();
    168169}
     
    170171void QtDialog::VectorQtQuery::onUpdateX(double newDouble) {
    171172  updateVectorString(temp, newDouble, 0);
     173  QtQuery<Vector>::handle();
    172174  dialog->update();
    173175}
     
    175177void QtDialog::VectorQtQuery::onUpdateY(double newDouble) {
    176178  updateVectorString(temp, newDouble, 1);
     179  QtQuery<Vector>::handle();
    177180  dialog->update();
    178181}
     
    180183void QtDialog::VectorQtQuery::onUpdateZ(double newDouble) {
    181184  updateVectorString(temp, newDouble, 2);
     185  QtQuery<Vector>::handle();
    182186  dialog->update();
    183187}
  • src/UIElements/Qt4/Query/VectorsQtQuery.cpp

    r775f3f rf4b6bc9  
    7373void QtDialog::VectorsQtQuery::onAddElement() {
    7474  addElement();
     75  QtQuery<std::vector<Vector> >::handle();
    7576}
    7677
    7778void QtDialog::VectorsQtQuery::onRemoveElement() {
    7879  removeElements();
     80  QtQuery<std::vector<Vector> >::handle();
    7981}
    8082
Note: See TracChangeset for help on using the changeset viewer.