| [8df74d] | 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 | * DoublesQtQuery.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/qlabel.h> | 
|---|
|  | 22 | #include <Qt/qlineedit.h> | 
|---|
|  | 23 | #include <Qt/qlistwidget.h> | 
|---|
|  | 24 | #include <Qt/qpushbutton.h> | 
|---|
|  | 25 |  | 
|---|
|  | 26 | #include "Helpers/MemDebug.hpp" | 
|---|
|  | 27 |  | 
|---|
| [308aa4] | 28 | #include "UIElements/Qt4/Query/QtQuery.hpp" | 
|---|
| [8df74d] | 29 | #include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp" | 
|---|
|  | 30 |  | 
|---|
|  | 31 |  | 
|---|
|  | 32 | QtDialog::DoublesQtQuery::DoublesQtQuery(string title,QBoxLayout *_parent,QtDialog *_dialog) : | 
|---|
|  | 33 | Dialog::DoublesQuery(title), | 
|---|
|  | 34 | parent(_parent) | 
|---|
|  | 35 | { | 
|---|
|  | 36 | QHBoxLayout * thisHLayout = new QHBoxLayout(); | 
|---|
|  | 37 | QVBoxLayout * thisV1Layout = new QVBoxLayout(); | 
|---|
|  | 38 | QVBoxLayout * thisV2Layout = new QVBoxLayout(); | 
|---|
|  | 39 |  | 
|---|
|  | 40 | QLabel *titleLabel = new QLabel(QString(getTitle().c_str())); | 
|---|
|  | 41 | QLabel *inputLabel = new QLabel("Enter to add"); | 
|---|
|  | 42 | QListWidget* inputList = new QListWidget(); | 
|---|
|  | 43 | inputList->setSelectionMode(QAbstractItemView::ExtendedSelection); | 
|---|
|  | 44 | QLineEdit* inputBox = new QLineEdit(); | 
|---|
|  | 45 | inputLabel->setBuddy(inputBox); | 
|---|
|  | 46 | titleLabel->setBuddy(inputList); | 
|---|
|  | 47 | QPushButton* AddButton = new QPushButton("Add"); | 
|---|
|  | 48 | AddButton->setEnabled(false); | 
|---|
|  | 49 | QPushButton* RemoveButton = new QPushButton("Remove"); | 
|---|
|  | 50 | RemoveButton->setEnabled(false); | 
|---|
|  | 51 |  | 
|---|
|  | 52 | thisV1Layout->addWidget(titleLabel); | 
|---|
|  | 53 | thisV1Layout->addWidget(inputList); | 
|---|
|  | 54 | thisV2Layout->addWidget(inputLabel); | 
|---|
|  | 55 | thisV2Layout->addWidget(inputBox); | 
|---|
|  | 56 | thisV2Layout->addWidget(AddButton); | 
|---|
|  | 57 | thisV2Layout->addWidget(RemoveButton); | 
|---|
|  | 58 | parent->addLayout(thisHLayout); | 
|---|
|  | 59 | thisHLayout->addLayout(thisV1Layout); | 
|---|
|  | 60 | thisHLayout->addLayout(thisV2Layout); | 
|---|
|  | 61 |  | 
|---|
|  | 62 | pipe = new QtQueryListPipe<double>(&tmp,_dialog,inputBox,inputList,AddButton,RemoveButton); | 
|---|
|  | 63 | connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&))); | 
|---|
|  | 64 | connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected())); | 
|---|
|  | 65 | connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue())); | 
|---|
|  | 66 | connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow()));} | 
|---|
|  | 67 |  | 
|---|
|  | 68 | QtDialog::DoublesQtQuery::~DoublesQtQuery() | 
|---|
|  | 69 | { | 
|---|
|  | 70 | delete pipe; | 
|---|
|  | 71 | } | 
|---|
|  | 72 |  | 
|---|
|  | 73 | bool QtDialog::DoublesQtQuery::handle() { | 
|---|
|  | 74 | return true; | 
|---|
|  | 75 | } | 
|---|
|  | 76 |  | 
|---|
|  | 77 |  | 
|---|