[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"
|
---|
[d3a5ea] | 31 |
|
---|
| 32 |
|
---|
| 33 | using namespace std;
|
---|
| 34 |
|
---|
| 35 | QTDialog::QTDialog() :
|
---|
| 36 | QDialog(0)
|
---|
| 37 | {
|
---|
| 38 | // creating and filling of the Dialog window
|
---|
| 39 | mainLayout = new QVBoxLayout();
|
---|
| 40 | inputLayout = new QVBoxLayout();
|
---|
| 41 | buttonLayout = new QVBoxLayout();
|
---|
| 42 | setLayout(mainLayout);
|
---|
| 43 | mainLayout->addLayout(inputLayout);
|
---|
| 44 | mainLayout->addLayout(buttonLayout);
|
---|
| 45 | buttons = new QDialogButtonBox(QDialogButtonBox::Ok| QDialogButtonBox::Cancel);
|
---|
| 46 | buttonLayout->addWidget(buttons);
|
---|
| 47 |
|
---|
| 48 | // Disable the ok button until something was entered
|
---|
| 49 | buttons->button(QDialogButtonBox::Ok)->setEnabled(false);
|
---|
| 50 |
|
---|
| 51 | // connect the buttons to their appropriate slots
|
---|
| 52 | connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
---|
| 53 | connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | QTDialog::~QTDialog()
|
---|
| 57 | {
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | bool QTDialog::display(){
|
---|
| 61 | // Button state might have changed by some update that
|
---|
| 62 | // was done during query construction. To make sure
|
---|
| 63 | // the state is correct, we just call update one more time.
|
---|
| 64 | update();
|
---|
| 65 | if(exec()) {
|
---|
| 66 | setAll();
|
---|
| 67 | return true;
|
---|
| 68 | }
|
---|
| 69 | else {
|
---|
| 70 | return false;
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | void QTDialog::update(){
|
---|
| 75 | buttons->button(QDialogButtonBox::Ok)->setEnabled(checkAll());
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | /************************** Query Infrastructure ************************/
|
---|
| 79 |
|
---|
[257c77] | 80 | void QTDialog::queryEmpty(char const*, string){
|
---|
| 81 | // TODO
|
---|
| 82 | ASSERT(false, "Not implemented yet");
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | void QTDialog::queryBoolean(char const*, bool*,string){
|
---|
| 86 | // TODO
|
---|
| 87 | ASSERT(false, "Not implemented yet");
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | void QTDialog::queryAtom(char const*, atom**, string){
|
---|
| 91 | // TODO
|
---|
| 92 | ASSERT(false, "Not implemented yet");
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | void QTDialog::queryBox(char const*, double**, string){
|
---|
| 96 | // TODO
|
---|
| 97 | ASSERT(false, "Not implemented yet");
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | void QTDialog::queryInt(const char *title, int *target,string)
|
---|
[d3a5ea] | 102 | {
|
---|
| 103 | registerQuery(new IntQTQuery(title,target,inputLayout,this));
|
---|
| 104 | }
|
---|
| 105 |
|
---|
[257c77] | 106 | void QTDialog::queryDouble(const char* title, double* target,string){
|
---|
[b8d1aeb] | 107 | registerQuery(new DoubleQTQuery(title,target,inputLayout,this));
|
---|
| 108 | }
|
---|
| 109 |
|
---|
[257c77] | 110 | void QTDialog::queryString(const char* title, std::string *target,string)
|
---|
[d3a5ea] | 111 | {
|
---|
| 112 | registerQuery(new StringQTQuery(title,target,inputLayout,this));
|
---|
| 113 | }
|
---|
| 114 |
|
---|
[cd8e55] | 115 | void QTDialog::queryStrings(const char* title, std::vector<std::string> *target,string)
|
---|
| 116 | {
|
---|
| 117 | registerQuery(new StringsQTQuery(title,target,inputLayout,this));
|
---|
| 118 | }
|
---|
| 119 |
|
---|
[257c77] | 120 | void QTDialog::queryMolecule(const char *title,molecule **target,string)
|
---|
[d3a5ea] | 121 | {
|
---|
[257c77] | 122 | registerQuery(new MoleculeQTQuery(title,target,inputLayout,this));
|
---|
[d3a5ea] | 123 | }
|
---|
| 124 |
|
---|
[257c77] | 125 | void QTDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check,string) {
|
---|
[b8d1aeb] | 126 | registerQuery(new VectorQTQuery(title,target,cellSize,check,inputLayout,this));
|
---|
| 127 | }
|
---|
| 128 |
|
---|
[257c77] | 129 | void QTDialog::queryElement(const char* title, std::vector<element *> *target,string){
|
---|
[cbf01e] | 130 | registerQuery(new ElementQTQuery(title,target,inputLayout,this));
|
---|
| 131 | }
|
---|
| 132 |
|
---|
[b8d1aeb] | 133 | /************************** Query Objects *******************************/
|
---|
| 134 |
|
---|
[d3a5ea] | 135 | QTDialog::IntQTQuery::IntQTQuery(string _title,int *_target,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 136 | Dialog::IntQuery(_title,_target),
|
---|
| 137 | parent(_parent)
|
---|
| 138 | {
|
---|
| 139 | thisLayout = new QHBoxLayout();
|
---|
| 140 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 141 | inputBox = new QSpinBox();
|
---|
| 142 | inputBox->setValue(0);
|
---|
| 143 | parent->addLayout(thisLayout);
|
---|
| 144 | thisLayout->addWidget(titleLabel);
|
---|
| 145 | thisLayout->addWidget(inputBox);
|
---|
| 146 |
|
---|
| 147 | pipe = new IntQTQueryPipe(&tmp,_dialog);
|
---|
| 148 | pipe->update(inputBox->value());
|
---|
| 149 | connect(inputBox,SIGNAL(valueChanged(int)),pipe,SLOT(update(int)));
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | QTDialog::IntQTQuery::~IntQTQuery()
|
---|
| 153 | {
|
---|
| 154 | delete pipe;
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | // Handling is easy since the GUI makes it impossible to enter invalid values
|
---|
| 158 | bool QTDialog::IntQTQuery::handle()
|
---|
| 159 | {
|
---|
| 160 | return true;
|
---|
| 161 | }
|
---|
| 162 |
|
---|
[b8d1aeb] | 163 | QTDialog::DoubleQTQuery::DoubleQTQuery(string title,double *_target,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 164 | Dialog::DoubleQuery(title,_target),
|
---|
| 165 | parent(_parent)
|
---|
| 166 | {
|
---|
| 167 | thisLayout = new QHBoxLayout();
|
---|
| 168 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 169 | inputBox = new QDoubleSpinBox();
|
---|
| 170 | inputBox->setValue(0);
|
---|
| 171 | inputBox->setRange(-numeric_limits<double>::max(),numeric_limits<double>::max());
|
---|
| 172 | inputBox->setDecimals(3);
|
---|
| 173 | parent->addLayout(thisLayout);
|
---|
| 174 | thisLayout->addWidget(titleLabel);
|
---|
| 175 | thisLayout->addWidget(inputBox);
|
---|
| 176 |
|
---|
| 177 | pipe = new DoubleQTQueryPipe(&tmp,_dialog);
|
---|
| 178 | pipe->update(inputBox->value());
|
---|
| 179 | connect(inputBox,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | QTDialog::DoubleQTQuery::~DoubleQTQuery()
|
---|
| 183 | {
|
---|
| 184 | delete pipe;
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | bool QTDialog::DoubleQTQuery::handle() {
|
---|
| 188 | return true;
|
---|
| 189 | }
|
---|
| 190 |
|
---|
[d3a5ea] | 191 |
|
---|
| 192 | QTDialog::StringQTQuery::StringQTQuery(string _title,string *_target,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 193 | Dialog::StringQuery(_title,_target),
|
---|
| 194 | parent(_parent)
|
---|
| 195 | {
|
---|
| 196 | thisLayout = new QHBoxLayout();
|
---|
| 197 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 198 | inputBox = new QLineEdit();
|
---|
| 199 | parent->addLayout(thisLayout);
|
---|
| 200 | thisLayout->addWidget(titleLabel);
|
---|
| 201 | thisLayout->addWidget(inputBox);
|
---|
| 202 |
|
---|
| 203 | pipe = new StringQTQueryPipe(&tmp,_dialog);
|
---|
| 204 | pipe->update(inputBox->text());
|
---|
| 205 | connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(update(const QString&)));
|
---|
| 206 | }
|
---|
| 207 |
|
---|
| 208 | QTDialog::StringQTQuery::~StringQTQuery()
|
---|
| 209 | {
|
---|
| 210 | delete pipe;
|
---|
| 211 | }
|
---|
| 212 |
|
---|
| 213 | // All values besides the empty string are valid
|
---|
| 214 | bool QTDialog::StringQTQuery::handle()
|
---|
| 215 | {
|
---|
| 216 | return tmp!="";
|
---|
| 217 | }
|
---|
| 218 |
|
---|
[cd8e55] | 219 | QTDialog::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 |
|
---|
| 235 | QTDialog::StringsQTQuery::~StringsQTQuery()
|
---|
| 236 | {
|
---|
| 237 | delete pipe;
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | // All values besides the empty string are valid
|
---|
| 241 | bool 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!="";
|
---|
| 255 | }
|
---|
| 256 |
|
---|
[257c77] | 257 | QTDialog::MoleculeQTQuery::MoleculeQTQuery(string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 258 | Dialog::MoleculeQuery(_title,_target),
|
---|
[d3a5ea] | 259 | parent(_parent)
|
---|
| 260 | {
|
---|
| 261 | thisLayout = new QHBoxLayout();
|
---|
| 262 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 263 | inputBox = new QComboBox();
|
---|
| 264 | // add all molecules to the combo box
|
---|
[257c77] | 265 | vector<molecule*> molecules = World::getInstance().getAllMolecules();
|
---|
| 266 | for(vector<molecule*>::iterator iter = molecules.begin();
|
---|
| 267 | iter != molecules.end();
|
---|
[cbf01e] | 268 | ++iter) {
|
---|
[d3a5ea] | 269 | stringstream sstr;
|
---|
[6adb96] | 270 | sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
|
---|
[d3a5ea] | 271 | inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr));
|
---|
| 272 | }
|
---|
| 273 | parent->addLayout(thisLayout);
|
---|
| 274 | thisLayout->addWidget(titleLabel);
|
---|
| 275 | thisLayout->addWidget(inputBox);
|
---|
| 276 |
|
---|
[257c77] | 277 | pipe = new MoleculeQTQueryPipe(&tmp,_dialog,inputBox);
|
---|
[d3a5ea] | 278 | pipe->update(inputBox->currentIndex());
|
---|
| 279 | connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
|
---|
| 280 | }
|
---|
| 281 |
|
---|
| 282 | QTDialog::MoleculeQTQuery::~MoleculeQTQuery()
|
---|
| 283 | {
|
---|
| 284 | delete pipe;
|
---|
| 285 | }
|
---|
| 286 |
|
---|
| 287 | // Handling is easy, since the GUI makes it impossible to select invalid values
|
---|
| 288 | bool QTDialog::MoleculeQTQuery::handle()
|
---|
| 289 | {
|
---|
| 290 | return true;
|
---|
| 291 | }
|
---|
| 292 |
|
---|
[b8d1aeb] | 293 | QTDialog::VectorQTQuery::VectorQTQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check,QBoxLayout *_parent,QTDialog *_dialog) :
|
---|
| 294 | Dialog::VectorQuery(title,_target,_cellSize,_check),
|
---|
| 295 | parent(_parent)
|
---|
| 296 | {
|
---|
| 297 | // About the j: I don't know why it was done this way, but it was used this way in Vector::AskPosition, so I reused it
|
---|
| 298 | int j = -1;
|
---|
| 299 | const char *coords[3] = {"x:","y:","z:"};
|
---|
| 300 | mainLayout= new QHBoxLayout();
|
---|
| 301 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 302 | mainLayout->addWidget(titleLabel);
|
---|
| 303 | subLayout = new QVBoxLayout();
|
---|
| 304 | mainLayout->addLayout(subLayout);
|
---|
| 305 | for(int i=0; i<3; i++) {
|
---|
| 306 | j+=i+1;
|
---|
| 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();
|
---|
| 312 | coordInput[i]->setRange(0,cellSize[j]);
|
---|
| 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 |
|
---|