/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010-2012 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * IntsQtQuery.cpp * * Created on: Oct 25, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "CodePatterns/MemDebug.hpp" #include "UIElements/Qt4/Query/QtQuery.hpp" #include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp" QtDialog::IntsQtQuery::IntsQtQuery(Parameter > ¶m, std::string _title,QBoxLayout *_parent,QtDialog *_dialog) : Dialog::IntsQuery(param, _title), parent(_parent) { QHBoxLayout * thisHLayout = new QHBoxLayout(); QVBoxLayout * thisV1Layout = new QVBoxLayout(); QVBoxLayout * thisV2Layout = new QVBoxLayout(); QLabel *titleLabel = new QLabel(QString(getTitle().c_str())); QLabel *inputLabel = new QLabel("Enter to add"); QListWidget* inputList = new QListWidget(); inputList->setSelectionMode(QAbstractItemView::ExtendedSelection); QLineEdit* inputBox = new QLineEdit(); inputLabel->setBuddy(inputBox); titleLabel->setBuddy(inputList); QPushButton* AddButton = new QPushButton("Add"); AddButton->setEnabled(false); QPushButton* RemoveButton = new QPushButton("Remove"); RemoveButton->setEnabled(false); thisV1Layout->addWidget(titleLabel); thisV1Layout->addWidget(inputList); thisV2Layout->addWidget(inputLabel); thisV2Layout->addWidget(inputBox); thisV2Layout->addWidget(AddButton); thisV2Layout->addWidget(RemoveButton); parent->addLayout(thisHLayout); thisHLayout->addLayout(thisV1Layout); thisHLayout->addLayout(thisV2Layout); pipe = new QtQueryListPipe(tmp,_dialog,inputBox,inputList,AddButton,RemoveButton); connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&))); connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected())); connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue())); connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow())); } QtDialog::IntsQtQuery::~IntsQtQuery() { delete pipe; } bool QtDialog::IntsQtQuery::handle() { return true; }