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