[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 | * IntsQtQuery.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 |
|
---|
[ad011c] | 26 | #include "CodePatterns/MemDebug.hpp"
|
---|
[8df74d] | 27 |
|
---|
[308aa4] | 28 | #include "UIElements/Qt4/Query/QtQuery.hpp"
|
---|
[8df74d] | 29 | #include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp"
|
---|
| 30 |
|
---|
| 31 |
|
---|
[f10b0c] | 32 | QtDialog::IntsQtQuery::IntsQtQuery(Parameter<std::vector<int> > ¶m, std::string _title,QBoxLayout *_parent,QtDialog *_dialog) :
|
---|
| 33 | Dialog::IntsQuery(param, _title),
|
---|
[8df74d] | 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 |
|
---|
[f10b0c] | 62 | pipe = new QtQueryListPipe<int>(tmp,_dialog,inputBox,inputList,AddButton,RemoveButton);
|
---|
[8df74d] | 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 |
|
---|
| 69 | QtDialog::IntsQtQuery::~IntsQtQuery()
|
---|
| 70 | {
|
---|
| 71 | delete pipe;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | bool QtDialog::IntsQtQuery::handle() {
|
---|
| 75 | return true;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 |
|
---|