[d3a5ea] | 1 | /*
|
---|
| 2 | * QTDialog.cpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Jan 18, 2010
|
---|
| 5 | * Author: crueger
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "UIElements/QT4/QTDialog.hpp"
|
---|
| 9 |
|
---|
| 10 | #include <string>
|
---|
| 11 | #include <sstream>
|
---|
[b8d1aeb] | 12 | #include <limits>
|
---|
[d3a5ea] | 13 |
|
---|
| 14 | #include <Qt/qboxlayout.h>
|
---|
| 15 | #include <Qt/qlabel.h>
|
---|
| 16 | #include <Qt/qspinbox.h>
|
---|
[b8d1aeb] | 17 | #include <QtGui/QDoubleSpinBox>
|
---|
[d3a5ea] | 18 | #include <Qt/qlineedit.h>
|
---|
| 19 | #include <Qt/qdialogbuttonbox.h>
|
---|
| 20 | #include <Qt/qpushbutton.h>
|
---|
| 21 | #include <Qt/qcombobox.h>
|
---|
| 22 |
|
---|
[257c77] | 23 | #include "Helpers/MemDebug.hpp"
|
---|
| 24 |
|
---|
[cbf01e] | 25 | #include "World.hpp"
|
---|
| 26 | #include "periodentafel.hpp"
|
---|
[d3a5ea] | 27 | #include "atom.hpp"
|
---|
[cbf01e] | 28 | #include "element.hpp"
|
---|
[d3a5ea] | 29 | #include "molecule.hpp"
|
---|
[257c77] | 30 | #include "Descriptors/MoleculeIdDescriptor.hpp"
|
---|
[5ec8e3] | 31 | #include "Matrix.hpp"
|
---|
| 32 | #include "Box.hpp"
|
---|
[d3a5ea] | 33 |
|
---|
| 34 |
|
---|
| 35 | using namespace std;
|
---|
| 36 |
|
---|
| 37 | QTDialog::QTDialog() :
|
---|
| 38 | QDialog(0)
|
---|
| 39 | {
|
---|
| 40 | // creating and filling of the Dialog window
|
---|
| 41 | mainLayout = new QVBoxLayout();
|
---|
| 42 | inputLayout = new QVBoxLayout();
|
---|
| 43 | buttonLayout = new QVBoxLayout();
|
---|
| 44 | setLayout(mainLayout);
|
---|
| 45 | mainLayout->addLayout(inputLayout);
|
---|
| 46 | mainLayout->addLayout(buttonLayout);
|
---|
| 47 | buttons = new QDialogButtonBox(QDialogButtonBox::Ok| QDialogButtonBox::Cancel);
|
---|
| 48 | buttonLayout->addWidget(buttons);
|
---|
| 49 |
|
---|
| 50 | // Disable the ok button until something was entered
|
---|
| 51 | buttons->button(QDialogButtonBox::Ok)->setEnabled(false);
|
---|
| 52 |
|
---|
| 53 | // connect the buttons to their appropriate slots
|
---|
| 54 | connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
---|
| 55 | connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | QTDialog::~QTDialog()
|
---|
| 59 | {
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | bool QTDialog::display(){
|
---|
| 63 | // Button state might have changed by some update that
|
---|
| 64 | // was done during query construction. To make sure
|
---|
| 65 | // the state is correct, we just call update one more time.
|
---|
| 66 | update();
|
---|
| 67 | if(exec()) {
|
---|
| 68 | setAll();
|
---|
| 69 | return true;
|
---|
| 70 | }
|
---|
| 71 | else {
|
---|
| 72 | return false;
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | void QTDialog::update(){
|
---|
| 77 | buttons->button(QDialogButtonBox::Ok)->setEnabled(checkAll());
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | /************************** Query Infrastructure ************************/
|
---|
| 81 |
|
---|
[257c77] | 82 | void QTDialog::queryEmpty(char const*, string){
|
---|
| 83 | // TODO
|
---|
| 84 | ASSERT(false, "Not implemented yet");
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | void QTDialog::queryBoolean(char const*, bool*,string){
|
---|
| 88 | // TODO
|
---|
| 89 | ASSERT(false, "Not implemented yet");
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | void QTDialog::queryAtom(char const*, atom**, string){
|
---|
| 93 | // TODO
|
---|
| 94 | ASSERT(false, "Not implemented yet");
|
---|
| 95 | }
|
---|
| 96 |
|
---|
[5ec8e3] | 97 | void QTDialog::queryBox(char const*, Box*, string){
|
---|
[257c77] | 98 | // TODO
|
---|
| 99 | ASSERT(false, "Not implemented yet");
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | void QTDialog::queryInt(const char *title, int *target,string)
|
---|
[d3a5ea] | 104 | {
|
---|
| 105 | registerQuery(new IntQTQuery(title,target,inputLayout,this));
|
---|
| 106 | }
|
---|
| 107 |
|
---|
[257c77] | 108 | void QTDialog::queryDouble(const char* title, double* target,string){
|
---|
[b8d1aeb] | 109 | registerQuery(new DoubleQTQuery(title,target,inputLayout,this));
|
---|
| 110 | }
|
---|
| 111 |
|
---|
[257c77] | 112 | void QTDialog::queryString(const char* title, std::string *target,string)
|
---|
[d3a5ea] | 113 | {
|
---|
| 114 | registerQuery(new StringQTQuery(title,target,inputLayout,this));
|
---|
| 115 | }
|
---|
| 116 |
|
---|
[cd8e55] | 117 | void QTDialog::queryStrings(const char* title, std::vector<std::string> *target,string)
|
---|
| 118 | {
|
---|
| 119 | registerQuery(new StringsQTQuery(title,target,inputLayout,this));
|
---|
| 120 | }
|
---|
| 121 |
|
---|
[257c77] | 122 | void QTDialog::queryMolecule(const char *title,molecule **target,string)
|
---|
[d3a5ea] | 123 | {
|
---|
[257c77] | 124 | registerQuery(new MoleculeQTQuery(title,target,inputLayout,this));
|
---|
[d3a5ea] | 125 | }
|
---|
| 126 |
|
---|
[5ec8e3] | 127 | void QTDialog::queryVector(const char* title, Vector *target, bool check,string) {
|
---|
| 128 | registerQuery(new VectorQTQuery(title,target,check,inputLayout,this));
|
---|
[b8d1aeb] | 129 | }
|
---|
| 130 |
|
---|
[257c77] | 131 | void QTDialog::queryElement(const char* title, std::vector<element *> *target,string){
|
---|
[cbf01e] | 132 | registerQuery(new ElementQTQuery(title,target,inputLayout,this));
|
---|
| 133 | }
|
---|
| 134 |
|
---|
[b8d1aeb] | 135 | /************************** Query Objects *******************************/
|
---|
| 136 |
|
---|
[d3a5ea] | 137 | QTDialog::IntQTQuery::IntQTQuery(string _title,int *_target,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 138 | Dialog::IntQuery(_title,_target),
|
---|
| 139 | parent(_parent)
|
---|
| 140 | {
|
---|
| 141 | thisLayout = new QHBoxLayout();
|
---|
| 142 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 143 | inputBox = new QSpinBox();
|
---|
| 144 | inputBox->setValue(0);
|
---|
| 145 | parent->addLayout(thisLayout);
|
---|
| 146 | thisLayout->addWidget(titleLabel);
|
---|
| 147 | thisLayout->addWidget(inputBox);
|
---|
| 148 |
|
---|
| 149 | pipe = new IntQTQueryPipe(&tmp,_dialog);
|
---|
| 150 | pipe->update(inputBox->value());
|
---|
| 151 | connect(inputBox,SIGNAL(valueChanged(int)),pipe,SLOT(update(int)));
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | QTDialog::IntQTQuery::~IntQTQuery()
|
---|
| 155 | {
|
---|
| 156 | delete pipe;
|
---|
| 157 | }
|
---|
| 158 |
|
---|
| 159 | // Handling is easy since the GUI makes it impossible to enter invalid values
|
---|
| 160 | bool QTDialog::IntQTQuery::handle()
|
---|
| 161 | {
|
---|
| 162 | return true;
|
---|
| 163 | }
|
---|
| 164 |
|
---|
[b8d1aeb] | 165 | QTDialog::DoubleQTQuery::DoubleQTQuery(string title,double *_target,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 166 | Dialog::DoubleQuery(title,_target),
|
---|
| 167 | parent(_parent)
|
---|
| 168 | {
|
---|
| 169 | thisLayout = new QHBoxLayout();
|
---|
| 170 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 171 | inputBox = new QDoubleSpinBox();
|
---|
| 172 | inputBox->setValue(0);
|
---|
| 173 | inputBox->setRange(-numeric_limits<double>::max(),numeric_limits<double>::max());
|
---|
| 174 | inputBox->setDecimals(3);
|
---|
| 175 | parent->addLayout(thisLayout);
|
---|
| 176 | thisLayout->addWidget(titleLabel);
|
---|
| 177 | thisLayout->addWidget(inputBox);
|
---|
| 178 |
|
---|
| 179 | pipe = new DoubleQTQueryPipe(&tmp,_dialog);
|
---|
| 180 | pipe->update(inputBox->value());
|
---|
| 181 | connect(inputBox,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | QTDialog::DoubleQTQuery::~DoubleQTQuery()
|
---|
| 185 | {
|
---|
| 186 | delete pipe;
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | bool QTDialog::DoubleQTQuery::handle() {
|
---|
| 190 | return true;
|
---|
| 191 | }
|
---|
| 192 |
|
---|
[d3a5ea] | 193 |
|
---|
| 194 | QTDialog::StringQTQuery::StringQTQuery(string _title,string *_target,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 195 | Dialog::StringQuery(_title,_target),
|
---|
| 196 | parent(_parent)
|
---|
| 197 | {
|
---|
| 198 | thisLayout = new QHBoxLayout();
|
---|
| 199 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 200 | inputBox = new QLineEdit();
|
---|
| 201 | parent->addLayout(thisLayout);
|
---|
| 202 | thisLayout->addWidget(titleLabel);
|
---|
| 203 | thisLayout->addWidget(inputBox);
|
---|
| 204 |
|
---|
| 205 | pipe = new StringQTQueryPipe(&tmp,_dialog);
|
---|
| 206 | pipe->update(inputBox->text());
|
---|
| 207 | connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(update(const QString&)));
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | QTDialog::StringQTQuery::~StringQTQuery()
|
---|
| 211 | {
|
---|
| 212 | delete pipe;
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | // All values besides the empty string are valid
|
---|
| 216 | bool QTDialog::StringQTQuery::handle()
|
---|
| 217 | {
|
---|
| 218 | return tmp!="";
|
---|
| 219 | }
|
---|
| 220 |
|
---|
[cd8e55] | 221 | QTDialog::StringsQTQuery::StringsQTQuery(string _title,vector<string> *_target,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 222 | Dialog::StringsQuery(_title,_target),
|
---|
| 223 | parent(_parent)
|
---|
| 224 | {
|
---|
| 225 | thisLayout = new QHBoxLayout();
|
---|
| 226 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 227 | inputBox = new QLineEdit();
|
---|
| 228 | parent->addLayout(thisLayout);
|
---|
| 229 | thisLayout->addWidget(titleLabel);
|
---|
| 230 | thisLayout->addWidget(inputBox);
|
---|
| 231 |
|
---|
| 232 | pipe = new StringQTQueryPipe(&temp,_dialog);
|
---|
| 233 | pipe->update(inputBox->text());
|
---|
| 234 | connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(update(const QString&)));
|
---|
| 235 | }
|
---|
| 236 |
|
---|
| 237 | QTDialog::StringsQTQuery::~StringsQTQuery()
|
---|
| 238 | {
|
---|
| 239 | delete pipe;
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | // All values besides the empty string are valid
|
---|
| 243 | bool QTDialog::StringsQTQuery::handle()
|
---|
| 244 | {
|
---|
| 245 | // dissect by ","
|
---|
| 246 | string::iterator olditer = temp.begin();
|
---|
| 247 | for(string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {
|
---|
| 248 | if (*iter == ' ') {
|
---|
| 249 | tmp.push_back(string(iter, olditer));
|
---|
| 250 | olditer = iter;
|
---|
| 251 | }
|
---|
| 252 | }
|
---|
| 253 | if (olditer != temp.begin()) // insert last part also
|
---|
| 254 | tmp.push_back(string(olditer, temp.end()));
|
---|
| 255 |
|
---|
| 256 | return temp!="";
|
---|
| 257 | }
|
---|
| 258 |
|
---|
[257c77] | 259 | QTDialog::MoleculeQTQuery::MoleculeQTQuery(string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 260 | Dialog::MoleculeQuery(_title,_target),
|
---|
[d3a5ea] | 261 | parent(_parent)
|
---|
| 262 | {
|
---|
| 263 | thisLayout = new QHBoxLayout();
|
---|
| 264 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 265 | inputBox = new QComboBox();
|
---|
| 266 | // add all molecules to the combo box
|
---|
[257c77] | 267 | vector<molecule*> molecules = World::getInstance().getAllMolecules();
|
---|
| 268 | for(vector<molecule*>::iterator iter = molecules.begin();
|
---|
| 269 | iter != molecules.end();
|
---|
[cbf01e] | 270 | ++iter) {
|
---|
[d3a5ea] | 271 | stringstream sstr;
|
---|
[6adb96] | 272 | sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
|
---|
[d3a5ea] | 273 | inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr));
|
---|
| 274 | }
|
---|
| 275 | parent->addLayout(thisLayout);
|
---|
| 276 | thisLayout->addWidget(titleLabel);
|
---|
| 277 | thisLayout->addWidget(inputBox);
|
---|
| 278 |
|
---|
[257c77] | 279 | pipe = new MoleculeQTQueryPipe(&tmp,_dialog,inputBox);
|
---|
[d3a5ea] | 280 | pipe->update(inputBox->currentIndex());
|
---|
| 281 | connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | QTDialog::MoleculeQTQuery::~MoleculeQTQuery()
|
---|
| 285 | {
|
---|
| 286 | delete pipe;
|
---|
| 287 | }
|
---|
| 288 |
|
---|
| 289 | // Handling is easy, since the GUI makes it impossible to select invalid values
|
---|
| 290 | bool QTDialog::MoleculeQTQuery::handle()
|
---|
| 291 | {
|
---|
| 292 | return true;
|
---|
| 293 | }
|
---|
| 294 |
|
---|
[5ec8e3] | 295 | QTDialog::VectorQTQuery::VectorQTQuery(std::string title, Vector *_target, bool _check,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 296 | Dialog::VectorQuery(title,_target,_check),
|
---|
[b8d1aeb] | 297 | parent(_parent)
|
---|
| 298 | {
|
---|
[5ec8e3] | 299 | const Matrix& M = World::getInstance().getDomain().getM();
|
---|
[b8d1aeb] | 300 | const char *coords[3] = {"x:","y:","z:"};
|
---|
| 301 | mainLayout= new QHBoxLayout();
|
---|
| 302 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 303 | mainLayout->addWidget(titleLabel);
|
---|
| 304 | subLayout = new QVBoxLayout();
|
---|
| 305 | mainLayout->addLayout(subLayout);
|
---|
| 306 | for(int i=0; i<3; i++) {
|
---|
| 307 | coordLayout[i] = new QHBoxLayout();
|
---|
| 308 | subLayout->addLayout(coordLayout[i]);
|
---|
| 309 | coordLabel[i] = new QLabel(QString(coords[i]));
|
---|
| 310 | coordLayout[i]->addWidget(coordLabel[i]);
|
---|
| 311 | coordInput[i] = new QDoubleSpinBox();
|
---|
[5ec8e3] | 312 | coordInput[i]->setRange(0,M.at(i,i));
|
---|
[b8d1aeb] | 313 | coordInput[i]->setDecimals(3);
|
---|
| 314 | coordLayout[i]->addWidget(coordInput[i]);
|
---|
| 315 | pipe[i] = new DoubleQTQueryPipe(&((*tmp)[i]),_dialog);
|
---|
| 316 | pipe[i]->update(coordInput[i]->value());
|
---|
| 317 | connect(coordInput[i],SIGNAL(valueChanged(double)),pipe[i],SLOT(update(double)));
|
---|
| 318 |
|
---|
| 319 | }
|
---|
| 320 | parent->addLayout(mainLayout);
|
---|
| 321 | }
|
---|
| 322 |
|
---|
| 323 | QTDialog::VectorQTQuery::~VectorQTQuery()
|
---|
| 324 | {}
|
---|
| 325 |
|
---|
| 326 | bool QTDialog::VectorQTQuery::handle() {
|
---|
| 327 | return true;
|
---|
| 328 | }
|
---|
| 329 |
|
---|
[d3a5ea] | 330 |
|
---|
[257c77] | 331 | QTDialog::ElementQTQuery::ElementQTQuery(std::string _title, vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog) :
|
---|
[cbf01e] | 332 | Dialog::ElementQuery(_title,_target),
|
---|
| 333 | parent(_parent)
|
---|
| 334 | {
|
---|
[cd032d] | 335 | periodentafel *periode = World::getInstance().getPeriode();
|
---|
[cbf01e] | 336 | thisLayout = new QHBoxLayout();
|
---|
| 337 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 338 | inputBox = new QComboBox();
|
---|
[68d781] | 339 | for(periodentafel::const_iterator iter = periode->begin();
|
---|
| 340 | iter!=periode->end();
|
---|
| 341 | ++iter)
|
---|
[cbf01e] | 342 | {
|
---|
| 343 | stringstream sstr;
|
---|
[68d781] | 344 | sstr << (*iter).first << "\t" << (*iter).second->name;
|
---|
| 345 | inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
|
---|
[cbf01e] | 346 | }
|
---|
| 347 | parent->addLayout(thisLayout);
|
---|
| 348 | thisLayout->addWidget(titleLabel);
|
---|
| 349 | thisLayout->addWidget(inputBox);
|
---|
| 350 |
|
---|
[257c77] | 351 | pipe = new ElementQTQueryPipe(&elements,_dialog,inputBox);
|
---|
[cbf01e] | 352 | pipe->update(inputBox->currentIndex());
|
---|
| 353 | connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
|
---|
| 354 | }
|
---|
| 355 |
|
---|
| 356 | QTDialog::ElementQTQuery::~ElementQTQuery()
|
---|
| 357 | {
|
---|
| 358 | delete pipe;
|
---|
| 359 | }
|
---|
| 360 |
|
---|
| 361 | bool QTDialog::ElementQTQuery::handle(){
|
---|
| 362 | return true;
|
---|
| 363 | }
|
---|
| 364 |
|
---|
[d3a5ea] | 365 | /*************************** Plumbing *******************************/
|
---|
| 366 |
|
---|
| 367 | StringQTQueryPipe::StringQTQueryPipe(string *_content, QTDialog *_dialog) :
|
---|
| 368 | content(_content),
|
---|
| 369 | dialog(_dialog)
|
---|
| 370 | {}
|
---|
| 371 |
|
---|
| 372 | StringQTQueryPipe::~StringQTQueryPipe()
|
---|
| 373 | {}
|
---|
| 374 |
|
---|
| 375 | void StringQTQueryPipe::update(const QString& newText) {
|
---|
| 376 | content->assign(newText.toStdString());
|
---|
| 377 | dialog->update();
|
---|
| 378 | }
|
---|
| 379 |
|
---|
| 380 | IntQTQueryPipe::IntQTQueryPipe(int *_content, QTDialog *_dialog) :
|
---|
| 381 | content(_content),
|
---|
| 382 | dialog(_dialog)
|
---|
| 383 | {}
|
---|
| 384 |
|
---|
| 385 | IntQTQueryPipe::~IntQTQueryPipe()
|
---|
| 386 | {}
|
---|
| 387 |
|
---|
| 388 | void IntQTQueryPipe::update(int newInt) {
|
---|
| 389 | (*content) = newInt;
|
---|
| 390 | dialog->update();
|
---|
| 391 | }
|
---|
| 392 |
|
---|
[b8d1aeb] | 393 | DoubleQTQueryPipe::DoubleQTQueryPipe(double *_content, QTDialog *_dialog) :
|
---|
| 394 | content(_content),
|
---|
| 395 | dialog(_dialog)
|
---|
| 396 | {}
|
---|
| 397 |
|
---|
| 398 | DoubleQTQueryPipe::~DoubleQTQueryPipe()
|
---|
| 399 | {}
|
---|
| 400 |
|
---|
| 401 | void DoubleQTQueryPipe::update(double newDbl) {
|
---|
| 402 | (*content) = newDbl;
|
---|
| 403 | dialog->update();
|
---|
| 404 | }
|
---|
| 405 |
|
---|
[257c77] | 406 | MoleculeQTQueryPipe::MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox) :
|
---|
[d3a5ea] | 407 | content(_content),
|
---|
| 408 | dialog(_dialog),
|
---|
[257c77] | 409 | theBox(_theBox)
|
---|
[d3a5ea] | 410 | {}
|
---|
| 411 |
|
---|
| 412 | MoleculeQTQueryPipe::~MoleculeQTQueryPipe()
|
---|
| 413 | {}
|
---|
| 414 |
|
---|
| 415 | void MoleculeQTQueryPipe::update(int newIndex) {
|
---|
| 416 | QVariant data = theBox->itemData(newIndex);
|
---|
| 417 | int idx = data.toInt();
|
---|
[257c77] | 418 | (*content) = World::getInstance().getMolecule(MoleculeById(idx));
|
---|
[d3a5ea] | 419 | dialog->update();
|
---|
| 420 | }
|
---|
| 421 |
|
---|
[257c77] | 422 | ElementQTQueryPipe::ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox) :
|
---|
[cbf01e] | 423 | content(_content),
|
---|
| 424 | dialog(_dialog),
|
---|
| 425 | theBox(_theBox)
|
---|
[257c77] | 426 | {
|
---|
| 427 | content->resize(1);
|
---|
| 428 | }
|
---|
[cbf01e] | 429 |
|
---|
| 430 | ElementQTQueryPipe::~ElementQTQueryPipe()
|
---|
| 431 | {}
|
---|
| 432 |
|
---|
| 433 | void ElementQTQueryPipe::update(int newIndex) {
|
---|
| 434 | QVariant data = theBox->itemData(newIndex);
|
---|
| 435 | int idx = data.toInt();
|
---|
[257c77] | 436 | (*content)[0] = World::getInstance().getPeriode()->FindElement(idx);
|
---|
[cbf01e] | 437 | dialog->update();
|
---|
| 438 | }
|
---|
| 439 |
|
---|