Index: src/UIElements/Qt4/IntQtQuery.ui
===================================================================
--- src/UIElements/Qt4/IntQtQuery.ui	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/IntQtQuery.ui	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>30</y>
+     <width>59</width>
+     <height>17</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>TextLabel</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit">
+   <property name="geometry">
+    <rect>
+     <x>100</x>
+     <y>20</y>
+     <width>113</width>
+     <height>27</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>70</y>
+     <width>92</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>OK</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_2">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>70</y>
+     <width>92</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Cancel</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: src/UIElements/Qt4/IntsQtQuery.ui
===================================================================
--- src/UIElements/Qt4/IntsQtQuery.ui	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/IntsQtQuery.ui	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>740</width>
+    <height>444</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QWidget" name="horizontalLayoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>240</y>
+     <width>421</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <spacer name="horizontalSpacer">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>40</width>
+        <height>20</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton">
+      <property name="text">
+       <string>OK</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_2">
+      <property name="text">
+       <string>Cancel</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QWidget" name="verticalLayoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>280</x>
+     <y>0</y>
+     <width>160</width>
+     <height>221</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QLabel" name="label">
+      <property name="text">
+       <string>Enter Integer:</string>
+      </property>
+      <property name="buddy">
+       <cstring>lineEdit</cstring>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLineEdit" name="lineEdit">
+      <property name="minimumSize">
+       <size>
+        <width>100</width>
+        <height>20</height>
+       </size>
+      </property>
+      <property name="toolTip">
+       <string>Enter an integer and press Add.</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_3">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="text">
+       <string>Add</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_4">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="text">
+       <string>Remove</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QWidget" name="verticalLayoutWidget_2">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>0</y>
+     <width>261</width>
+     <height>221</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout_2">
+    <item>
+     <widget class="QLabel" name="label_2">
+      <property name="text">
+       <string>Current List of Integers:</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QListWidget" name="listWidget"/>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <tabstops>
+  <tabstop>pushButton</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
Index: src/UIElements/Qt4/QtDialog.cpp
===================================================================
--- src/UIElements/Qt4/QtDialog.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtDialog.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,1188 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtDialog.cpp
+ *
+ *  Created on: Jan 18, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "UIElements/Qt4/QtDialog.hpp"
+
+#include <boost/lexical_cast.hpp>
+
+#include <string>
+#include <sstream>
+#include <limits>
+
+#include <QtGui/QDoubleSpinBox>
+#include <Qt/qboxlayout.h>
+#include <Qt/qcombobox.h>
+#include <Qt/qdialogbuttonbox.h>
+#include <Qt/qlabel.h>
+#include <Qt/qlineedit.h>
+#include <Qt/qlistwidget.h>
+#include <Qt/qpushbutton.h>
+#include <Qt/qspinbox.h>
+#include <Qt/qtablewidget.h>
+
+#include <boost/lexical_cast.hpp>
+
+#include "Helpers/MemDebug.hpp"
+
+#include "World.hpp"
+#include "periodentafel.hpp"
+#include "atom.hpp"
+#include "element.hpp"
+#include "molecule.hpp"
+#include "Descriptors/AtomIdDescriptor.hpp"
+#include "Descriptors/MoleculeIdDescriptor.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "Box.hpp"
+
+
+using namespace std;
+
+QtDialog::QtDialog() :
+    QDialog(0)
+{
+  // creating and filling of the Dialog window
+  mainLayout = new QVBoxLayout();
+  inputLayout = new QVBoxLayout();
+  buttonLayout = new QVBoxLayout();
+  setLayout(mainLayout);
+  mainLayout->addLayout(inputLayout);
+  mainLayout->addLayout(buttonLayout);
+  buttons = new QDialogButtonBox(QDialogButtonBox::Ok| QDialogButtonBox::Cancel);
+  buttonLayout->addWidget(buttons);
+
+  // Disable the ok button until something was entered
+  buttons->button(QDialogButtonBox::Ok)->setEnabled(false);
+
+  // connect the buttons to their appropriate slots
+  connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+  connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+QtDialog::~QtDialog()
+{
+}
+
+bool QtDialog::display(){
+  // Button state might have changed by some update that
+  // was done during query construction. To make sure
+  // the state is correct, we just call update one more time.
+  update();
+  if(exec()) {
+    setAll();
+    return true;
+  }
+  else {
+    return false;
+  }
+}
+
+void QtDialog::update(){
+  buttons->button(QDialogButtonBox::Ok)->setEnabled(checkAll());
+}
+
+/************************** Query Infrastructure ************************/
+
+void QtDialog::queryEmpty(const char* title, std::string)
+{
+  registerQuery(new EmptyQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryBoolean(const char* title,string)
+{
+  registerQuery(new BooleanQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryAtom(const char* title, std::string)
+{
+  registerQuery(new AtomQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryAtoms(const char* title, std::string)
+{
+  registerQuery(new AtomsQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryBox(const char* title, std::string)
+{
+  registerQuery(new BoxQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryInt(const char *title,string)
+{
+  registerQuery(new IntQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryInts(const char *title,string)
+{
+  registerQuery(new IntsQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryDouble(const char* title,string)
+{
+  registerQuery(new DoubleQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryDoubles(const char* title,string)
+{
+  registerQuery(new DoublesQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryString(const char* title,string)
+{
+  registerQuery(new StringQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryStrings(const char* title,string)
+{
+  registerQuery(new StringsQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryMolecule(const char *title,string)
+{
+  registerQuery(new MoleculeQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryMolecules(const char *title,string)
+{
+  registerQuery(new MoleculesQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryVector(const char* title, bool check,string)
+{
+  registerQuery(new VectorQtQuery(title,check,inputLayout,this));
+}
+
+void QtDialog::queryVectors(const char* title, bool check,string)
+{
+  registerQuery(new VectorsQtQuery(title,check,inputLayout,this));
+}
+
+void QtDialog::queryElement(const char* title, std::string)
+{
+  registerQuery(new ElementQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryElements(const char* title, std::string)
+{
+  registerQuery(new ElementsQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryFile(const char* title, std::string)
+{
+  registerQuery(new FileQtQuery(title,inputLayout,this));
+}
+
+/************************** Query Objects *******************************/
+
+QtDialog::BoxQtQuery::BoxQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::BoxQuery(_title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+
+  // init input table
+  inputTable = new QTableWidget(3,3, _dialog);
+  QStringList CoordinateList;
+  CoordinateList << "x" << "y" << "z";
+  inputTable->setHorizontalHeaderLabels(CoordinateList);
+  inputTable->setVerticalHeaderLabels(CoordinateList);
+
+  pipe = new BoxQtQueryPipe(tmp,_dialog, inputTable);
+
+  // fill the box with current matrix
+  const Matrix &domain = World::getInstance().getDomain().getM();
+  for (int i=0;i<3;i++)
+    for (int j=0;j<3;j++) {
+      QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(domain.at(i,j)));
+      inputTable->setItem(i,j,newItem);
+      pipe->update(i,j);
+    }
+
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputTable);
+
+  connect(inputTable,SIGNAL(cellChanged(int,int)),pipe,SLOT(update(int,int)));
+}
+
+QtDialog::BoxQtQuery::~BoxQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::BoxQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::AtomQtQuery::AtomQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::AtomQuery(_title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QComboBox();
+  inputBox->insertItem(-1, QString("no atom"));
+  std::vector<atom *> atoms = World::getInstance().getAllAtoms();
+  for (std::vector<atom *>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)
+    inputBox->insertItem((*iter)->getNr(),QString::fromStdString((*iter)->getName()));
+
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new AtomQtQueryPipe(&tmp,_dialog, inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::AtomQtQuery::~AtomQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::AtomQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::AtomsQtQuery::AtomsQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::AtomsQuery(_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);
+  std::vector<atom *> atoms = World::getInstance().getAllAtoms();
+  for (std::vector<atom *>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)
+    inputBox->insertItem((*iter)->getNr(),QString((*iter)->getNr()));
+
+  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 AtomsQtQueryPipe(&tmp,_dialog,inputList);
+  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
+  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(add()));
+  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(remove()));
+}
+
+QtDialog::AtomsQtQuery::~AtomsQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::AtomsQtQuery::handle() {
+  return true;
+}
+
+QtDialog::IntQtQuery::IntQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::IntQuery(_title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QSpinBox();
+  inputBox->setValue(0);
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new IntQtQueryPipe(&tmp,_dialog);
+  pipe->update(inputBox->value());
+  connect(inputBox,SIGNAL(valueChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::IntQtQuery::~IntQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::IntQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::IntsQtQuery::IntsQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::IntsQuery(_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<int>(&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;
+}
+
+
+QtDialog::DoubleQtQuery::DoubleQtQuery(string title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::DoubleQuery(title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QDoubleSpinBox();
+  inputBox->setValue(0);
+  inputBox->setRange(-numeric_limits<double>::max(),numeric_limits<double>::max());
+  inputBox->setDecimals(3);
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new DoubleQtQueryPipe(&tmp,_dialog);
+  pipe->update(inputBox->value());
+  connect(inputBox,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
+}
+
+QtDialog::DoubleQtQuery::~DoubleQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::DoubleQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::DoublesQtQuery::DoublesQtQuery(string title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::DoublesQuery(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<double>(&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::DoublesQtQuery::~DoublesQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::DoublesQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::StringQtQuery::StringQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::StringQuery(_title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QLineEdit();
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new StringQtQueryPipe(&tmp,_dialog);
+  pipe->update(inputBox->text());
+  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(update(const QString&)));
+}
+
+QtDialog::StringQtQuery::~StringQtQuery()
+{
+  delete pipe;
+}
+
+// All values besides the empty std::string are valid
+bool QtDialog::StringQtQuery::handle()
+{
+  return tmp!="";
+}
+
+QtDialog::StringsQtQuery::StringsQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::StringsQuery(_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<std::string>(&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::StringsQtQuery::~StringsQtQuery()
+{
+  delete pipe;
+}
+
+// All values besides the empty std::string are valid
+bool QtDialog::StringsQtQuery::handle()
+{
+  // dissect by ","
+  std::string::iterator olditer = temp.begin();
+  for(string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {
+    if (*iter == ' ') {
+      tmp.push_back(string(iter, olditer));
+      olditer = iter;
+    }
+  }
+  if (olditer != temp.begin())  // insert last part also
+    tmp.push_back(string(olditer, temp.end()));
+
+  return temp!="";
+}
+
+QtDialog::MoleculeQtQuery::MoleculeQtQuery(string _title, QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::MoleculeQuery(_title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QComboBox();
+  // add all molecules to the combo box
+  vector<molecule*> molecules = World::getInstance().getAllMolecules();
+  for(vector<molecule*>::iterator iter  = molecules.begin();
+      iter != molecules.end();
+      ++iter) {
+    std::stringstream sstr;
+    sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new MoleculeQtQueryPipe(&tmp,_dialog,inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::MoleculeQtQuery::~MoleculeQtQuery()
+{
+  delete pipe;
+}
+
+// Handling is easy, since the GUI makes it impossible to select invalid values
+bool QtDialog::MoleculeQtQuery::handle()
+{
+  return true;
+}
+
+QtDialog::MoleculesQtQuery::MoleculesQtQuery(string _title, QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::MoleculesQuery(_title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QComboBox();
+  // add all molecules to the combo box
+  vector<molecule*> molecules = World::getInstance().getAllMolecules();
+  for(vector<molecule*>::iterator iter  = molecules.begin();
+      iter != molecules.end();
+      ++iter) {
+    std::stringstream sstr;
+    sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new MoleculesQtQueryPipe(&tmp,_dialog,inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::MoleculesQtQuery::~MoleculesQtQuery()
+{
+  delete pipe;
+}
+
+// Handling is easy, since the GUI makes it impossible to select invalid values
+bool QtDialog::MoleculesQtQuery::handle()
+{
+  return true;
+}
+
+QtDialog::VectorQtQuery::VectorQtQuery(std::string title, bool _check,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::VectorQuery(title,_check),
+    parent(_parent)
+{
+  mainLayout= new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  mainLayout->addWidget(titleLabel);
+  subLayout = new QVBoxLayout();
+  mainLayout->addLayout(subLayout);
+  QComboBox* inputBox = new QComboBox();
+  coordLayout = new QHBoxLayout();
+  subLayout->addLayout(coordLayout);
+  coordLabel = new QLabel(QString("x,y,z"));
+  coordLayout->addWidget(coordLabel);
+  coordInput = new QDoubleSpinBox();
+//  coordInput->setRange(0,M.at(i,i));
+  coordInput->setDecimals(3);
+  coordLayout->addWidget(coordInput);
+  pipe = new VectorQtQueryPipe(&(tmp),_dialog,inputBox);
+  //pipe->update(coordInput->value());
+  connect(coordInput,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
+  parent->addLayout(mainLayout);
+}
+
+QtDialog::VectorQtQuery::~VectorQtQuery()
+{}
+
+bool QtDialog::VectorQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::VectorsQtQuery::VectorsQtQuery(std::string title, bool _check,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::VectorsQuery(title,_check),
+    parent(_parent)
+{
+  mainLayout= new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  mainLayout->addWidget(titleLabel);
+  subLayout = new QVBoxLayout();
+  mainLayout->addLayout(subLayout);
+  QComboBox* inputBox = new QComboBox();
+  coordLayout = new QHBoxLayout();
+  subLayout->addLayout(coordLayout);
+  coordLabel = new QLabel(QString("x,y,z"));
+  coordLayout->addWidget(coordLabel);
+  coordInput = new QDoubleSpinBox();
+//  coordInput->setRange(0,M.at(i,i));
+  coordInput->setDecimals(3);
+  coordLayout->addWidget(coordInput);
+  pipe = new VectorsQtQueryPipe(&(tmp),_dialog,inputBox);
+  //pipe->update(coordInput->value());
+  connect(coordInput,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
+  parent->addLayout(mainLayout);
+}
+
+QtDialog::VectorsQtQuery::~VectorsQtQuery()
+{}
+
+bool QtDialog::VectorsQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::ElementQtQuery::ElementQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::ElementQuery(_title),
+    parent(_parent)
+{
+  periodentafel *periode = World::getInstance().getPeriode();
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QComboBox();
+  for(periodentafel::const_iterator iter = periode->begin();
+      iter!=periode->end();
+      ++iter)
+  {
+    std::stringstream sstr;
+    sstr << (*iter).first << "\t" << (*iter).second->getName();
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new ElementQtQueryPipe(&tmp,_dialog,inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::ElementQtQuery::~ElementQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::ElementQtQuery::handle(){
+  return true;
+}
+
+
+QtDialog::ElementsQtQuery::ElementsQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::ElementsQuery(_title),
+    parent(_parent)
+{
+  periodentafel *periode = World::getInstance().getPeriode();
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QComboBox();
+  for(periodentafel::const_iterator iter = periode->begin();
+      iter!=periode->end();
+      ++iter)
+  {
+    std::stringstream sstr;
+    sstr << (*iter).first << "\t" << (*iter).second->getName();
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new ElementsQtQueryPipe(&tmp,_dialog,inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::ElementsQtQuery::~ElementsQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::ElementsQtQuery::handle(){
+  return true;
+}
+
+QtDialog::EmptyQtQuery::EmptyQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::EmptyQuery(_title),
+    parent(_parent)
+{
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+
+  pipe = new EmptyQtQueryPipe(_dialog,titleLabel);
+}
+
+QtDialog::EmptyQtQuery::~EmptyQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::EmptyQtQuery::handle(){
+  return true;
+}
+
+
+QtDialog::BooleanQtQuery::BooleanQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::BooleanQuery(_title),
+    parent(_parent)
+{
+  titleLabel = new QLabel(QString(getTitle().c_str()),_dialog);
+  booleanComboBox = new QComboBox(_dialog);
+  booleanComboBox->insertItem(1, QString("true"));
+  booleanComboBox->insertItem(0, QString("false"));
+
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(booleanComboBox);
+
+  pipe = new BooleanQtQueryPipe(&tmp,_dialog,booleanComboBox);
+  connect(booleanComboBox, SIGNAL(currentIndexChanged()), pipe, SLOT(update()));
+}
+
+QtDialog::BooleanQtQuery::~BooleanQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::BooleanQtQuery::handle(){
+  return true;
+}
+
+
+QtDialog::FileQtQuery::FileQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::FileQuery(_title),
+    parent(_parent)
+{
+
+  filenameLineEdit = new QLineEdit(_dialog);
+  filenameLineEdit->setText(QString());
+  filenameLineEdit->setReadOnly(true);
+
+  filenameLabel = new QLabel(QString("Input file:"));
+  filenameLabel->setBuddy(filenameLineEdit);
+
+  filedialogButton = new QPushButton("&Choose", _dialog);
+
+  pipe = new FileQtQueryPipe(&tmp,_dialog,filenameLineEdit,filedialogButton);
+
+  thisLayout = new QHBoxLayout();
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(filenameLabel);
+  thisLayout->addWidget(filenameLineEdit);
+  thisLayout->addWidget(filedialogButton);
+
+  QObject::connect(filedialogButton,SIGNAL(clicked()),pipe,SLOT(showFileDialog()));
+}
+
+QtDialog::FileQtQuery::~FileQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::FileQtQuery::handle(){
+  return true;
+}
+
+/*************************** Plumbing *******************************/
+
+
+template<typename T> QtQueryListPipe<T>::QtQueryListPipe(std::vector<T> *_content, QtDialog *_dialog, QLineEdit *_inputBox, QListWidget *_inputList, QPushButton *_AddButton, QPushButton *_RemoveButton) :
+  content(_content),
+  dialog(_dialog),
+  inputBox(_inputBox),
+  inputList(_inputList),
+  AddButton(_AddButton),
+  RemoveButton(_RemoveButton)
+{}
+
+template<typename T> QtQueryListPipe<T>::~QtQueryListPipe()
+{}
+
+template<typename T> void QtQueryListPipe<T>::IntegerEntered(const QString&)
+{
+  AddButton->setEnabled(true);
+}
+
+template<typename T> void QtQueryListPipe<T>::IntegerSelected()
+{
+  if (inputList->selectedItems().empty())
+    RemoveButton->setEnabled(false);
+  else
+    RemoveButton->setEnabled(true);
+}
+
+template<typename T> void QtQueryListPipe<T>::AddInteger() {
+  // type-check
+  std::string text = inputBox->text().toStdString();
+  int number = 0;
+  try {
+    number = boost::lexical_cast<int>(text);
+  } catch (boost::bad_lexical_cast&) {
+    return;
+  };
+  // add item to both
+  inputList->addItem(QString(number));
+  AddValue(number);
+}
+
+template<typename T> void QtQueryListPipe<T>::AddValue(T item) {
+  content->push_back(item);
+
+  dialog->update();
+}
+
+template<typename T> void QtQueryListPipe<T>::RemoveInteger() {
+  QList<QListWidgetItem *> items = inputList->selectedItems();
+  for (QList<QListWidgetItem *>::iterator iter = items.begin(); !items.empty(); iter = items.begin()) {
+    // obtain which position item has (by making it current item)
+    inputList->setCurrentItem(*iter);
+    // remove
+    QtQueryListPipe<T>::RemoteRow(inputList->currentRow()); // template parameters needs to be known, such that compiler knows which to call
+    inputList->removeItemWidget(*iter);
+  }
+}
+
+template<typename T> void QtQueryListPipe<T>::RemoveRow(int row) {
+  int counter = 0;
+  typename std::vector<T>::iterator iter = content->begin();
+  for (; iter != content->end(); ++iter)
+    if (counter++ == row)
+      break;
+  if (iter != content->end())
+      content->erase(iter);
+}
+
+
+StringQtQueryPipe::StringQtQueryPipe(string *_content, QtDialog *_dialog) :
+  content(_content),
+  dialog(_dialog)
+{}
+
+StringQtQueryPipe::~StringQtQueryPipe()
+{}
+
+void StringQtQueryPipe::update(const QString& newText) {
+  content->assign(newText.toStdString());
+  dialog->update();
+}
+
+IntQtQueryPipe::IntQtQueryPipe(int *_content, QtDialog *_dialog) :
+  content(_content),
+  dialog(_dialog)
+{}
+
+IntQtQueryPipe::~IntQtQueryPipe()
+{}
+
+void IntQtQueryPipe::update(int newInt) {
+  (*content) = newInt;
+  dialog->update();
+}
+
+DoubleQtQueryPipe::DoubleQtQueryPipe(double *_content, QtDialog *_dialog) :
+  content(_content),
+  dialog(_dialog)
+{}
+
+DoubleQtQueryPipe::~DoubleQtQueryPipe()
+{}
+
+void DoubleQtQueryPipe::update(double newDbl) {
+  (*content) = newDbl;
+  dialog->update();
+}
+
+VectorQtQueryPipe::VectorQtQueryPipe(Vector *_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+VectorQtQueryPipe::~VectorQtQueryPipe()
+{}
+
+void VectorQtQueryPipe::update() {
+  dialog->update();
+}
+
+VectorsQtQueryPipe::VectorsQtQueryPipe(std::vector<Vector> *_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+VectorsQtQueryPipe::~VectorsQtQueryPipe()
+{}
+
+void VectorsQtQueryPipe::update() {
+  dialog->update();
+}
+
+BoxQtQueryPipe::BoxQtQueryPipe(Box &_content, QtDialog *_dialog, QTableWidget *_inputTable) :
+  content(_content),
+  dialog(_dialog),
+  inputTable(_inputTable)
+{
+  tmpM = new Matrix();
+  tmpM->zero();
+}
+
+BoxQtQueryPipe::~BoxQtQueryPipe()
+{
+  delete tmpM;
+}
+
+void BoxQtQueryPipe::update(int row, int column)
+{
+  tmpM->at(row, column) = inputTable->item(row, column)->text().toDouble();
+  content.setM(*tmpM);
+  dialog->update();
+}
+
+
+AtomQtQueryPipe::AtomQtQueryPipe(atom **_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+AtomQtQueryPipe::~AtomQtQueryPipe()
+{}
+
+void AtomQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  (*content) = World::getInstance().getAtom(AtomById(idx));
+  dialog->update();
+}
+
+
+AtomsQtQueryPipe::AtomsQtQueryPipe(std::vector<atom *>*_content, QtDialog *_dialog, QListWidget *_theList) :
+  content(_content),
+  dialog(_dialog),
+  theList(_theList)
+{}
+
+AtomsQtQueryPipe::~AtomsQtQueryPipe()
+{}
+
+void AtomsQtQueryPipe::update() {
+  // clear target and put all atoms therein
+  (*content).clear();
+  for (std::set<atom *>::iterator iter = currentList.begin(); iter != currentList.end(); ++iter)
+    (*content).push_back(*iter);
+  dialog->update();
+}
+
+void AtomsQtQueryPipe::add() {
+  QList<QListWidgetItem *> items = theList->selectedItems();
+  for (QList<QListWidgetItem *>::iterator iter = items.begin();iter != items.end();++iter) {
+    const int index = (*iter)->text().toInt();
+    atom *Walker = World::getInstance().getAtom(AtomById(index));
+    if (Walker) {
+      (*content).push_back(Walker);
+      currentList.insert(Walker);
+      if (lookup.find(index) != lookup.end())
+        lookup.insert(pair<int, atom*>(index, Walker));
+    }
+  }
+  update();
+}
+
+void AtomsQtQueryPipe::remove() {
+  QList<QListWidgetItem *> items = theList->selectedItems();
+  for (QList<QListWidgetItem *>::iterator iter = items.begin();iter != items.end();++iter) {
+    const int index = (*iter)->text().toInt();
+    atom *Walker = World::getInstance().getAtom(AtomById(index));
+    if (Walker) {
+      currentList.erase(Walker);
+    }
+  }
+  update();
+}
+
+
+MoleculeQtQueryPipe::MoleculeQtQueryPipe(molecule **_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+MoleculeQtQueryPipe::~MoleculeQtQueryPipe()
+{}
+
+void MoleculeQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  (*content) = World::getInstance().getMolecule(MoleculeById(idx));
+  dialog->update();
+}
+
+
+MoleculesQtQueryPipe::MoleculesQtQueryPipe(std::vector<molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+MoleculesQtQueryPipe::~MoleculesQtQueryPipe()
+{}
+
+void MoleculesQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  molecule *mol = World::getInstance().getMolecule(MoleculeById(idx));
+  if (mol)
+    (*content).push_back(mol);
+  dialog->update();
+}
+
+ElementQtQueryPipe::ElementQtQueryPipe(const element **_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+ElementQtQueryPipe::~ElementQtQueryPipe()
+{}
+
+void ElementQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  *content = World::getInstance().getPeriode()->FindElement(idx);
+  dialog->update();
+}
+
+ElementsQtQueryPipe::ElementsQtQueryPipe(std::vector<const element *>*_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+ElementsQtQueryPipe::~ElementsQtQueryPipe()
+{}
+
+void ElementsQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  const element *elemental = World::getInstance().getPeriode()->FindElement(idx);
+  if(elemental)
+    (*content).push_back(elemental);
+  dialog->update();
+}
+
+EmptyQtQueryPipe::EmptyQtQueryPipe(QtDialog *_dialog, QLabel *_textLabel) :
+  dialog(_dialog),
+  textLabel(_textLabel)
+{}
+
+EmptyQtQueryPipe::~EmptyQtQueryPipe()
+{}
+
+void EmptyQtQueryPipe::update() {
+  dialog->update();
+}
+
+BooleanQtQueryPipe::BooleanQtQueryPipe(const bool *_content, QtDialog *_dialog, QComboBox *_booleanComboBox) :
+  content(_content),
+  dialog(_dialog),
+  booleanComboBox(_booleanComboBox)
+{}
+
+BooleanQtQueryPipe::~BooleanQtQueryPipe()
+{}
+
+void BooleanQtQueryPipe::update() {
+  dialog->update();
+}
+
+FileQtQueryPipe::FileQtQueryPipe(boost::filesystem::path *_content, QtDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton) :
+  content(_content),
+  dialog(_dialog),
+  filenameLineEdit(_filenameLineEdit),
+  filedialogButton(_filedialogButton)
+{
+  theFileDialog = NULL;
+}
+
+FileQtQueryPipe::~FileQtQueryPipe()
+{
+  if (theFileDialog != NULL)
+    delete theFileDialog;
+}
+
+void FileQtQueryPipe::update() {
+  QStringList ListOfFilenames = theFileDialog->selectedFiles();
+  std::cout << "Selected File is " << ListOfFilenames.at(0).toStdString() << std::endl;
+  (*content) = ListOfFilenames.at(0).toStdString();
+  filenameLineEdit->setText(QString::fromStdString((*content).string()));
+  dialog->update();
+}
+
+void FileQtQueryPipe::showFileDialog() {
+  filedialogButton->setFlat(true);
+  if (theFileDialog == NULL) {
+    theFileDialog = new QFileDialog(NULL, tr("Open input file"), QString(), tr("ParallelCarParrinello (*.conf);;MassivelyParallelQuantumChemistry (*.mpqc);;ParticleDataBase (*.pdb);;XYZ (*.xyz)"));
+    theFileDialog->setAcceptMode(QFileDialog::AcceptOpen);
+    theFileDialog->setFileMode(QFileDialog::ExistingFile);
+    theFileDialog->setViewMode(QFileDialog::List);
+  }
+  theFileDialog->exec();
+
+  update();
+  filedialogButton->setFlat(false);
+}
+
+
+
Index: src/UIElements/Qt4/QtDialog.hpp
===================================================================
--- src/UIElements/Qt4/QtDialog.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtDialog.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,619 @@
+/*
+ * QtDialog.hpp
+ *
+ *  Created on: Jan 18, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTDIALOG_HPP_
+#define QTDIALOG_HPP_
+
+#include "UIElements/Dialog.hpp"
+#include <QtGui/QDialog>
+#include <QtGui/QFileDialog>
+
+#include <boost/filesystem.hpp>
+
+#include <map>
+#include <set>
+#include <vector>
+
+class QBoxLayout;
+class QLabel;
+class QSpinBox;
+class QDoubleSpinBox;
+class QLineEdit;
+class QListWidget;
+class QTableWidget;
+class QComboBox;
+class QDialogButtonBox;
+
+class Matrix;
+
+// Forward declarations for plumbing
+template<typename T> class QtQueryListPipe;
+class BooleanQtQueryPipe;
+class BoxQtQueryPipe;
+class StringQtQueryPipe;
+class StringsQtQueryPipe;
+class IntQtQueryPipe;
+class DoubleQtQueryPipe;
+class DoublesQtQueryPipe;
+class AtomQtQueryPipe;
+class AtomsQtQueryPipe;
+class MoleculeQtQueryPipe;
+class MoleculesQtQueryPipe;
+class EmptyQtQueryPipe;
+class ElementQtQueryPipe;
+class ElementsQtQueryPipe;
+class VectorQtQueryPipe;
+class VectorsQtQueryPipe;
+class FileQtQueryPipe;
+
+class QtDialog : public QDialog, public Dialog
+{
+  Q_OBJECT
+public:
+  QtDialog();
+  virtual ~QtDialog();
+
+  virtual void queryEmpty(const char*, std::string);
+  virtual void queryBoolean(const char *, std::string = "");
+  virtual void queryInt(const char *,std::string = "");
+  virtual void queryInts(const char *,std::string = "");
+  virtual void queryDouble(const char*,std::string = "");
+  virtual void queryDoubles(const char*,std::string = "");
+  virtual void queryString(const char*,std::string = "");
+  virtual void queryStrings(const char*,std::string = "");
+  virtual void queryAtom(const char*,std::string = "");
+  virtual void queryAtoms(const char*,std::string = "");
+  virtual void queryMolecule(const char*,std::string = "");
+  virtual void queryMolecules(const char*,std::string = "");
+  virtual void queryVector(const char*,bool,std::string = "");
+  virtual void queryVectors(const char*,bool,std::string = "");
+  virtual void queryBox(const char*, std::string = "");
+  virtual void queryElement(const char*,std::string = "");
+  virtual void queryElements(const char*,std::string = "");
+  virtual void queryFile(const char*,std::string = "");
+
+  virtual bool display();
+
+  virtual void update();
+
+protected:
+  class IntQtQuery : public Dialog::IntQuery {
+    public:
+      IntQtQuery(std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~IntQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QSpinBox *inputBox;
+
+      IntQtQueryPipe *pipe;
+    };
+
+  class IntsQtQuery : public Dialog::IntsQuery {
+    public:
+      IntsQtQuery(std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~IntsQtQuery();
+      virtual bool handle();
+      void IntegerEntered(const QString&);
+      void IntegerSelected();
+      void AddInteger();
+      void RemoveInteger();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+
+      QtQueryListPipe<int> *pipe;
+    };
+
+    class DoubleQtQuery : public Dialog::DoubleQuery {
+    public:
+      DoubleQtQuery(std::string title,QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~DoubleQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QDoubleSpinBox *inputBox;
+
+      DoubleQtQueryPipe *pipe;
+    };
+
+    class DoublesQtQuery : public Dialog::DoublesQuery {
+    public:
+      DoublesQtQuery(std::string title,QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~DoublesQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QDoubleSpinBox *inputBox;
+
+      QtQueryListPipe<double> *pipe;
+    };
+
+    class StringQtQuery : public Dialog::StringQuery {
+    public:
+      StringQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~StringQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QLineEdit *inputBox;
+
+      StringQtQueryPipe *pipe;
+    };
+
+    class StringsQtQuery : public Dialog::StringsQuery {
+    public:
+      StringsQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~StringsQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QLineEdit *inputBox;
+
+      QtQueryListPipe<std::string> *pipe;
+    };
+
+    class BoxQtQuery : public Dialog::BoxQuery {
+    public:
+      BoxQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~BoxQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QTableWidget *inputTable;
+
+      BoxQtQueryPipe *pipe;
+    };
+
+    class AtomQtQuery : public Dialog::AtomQuery {
+    public:
+      AtomQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~AtomQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      AtomQtQueryPipe *pipe;
+    };
+
+    class AtomsQtQuery : public Dialog::AtomsQuery {
+    public:
+      AtomsQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~AtomsQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      AtomsQtQueryPipe *pipe;
+    };
+
+    class MoleculeQtQuery : public Dialog::MoleculeQuery {
+    public:
+      MoleculeQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~MoleculeQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      MoleculeQtQueryPipe *pipe;
+    };
+
+    class MoleculesQtQuery : public Dialog::MoleculesQuery {
+    public:
+      MoleculesQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~MoleculesQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      MoleculesQtQueryPipe *pipe;
+    };
+
+    class VectorQtQuery : public Dialog::VectorQuery {
+    public:
+      VectorQtQuery(std::string title,bool _check,QBoxLayout *,QtDialog *);
+      virtual ~VectorQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *mainLayout;
+      QLabel *titleLabel;
+      QBoxLayout *subLayout;
+      QBoxLayout *coordLayout;
+      QLabel *coordLabel;
+      QDoubleSpinBox *coordInput;
+
+      VectorQtQueryPipe *pipe;
+    };
+
+    class VectorsQtQuery : public Dialog::VectorsQuery {
+    public:
+      VectorsQtQuery(std::string title,bool _check,QBoxLayout *,QtDialog *);
+      virtual ~VectorsQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *mainLayout;
+      QLabel *titleLabel;
+      QBoxLayout *subLayout;
+      QBoxLayout *coordLayout;
+      QLabel *coordLabel;
+      QDoubleSpinBox *coordInput;
+
+      VectorsQtQueryPipe *pipe;
+    };
+
+    class EmptyQtQuery : public Dialog::EmptyQuery {
+    public:
+      EmptyQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~EmptyQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+
+      EmptyQtQueryPipe *pipe;
+    };
+
+    class BooleanQtQuery : public Dialog::BooleanQuery {
+    public:
+      BooleanQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~BooleanQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *booleanComboBox;
+
+      BooleanQtQueryPipe *pipe;
+    };
+
+    class ElementQtQuery : public Dialog::ElementQuery {
+    public:
+      ElementQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~ElementQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      ElementQtQueryPipe *pipe;
+    };
+
+    class ElementsQtQuery : public Dialog::ElementsQuery {
+    public:
+      ElementsQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~ElementsQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      ElementsQtQueryPipe *pipe;
+    };
+
+    class FileQtQuery : public Dialog::FileQuery {
+    public:
+      FileQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~FileQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *filenameLabel;
+      QLineEdit *filenameLineEdit;
+      QPushButton *filedialogButton;
+
+      FileQtQueryPipe *pipe;
+    };
+
+private:
+  QBoxLayout *mainLayout;
+  QBoxLayout *inputLayout;
+  QBoxLayout *buttonLayout;
+  QDialogButtonBox *buttons;
+};
+
+// All kinds of plumbing for Queries
+// Plumbing needs to be outside of the class where it is needed,
+// since MOC doesn't like nested classes
+
+
+template<typename T> class QtQueryListPipe : public QWidget {
+  public:
+    QtQueryListPipe(std::vector<T> *_content, QtDialog *_dialog, QLineEdit *_inputBox, QListWidget *_inputList, QPushButton *_AddButton, QPushButton *_RemoveButton);
+    virtual ~QtQueryListPipe();
+    void AddInteger();
+    void RemoveInteger();
+    void IntegerSelected();
+    void IntegerEntered(const QString&);
+
+  private:
+    void AddValue(T item);
+    void RemoveRow(int row);
+
+    std::vector<T> *content;
+    QtDialog *dialog;
+    QLineEdit *inputBox;
+    QListWidget *inputList;
+    QPushButton *AddButton;
+    QPushButton *RemoveButton;
+};
+
+
+class StringQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  StringQtQueryPipe(std::string *_content, QtDialog *_dialog);
+  virtual ~StringQtQueryPipe();
+
+public slots:
+  void update(const QString&);
+
+private:
+  std::string *content;
+  QtDialog *dialog;
+
+};
+
+class IntQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  IntQtQueryPipe(int *_content, QtDialog *_dialog);
+  virtual ~IntQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  int *content;
+  QtDialog *dialog;
+
+};
+
+
+class DoubleQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  DoubleQtQueryPipe(double *_content, QtDialog *_dialog);
+  virtual ~DoubleQtQueryPipe();
+
+public slots:
+  void update(double);
+
+private:
+  double *content;
+  QtDialog *dialog;
+
+};
+
+class BoxQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  BoxQtQueryPipe(Box &_content, QtDialog *_dialog, QTableWidget *_inputTable);
+  virtual ~BoxQtQueryPipe();
+
+public slots:
+  void update(int,int);
+
+private:
+  Box &content;
+  QtDialog *dialog;
+  QTableWidget *inputTable;
+
+  Matrix *tmpM;
+};
+
+
+class AtomQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  AtomQtQueryPipe(atom **_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~AtomQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  atom **content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+
+};
+
+
+class AtomsQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  AtomsQtQueryPipe(std::vector<atom *>*_content, QtDialog *_dialog, QListWidget *_theList);
+  virtual ~AtomsQtQueryPipe();
+
+public slots:
+  void update();
+  void add();
+  void remove();
+
+private:
+  std::vector<atom *>*content;
+  std::map<int, atom *> lookup;
+  std::set<atom *> currentList;
+  QtDialog *dialog;
+  QListWidget *theList;
+
+};
+
+class MoleculeQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  MoleculeQtQueryPipe(molecule **_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~MoleculeQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  molecule **content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+
+};
+
+class MoleculesQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  MoleculesQtQueryPipe(std::vector<molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~MoleculesQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  std::vector<molecule *>*content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+
+};
+
+class VectorQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  VectorQtQueryPipe(Vector *_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~VectorQtQueryPipe();
+
+public slots:
+  void update();
+
+private:
+  Vector *content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+};
+
+class VectorsQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  VectorsQtQueryPipe(std::vector<Vector>*_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~VectorsQtQueryPipe();
+
+public slots:
+  void update();
+
+private:
+  std::vector<Vector> *content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+};
+
+class EmptyQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  EmptyQtQueryPipe(QtDialog *_dialog, QLabel *_textLabel);
+  virtual ~EmptyQtQueryPipe();
+
+public slots:
+  void update();
+
+private:
+  QtDialog *dialog;
+  QLabel *textLabel;
+};
+
+class BooleanQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  BooleanQtQueryPipe(const bool *_content, QtDialog *_dialog, QComboBox *_booleanComboBox);
+  virtual ~BooleanQtQueryPipe();
+
+public slots:
+  void update();
+
+private:
+  const bool *content;
+  QtDialog *dialog;
+  QComboBox *booleanComboBox;
+};
+
+class ElementQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  ElementQtQueryPipe(const element **_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~ElementQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  const element **content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+};
+
+class ElementsQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  ElementsQtQueryPipe(std::vector<const element *>*_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~ElementsQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  std::vector<const element *>*content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+};
+
+class FileQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  FileQtQueryPipe(boost::filesystem::path *_content, QtDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton);
+  virtual ~FileQtQueryPipe();
+
+public slots:
+  void update();
+  void showFileDialog();
+
+private:
+  boost::filesystem::path *content;
+  QtDialog *dialog;
+  QLineEdit *filenameLineEdit;
+  QPushButton *filedialogButton;
+  QFileDialog *theFileDialog;
+};
+
+#endif /* QTDIALOG_HPP_ */
Index: src/UIElements/Qt4/QtMainWindow.cpp
===================================================================
--- src/UIElements/Qt4/QtMainWindow.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtMainWindow.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,133 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtMainWindow.cpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "QtMainWindow.hpp"
+
+#include<Qt/qapplication.h>
+#include<Qt/qlabel.h>
+#include<Qt/qstring.h>
+#include<Qt/qmenubar.h>
+#include<Qt/qsplitter.h>
+
+#include<iostream>
+#include<map>
+
+#include<boost/bind.hpp>
+
+#include "Helpers/MemDebug.hpp"
+
+#include "atom.hpp"
+#include "molecule.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Actions/Action.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Actions/MapOfActions.hpp"
+#include "Menu/Menu.hpp"
+#include "Menu/Qt4/QtMenu.hpp"
+#include "Menu/ActionMenuItem.hpp"
+#include "Views/Qt4/QtWorldView.hpp"
+#include "Views/Qt4/GLMoleculeView.hpp"
+#include "Views/Qt4/QtMoleculeView.hpp"
+#include "Views/Qt4/QtStatusBar.hpp"
+
+using namespace std;
+
+QtMainWindow::QtMainWindow(QApplication *_theApp) :
+    theApp(_theApp)
+{
+  QSplitter *splitter1 = new QSplitter (Qt::Horizontal, this );
+  QSplitter *splitter2 = new QSplitter (Qt::Vertical, splitter1 );
+
+  worldDisplay = new QtWorldView(splitter2);
+
+  moleculeDisplay = new QtMoleculeView();
+  molecule3dDisplay = new GLMoleculeView();
+
+  MenuBar = menuBar();
+
+  std::map <std::string, QtMenu *> NametoTextMenuMap;
+  // go through all menus and create them
+  QtMenu *Menu = NULL;
+  for(std::map<std::string, std::pair<std::string,std::string> >::iterator iter = MapOfActions::getInstance().MenuDescription.begin(); iter != MapOfActions::getInstance().MenuDescription.end(); ++iter) {
+    cout << "Creating menu " << iter->first << endl;
+    Menu = new QtMenu(iter->first.c_str());
+    MenuBar->addMenu(Menu);
+    NametoTextMenuMap.insert( pair <std::string, QtMenu *> (iter->first, Menu) );
+    //new SubMenuItem(getSuitableShortForm(iter->first),iter->second.first,main_menu,Menu);
+  }
+
+  // populate all actions
+  MapOfActions::getInstance().populateActions();
+
+  // go through all actions and add them to its menu
+  for (std::map <std::string, QtMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner) {
+    cout << "Creating Action " << MenuRunner->first << " in menu " << MenuRunner->second << endl;
+    populateMenu(MenuRunner->second, MenuRunner->first);
+  }
+
+  setCentralWidget(splitter1);
+  splitter1->addWidget(splitter2);
+  splitter1->addWidget(moleculeDisplay);
+  splitter2->addWidget(molecule3dDisplay);
+  splitter2->addWidget(worldDisplay);
+
+  statusBar = new QtStatusBar(this);
+  setStatusBar(statusBar);
+
+  connect(worldDisplay,SIGNAL(moleculeSelected(molecule*)),moleculeDisplay,SLOT(moleculeSelected(molecule*)));
+  connect(worldDisplay,SIGNAL(moleculeUnSelected(molecule*)),moleculeDisplay,SLOT(moleculeUnSelected(molecule*)));
+}
+
+QtMainWindow::~QtMainWindow()
+{
+  menuBar()->clear();
+  delete editMoleculesMenu;
+}
+
+void QtMainWindow::display() {
+  this->show();
+  theApp->exec();
+}
+
+char QtMainWindow::getSuitableShortForm(set <char> &ShortcutList, const std::string name) const
+{
+  for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
+    if (ShortcutList.find(*CharRunner) == ShortcutList.end())
+      return *CharRunner;
+  }
+  DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for TextWindow::getSuitableShortForm()." << endl);
+  return ((char)(ShortcutList.size() % 10) + '0');
+}
+
+void QtMainWindow::populateMenu(QtMenu* Menu, const  std::string &MenuName)
+{
+  Action *ActionItem = NULL;
+  set <char> ShortcutList;
+  // through all actions for this menu
+  std::pair < std::multimap <std::string, std::string>::iterator, std::multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);
+  for (std::multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {
+    cout << " Adding " << MenuRunner->second << " to submenu " << MenuName << endl;
+    ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);
+    new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);
+  }
+  // finally add default quit item
+  //Action *returnFromAction = new TextMenu::LeaveAction(Menu);
+  //MenuItem *returnFromItem = new ActionMenuItem('q',"return to Main menu",Menu,returnFromAction);
+  //Menu->addDefault(returnFromItem);
+}
Index: src/UIElements/Qt4/QtMainWindow.hpp
===================================================================
--- src/UIElements/Qt4/QtMainWindow.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtMainWindow.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,48 @@
+/*
+ * QtMainWindow.hpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTMAINWINDOW_HPP_
+#define QTMAINWINDOW_HPP_
+
+#include "UIElements/MainWindow.hpp"
+#include <QtGui/QMainWindow>
+
+#include <set>
+
+class QtWorldView;
+class StringView;
+class QtMenu;
+class GLMoleculeView;
+class QtMoleculeView;
+class QtStatusBar;
+
+class QtMainWindow : public QMainWindow, public MainWindow
+{
+  Q_OBJECT
+
+public:
+  QtMainWindow(QApplication *_theApp);
+  virtual ~QtMainWindow();
+
+  virtual void display();
+
+  char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const;
+  void populateMenu(QtMenu* Menu, const  std::string &MenuName);
+
+private:
+  // All kinds of QTStuff used in this window
+  QApplication *theApp;
+  QtWorldView *worldDisplay;
+  QtMenu *editMoleculesMenu;
+  GLMoleculeView *molecule3dDisplay;
+  QtMoleculeView *moleculeDisplay;
+  QtStatusBar *statusBar;
+  QMenuBar *MenuBar;
+
+};
+
+#endif /* QTMAINWINDOW_HPP_ */
Index: src/UIElements/Qt4/QtUIFactory.cpp
===================================================================
--- src/UIElements/Qt4/QtUIFactory.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtUIFactory.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,71 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtUIFactory.cpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <cassert>
+
+#include <qapplication.h>
+
+
+#include "UIElements/Qt4/QtUIFactory.hpp"
+#include "UIElements/Qt4/QtMainWindow.hpp"
+#include "UIElements/Qt4/QtDialog.hpp"
+
+#include "Helpers/MemDebug.hpp"
+
+#include "version.h"
+#include "defs.hpp"
+
+using namespace std;
+
+QtUIFactory::QtUIFactory() :
+  argc(1)
+{
+  // For now we just fake the command line parameters to make QT happy
+  argv = new char*[1];
+  argv[0] = new char[256];
+  strcpy(argv[0],MOLECUILDERVERSION);
+  app = new QApplication(argc,argv);
+}
+
+QtUIFactory::~QtUIFactory()
+{
+  delete app;
+  delete [] argv[0];
+  delete [] argv;
+}
+
+Dialog* QtUIFactory::makeDialog() {
+  return new QtDialog();
+}
+
+MainWindow* QtUIFactory::makeMainWindow() {
+  return new QtMainWindow(app);
+}
+
+QtUIFactory::description::description() :
+    UIFactory::factoryDescription("Qt4")
+{}
+
+QtUIFactory::description::~description()
+{}
+
+UIFactory* QtUIFactory::description::makeFactory(){
+  return new QtUIFactory();
+}
Index: src/UIElements/Qt4/QtUIFactory.hpp
===================================================================
--- src/UIElements/Qt4/QtUIFactory.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtUIFactory.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,42 @@
+/*
+ * QtUIFactory.hpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTUIFACTORY_HPP_
+#define QTUIFACTORY_HPP_
+
+#include "UIElements/UIFactory.hpp"
+
+class QApplication;
+
+class QtUIFactory : public UIFactory
+{
+  friend class UIFactory;
+
+public:
+  virtual ~QtUIFactory();
+
+  virtual Dialog* makeDialog();
+  virtual MainWindow* makeMainWindow();
+
+  struct description : public UIFactory::factoryDescription {
+    description();
+    virtual ~description();
+
+    virtual UIFactory* makeFactory();
+  };
+
+protected:
+  QtUIFactory();
+
+private:
+  // faked command line arguments
+  int argc;
+  char **argv;
+  QApplication *app;
+};
+
+#endif /* QTUIFACTORY_HPP_ */
