[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 | * 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 |
|
---|
[572701] | 20 | #include <Qt/qpushbutton.h>
|
---|
[8df74d] | 21 | #include <Qt/qboxlayout.h>
|
---|
[572701] | 22 | #include <Qt/qlistwidget.h>
|
---|
[8df74d] | 23 |
|
---|
[ad011c] | 24 | #include "CodePatterns/MemDebug.hpp"
|
---|
[8df74d] | 25 |
|
---|
| 26 |
|
---|
[572701] | 27 | #include "UIElements/Qt4/Query/QtQuery.hpp"
|
---|
| 28 | #include "UIElements/Qt4/Query/QtQueryList.hpp"
|
---|
| 29 | #include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp"
|
---|
[8df74d] | 30 |
|
---|
| 31 |
|
---|
[572701] | 32 | QtDialog::ElementsQtQuery::ElementsQtQuery(Parameter<std::vector<const element *> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
|
---|
[b3a54d] | 33 | Dialog::ElementsQuery(_param, _title),
|
---|
[572701] | 34 | QtQueryList<const element *>(_parent, _dialog, temp)
|
---|
[8df74d] | 35 | {
|
---|
[572701] | 36 | ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
|
---|
| 37 | subQuery = new ElementQtQuery(*subParam, _title, thisVLayout, subDialog);
|
---|
| 38 | subDialog->setSubQuery(subQuery);
|
---|
[8df74d] | 39 |
|
---|
[572701] | 40 | connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected()));
|
---|
| 41 | connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement()));
|
---|
| 42 | connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement()));
|
---|
[8df74d] | 43 | }
|
---|
| 44 |
|
---|
| 45 | QtDialog::ElementsQtQuery::~ElementsQtQuery()
|
---|
| 46 | {
|
---|
[572701] | 47 | delete(subQuery);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | void QtDialog::ElementsQtQuery::onSubUpdate()
|
---|
| 51 | {
|
---|
| 52 | addButton->setEnabled(subParam->isSet());
|
---|
[8df74d] | 53 | }
|
---|
| 54 |
|
---|
[572701] | 55 | void QtDialog::ElementsQtQuery::onElementSelected() {
|
---|
| 56 | elementSelected();
|
---|
[7c9921] | 57 | }
|
---|
| 58 |
|
---|
[572701] | 59 | void QtDialog::ElementsQtQuery::onAddElement() {
|
---|
| 60 | addElement();
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | void QtDialog::ElementsQtQuery::onRemoveElement() {
|
---|
| 64 | removeElements();
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | bool QtDialog::ElementsQtQuery::handle()
|
---|
| 68 | {
|
---|
[9d5531] | 69 | if (param.isValid(temp)){
|
---|
| 70 | param.set(temp);
|
---|
| 71 | return true;
|
---|
| 72 | }
|
---|
| 73 | return false;
|
---|
[8df74d] | 74 | }
|
---|
| 75 |
|
---|
[572701] | 76 |
|
---|