| 1 | /* | 
|---|
| 2 | * Project: MoleCuilder | 
|---|
| 3 | * Description: creates and alters molecular systems | 
|---|
| 4 | * Copyright (C)  2010 University of Bonn. All rights reserved. | 
|---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | /* | 
|---|
| 9 | * ElementsQtQuery.cpp | 
|---|
| 10 | * | 
|---|
| 11 | *  Created on: Oct 25, 2010 | 
|---|
| 12 | *      Author: heber | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | // include config.h | 
|---|
| 16 | #ifdef HAVE_CONFIG_H | 
|---|
| 17 | #include <config.h> | 
|---|
| 18 | #endif | 
|---|
| 19 |  | 
|---|
| 20 | #include <Qt/qboxlayout.h> | 
|---|
| 21 | #include <Qt/qcombobox.h> | 
|---|
| 22 | #include <Qt/qlabel.h> | 
|---|
| 23 |  | 
|---|
| 24 | #include "Helpers/MemDebug.hpp" | 
|---|
| 25 |  | 
|---|
| 26 | #include "UIElements/Qt4/Query/QtQuery.hpp" | 
|---|
| 27 | #include "UIElements/Qt4/Pipe/ElementsQtQueryPipe.hpp" | 
|---|
| 28 |  | 
|---|
| 29 | #include "element.hpp" | 
|---|
| 30 | #include "periodentafel.hpp" | 
|---|
| 31 | #include "World.hpp" | 
|---|
| 32 |  | 
|---|
| 33 |  | 
|---|
| 34 | QtDialog::ElementsQtQuery::ElementsQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) : | 
|---|
| 35 | Dialog::ElementsQuery(_title), | 
|---|
| 36 | parent(_parent) | 
|---|
| 37 | { | 
|---|
| 38 | periodentafel *periode = World::getInstance().getPeriode(); | 
|---|
| 39 | thisLayout = new QHBoxLayout(); | 
|---|
| 40 | titleLabel = new QLabel(QString(getTitle().c_str())); | 
|---|
| 41 | inputBox = new QComboBox(); | 
|---|
| 42 | for(periodentafel::const_iterator iter = periode->begin(); | 
|---|
| 43 | iter!=periode->end(); | 
|---|
| 44 | ++iter) | 
|---|
| 45 | { | 
|---|
| 46 | std::stringstream sstr; | 
|---|
| 47 | sstr << (*iter).first << "\t" << (*iter).second->getName(); | 
|---|
| 48 | inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first)); | 
|---|
| 49 | } | 
|---|
| 50 | parent->addLayout(thisLayout); | 
|---|
| 51 | thisLayout->addWidget(titleLabel); | 
|---|
| 52 | thisLayout->addWidget(inputBox); | 
|---|
| 53 |  | 
|---|
| 54 | pipe = new ElementsQtQueryPipe(&tmp,_dialog,inputBox); | 
|---|
| 55 | pipe->update(inputBox->currentIndex()); | 
|---|
| 56 | connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int))); | 
|---|
| 57 | } | 
|---|
| 58 |  | 
|---|
| 59 | QtDialog::ElementsQtQuery::~ElementsQtQuery() | 
|---|
| 60 | { | 
|---|
| 61 | delete pipe; | 
|---|
| 62 | } | 
|---|
| 63 |  | 
|---|
| 64 | bool QtDialog::ElementsQtQuery::handle(){ | 
|---|
| 65 | return true; | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|