1 | /*
|
---|
2 | * Project: MoleCuilder
|
---|
3 | * Description: creates and alters molecular systems
|
---|
4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
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 |
|
---|
20 | #include <Qt/qpushbutton.h>
|
---|
21 | #include <Qt/qboxlayout.h>
|
---|
22 | #include <Qt/qlistwidget.h>
|
---|
23 |
|
---|
24 | #include "CodePatterns/MemDebug.hpp"
|
---|
25 |
|
---|
26 | #include "UIElements/Qt4/Query/QtQuery.hpp"
|
---|
27 | #include "UIElements/Qt4/Query/QtQueryList.hpp"
|
---|
28 |
|
---|
29 |
|
---|
30 | QtDialog::MoleculesQtQuery::MoleculesQtQuery(Parameter<std::vector<const molecule *> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
|
---|
31 | Dialog::TQuery<std::vector<const molecule *> >(_param, _title),
|
---|
32 | QtQueryList<const molecule *>(_parent, _dialog, temp)
|
---|
33 | {
|
---|
34 | ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
|
---|
35 | subQuery = new MoleculeQtQuery(*subParam, _title, thisVLayout, subDialog);
|
---|
36 | subDialog->setSubQuery(subQuery);
|
---|
37 |
|
---|
38 | connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected()));
|
---|
39 | connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement()));
|
---|
40 | connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement()));
|
---|
41 | }
|
---|
42 |
|
---|
43 | QtDialog::MoleculesQtQuery::~MoleculesQtQuery()
|
---|
44 | {
|
---|
45 | delete(subQuery);
|
---|
46 | }
|
---|
47 |
|
---|
48 | void QtDialog::MoleculesQtQuery::onSubUpdate()
|
---|
49 | {
|
---|
50 | addButton->setEnabled(subParam->isSet());
|
---|
51 | }
|
---|
52 |
|
---|
53 | void QtDialog::MoleculesQtQuery::onElementSelected() {
|
---|
54 | elementSelected();
|
---|
55 | }
|
---|
56 |
|
---|
57 | void QtDialog::MoleculesQtQuery::onAddElement() {
|
---|
58 | addElement();
|
---|
59 | }
|
---|
60 |
|
---|
61 | void QtDialog::MoleculesQtQuery::onRemoveElement() {
|
---|
62 | removeElements();
|
---|
63 | }
|
---|
64 |
|
---|
65 | bool QtDialog::MoleculesQtQuery::handle()
|
---|
66 | {
|
---|
67 | if (param.isValid(temp)){
|
---|
68 | param.set(temp);
|
---|
69 | return true;
|
---|
70 | }
|
---|
71 | return false;
|
---|
72 | }
|
---|
73 |
|
---|
74 |
|
---|
75 |
|
---|