Changeset cd8e55 for src/UIElements/QT4


Ignore:
Timestamp:
Jul 2, 2010, 1:05:08 PM (15 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:
4a611e
Parents:
edb454
Message:

New StringsQuery that returns space-separated vector of strings.

Signed-off-by: Frederik Heber <heber@…>

Location:
src/UIElements/QT4
Files:
2 edited

Legend:

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

    redb454 rcd8e55  
    113113}
    114114
     115void QTDialog::queryStrings(const char* title, std::vector<std::string> *target,string)
     116{
     117  registerQuery(new StringsQTQuery(title,target,inputLayout,this));
     118}
     119
    115120void QTDialog::queryMolecule(const char *title,molecule **target,string)
    116121{
     
    210215{
    211216  return tmp!="";
     217}
     218
     219QTDialog::StringsQTQuery::StringsQTQuery(string _title,vector<string> *_target,QBoxLayout *_parent,QTDialog *_dialog) :
     220    Dialog::StringsQuery(_title,_target),
     221    parent(_parent)
     222{
     223  thisLayout = new QHBoxLayout();
     224  titleLabel = new QLabel(QString(getTitle().c_str()));
     225  inputBox = new QLineEdit();
     226  parent->addLayout(thisLayout);
     227  thisLayout->addWidget(titleLabel);
     228  thisLayout->addWidget(inputBox);
     229
     230  pipe = new StringQTQueryPipe(&temp,_dialog);
     231  pipe->update(inputBox->text());
     232  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(update(const QString&)));
     233}
     234
     235QTDialog::StringsQTQuery::~StringsQTQuery()
     236{
     237  delete pipe;
     238}
     239
     240// All values besides the empty string are valid
     241bool QTDialog::StringsQTQuery::handle()
     242{
     243  // dissect by ","
     244  string::iterator olditer = temp.begin();
     245  for(string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {
     246    if (*iter == ' ') {
     247      tmp.push_back(string(iter, olditer));
     248      olditer = iter;
     249    }
     250  }
     251  if (olditer != temp.begin())  // insert last part also
     252    tmp.push_back(string(olditer, temp.end()));
     253
     254  return temp!="";
    212255}
    213256
  • src/UIElements/QT4/QTDialog.hpp

    redb454 rcd8e55  
    4040  virtual void queryDouble(const char*,double *,std::string = "");
    4141  virtual void queryString(const char*, std::string *,std::string = "");
     42  virtual void queryStrings(const char*, std::vector<std::string> *,std::string = "");
    4243  virtual void queryAtom(const char*,atom**,std::string = "");
    4344  virtual void queryMolecule(const char*,molecule**,std::string = "");
     
    9394    };
    9495
     96    class StringsQTQuery : public Dialog::StringsQuery {
     97    public:
     98      StringsQTQuery(std::string _title, std::vector<std::string> *_target, QBoxLayout *_parent,QTDialog *_dialog);
     99      virtual ~StringsQTQuery();
     100      virtual bool handle();
     101    private:
     102      QBoxLayout *parent;
     103      QBoxLayout *thisLayout;
     104      QLabel *titleLabel;
     105      QLineEdit *inputBox;
     106
     107      StringQTQueryPipe *pipe;
     108    };
     109
    95110    class MoleculeQTQuery : public Dialog::MoleculeQuery {
    96111    public:
Note: See TracChangeset for help on using the changeset viewer.