| [8df74d] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
| [0aa122] | 4 |  * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
 | 
|---|
| [8df74d] | 5 |  * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | /*
 | 
|---|
 | 9 |  * ElementQtQuery.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 | 
 | 
|---|
| [ad011c] | 24 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
| [8df74d] | 25 | 
 | 
|---|
| [308aa4] | 26 | #include "UIElements/Qt4/Query/QtQuery.hpp"
 | 
|---|
| [a5ddf0] | 27 | #include "UIElements/Qt4/Pipe/ElementQtQueryPipe.hpp"
 | 
|---|
| [8df74d] | 28 | 
 | 
|---|
| [3bdb6d] | 29 | #include "Element/element.hpp"
 | 
|---|
 | 30 | #include "Element/periodentafel.hpp"
 | 
|---|
| [8df74d] | 31 | #include "World.hpp"
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | QtDialog::ElementQtQuery::ElementQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
 | 
|---|
 | 34 |     Dialog::ElementQuery(_title),
 | 
|---|
 | 35 |     parent(_parent)
 | 
|---|
 | 36 | {
 | 
|---|
 | 37 |   periodentafel *periode = World::getInstance().getPeriode();
 | 
|---|
 | 38 |   thisLayout = new QHBoxLayout();
 | 
|---|
 | 39 |   titleLabel = new QLabel(QString(getTitle().c_str()));
 | 
|---|
 | 40 |   inputBox = new QComboBox();
 | 
|---|
 | 41 |   for(periodentafel::const_iterator iter = periode->begin();
 | 
|---|
 | 42 |       iter!=periode->end();
 | 
|---|
 | 43 |       ++iter)
 | 
|---|
 | 44 |   {
 | 
|---|
 | 45 |     std::stringstream sstr;
 | 
|---|
 | 46 |     sstr << (*iter).first << "\t" << (*iter).second->getName();
 | 
|---|
 | 47 |     inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
 | 
|---|
 | 48 |   }
 | 
|---|
 | 49 |   parent->addLayout(thisLayout);
 | 
|---|
 | 50 |   thisLayout->addWidget(titleLabel);
 | 
|---|
 | 51 |   thisLayout->addWidget(inputBox);
 | 
|---|
 | 52 | 
 | 
|---|
 | 53 |   pipe = new ElementQtQueryPipe(&tmp,_dialog,inputBox);
 | 
|---|
 | 54 |   pipe->update(inputBox->currentIndex());
 | 
|---|
 | 55 |   connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
 | 
|---|
 | 56 | }
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 | QtDialog::ElementQtQuery::~ElementQtQuery()
 | 
|---|
 | 59 | {
 | 
|---|
 | 60 |   delete pipe;
 | 
|---|
 | 61 | }
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 | bool QtDialog::ElementQtQuery::handle(){
 | 
|---|
 | 64 |   return true;
 | 
|---|
 | 65 | }
 | 
|---|
 | 66 | 
 | 
|---|
 | 67 | 
 | 
|---|