Index: src/UIElements/Dialog.cpp
===================================================================
--- src/UIElements/Dialog.cpp	(revision 5f5a7be8b7a95cd7fe35e9d728b89d6bc36b2f6a)
+++ src/UIElements/Dialog.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -36,4 +36,14 @@
 
 bool Dialog::display(){
+  if(checkAll()){
+    setAll();
+    return true;
+  }
+  else{
+    return false;
+  }
+}
+
+bool Dialog::checkAll(){
   list<Query*>::iterator iter;
   bool retval = true;
@@ -46,11 +56,12 @@
     }
   }
-  if (retval){
-    // if all queries succeeded we can set the targets to appropriate values
-    for(iter=queries.begin(); iter!=queries.end(); iter++) {
-      (*iter)->setResult();
-    }
-  }
   return retval;
+}
+
+void Dialog::setAll(){
+  list<Query*>::iterator iter;
+  for(iter=queries.begin(); iter!=queries.end(); iter++) {
+    (*iter)->setResult();
+  }
 }
 
Index: src/UIElements/Dialog.hpp
===================================================================
--- src/UIElements/Dialog.hpp	(revision 5f5a7be8b7a95cd7fe35e9d728b89d6bc36b2f6a)
+++ src/UIElements/Dialog.hpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -36,4 +36,7 @@
 
   virtual bool display();
+
+  virtual bool checkAll();
+  virtual void setAll();
 
 protected:
Index: src/UIElements/MainWindow.cpp
===================================================================
--- src/UIElements/MainWindow.cpp	(revision 5f5a7be8b7a95cd7fe35e9d728b89d6bc36b2f6a)
+++ src/UIElements/MainWindow.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -11,11 +11,6 @@
 
 MainWindow::MainWindow()
-{
-  // TODO Auto-generated constructor stub
-
-}
+{}
 
 MainWindow::~MainWindow()
-{
-  // TODO Auto-generated destructor stub
-}
+{}
Index: src/UIElements/QT4/QTDialog.cpp
===================================================================
--- src/UIElements/QT4/QTDialog.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
+++ src/UIElements/QT4/QTDialog.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -0,0 +1,396 @@
+/*
+ * QTDialog.cpp
+ *
+ *  Created on: Jan 18, 2010
+ *      Author: crueger
+ */
+
+#include "UIElements/QT4/QTDialog.hpp"
+
+#include <string>
+#include <sstream>
+#include <limits>
+
+#include <Qt/qboxlayout.h>
+#include <Qt/qlabel.h>
+#include <Qt/qspinbox.h>
+#include <QtGui/QDoubleSpinBox>
+#include <Qt/qlineedit.h>
+#include <Qt/qdialogbuttonbox.h>
+#include <Qt/qpushbutton.h>
+#include <Qt/qcombobox.h>
+
+#include "Helpers/MemDebug.hpp"
+
+#include "World.hpp"
+#include "periodentafel.hpp"
+#include "atom.hpp"
+#include "element.hpp"
+#include "molecule.hpp"
+#include "Descriptors/MoleculeIdDescriptor.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(char const*, string){
+  // TODO
+  ASSERT(false, "Not implemented yet");
+}
+
+void QTDialog::queryBoolean(char const*, bool*,string){
+  // TODO
+  ASSERT(false, "Not implemented yet");
+}
+
+void QTDialog::queryAtom(char const*, atom**, string){
+  // TODO
+  ASSERT(false, "Not implemented yet");
+}
+
+void QTDialog::queryBox(char const*, double**, string){
+  // TODO
+  ASSERT(false, "Not implemented yet");
+}
+
+
+void QTDialog::queryInt(const char *title, int *target,string)
+{
+  registerQuery(new IntQTQuery(title,target,inputLayout,this));
+}
+
+void QTDialog::queryDouble(const char* title, double* target,string){
+  registerQuery(new DoubleQTQuery(title,target,inputLayout,this));
+}
+
+void QTDialog::queryString(const char* title, std::string *target,string)
+{
+  registerQuery(new StringQTQuery(title,target,inputLayout,this));
+}
+
+void QTDialog::queryMolecule(const char *title,molecule **target,string)
+{
+  registerQuery(new MoleculeQTQuery(title,target,inputLayout,this));
+}
+
+void QTDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check,string) {
+  registerQuery(new VectorQTQuery(title,target,cellSize,check,inputLayout,this));
+}
+
+void QTDialog::queryElement(const char* title, std::vector<element *> *target,string){
+  registerQuery(new ElementQTQuery(title,target,inputLayout,this));
+}
+
+/************************** Query Objects *******************************/
+
+QTDialog::IntQTQuery::IntQTQuery(string _title,int *_target,QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::IntQuery(_title,_target),
+    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;
+}
+
+// Handling is easy since the GUI makes it impossible to enter invalid values
+bool QTDialog::IntQTQuery::handle()
+{
+  return true;
+}
+
+QTDialog::DoubleQTQuery::DoubleQTQuery(string title,double *_target,QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::DoubleQuery(title,_target),
+    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::StringQTQuery::StringQTQuery(string _title,string *_target,QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::StringQuery(_title,_target),
+    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 string are valid
+bool QTDialog::StringQTQuery::handle()
+{
+  return tmp!="";
+}
+
+QTDialog::MoleculeQTQuery::MoleculeQTQuery(string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::MoleculeQuery(_title,_target),
+    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) {
+    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::VectorQTQuery::VectorQTQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check,QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::VectorQuery(title,_target,_cellSize,_check),
+    parent(_parent)
+{
+  // About the j: I don't know why it was done this way, but it was used this way in Vector::AskPosition, so I reused it
+  int j = -1;
+  const char *coords[3] = {"x:","y:","z:"};
+  mainLayout= new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  mainLayout->addWidget(titleLabel);
+  subLayout = new QVBoxLayout();
+  mainLayout->addLayout(subLayout);
+  for(int i=0; i<3; i++) {
+    j+=i+1;
+    coordLayout[i] = new QHBoxLayout();
+    subLayout->addLayout(coordLayout[i]);
+    coordLabel[i] = new QLabel(QString(coords[i]));
+    coordLayout[i]->addWidget(coordLabel[i]);
+    coordInput[i] = new QDoubleSpinBox();
+    coordInput[i]->setRange(0,cellSize[j]);
+    coordInput[i]->setDecimals(3);
+    coordLayout[i]->addWidget(coordInput[i]);
+    pipe[i] = new DoubleQTQueryPipe(&((*tmp)[i]),_dialog);
+    pipe[i]->update(coordInput[i]->value());
+    connect(coordInput[i],SIGNAL(valueChanged(double)),pipe[i],SLOT(update(double)));
+
+  }
+  parent->addLayout(mainLayout);
+}
+
+QTDialog::VectorQTQuery::~VectorQTQuery()
+{}
+
+bool QTDialog::VectorQTQuery::handle() {
+  return true;
+}
+
+
+QTDialog::ElementQTQuery::ElementQTQuery(std::string _title, vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog) :
+    Dialog::ElementQuery(_title,_target),
+    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)
+  {
+    stringstream sstr;
+    sstr << (*iter).first << "\t" << (*iter).second->name;
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new ElementQTQueryPipe(&elements,_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;
+}
+
+/*************************** Plumbing *******************************/
+
+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();
+}
+
+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();
+}
+
+ElementQTQueryPipe::ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{
+  content->resize(1);
+}
+
+ElementQTQueryPipe::~ElementQTQueryPipe()
+{}
+
+void ElementQTQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  (*content)[0] = World::getInstance().getPeriode()->FindElement(idx);
+  dialog->update();
+}
+
Index: src/UIElements/QT4/QTDialog.hpp
===================================================================
--- src/UIElements/QT4/QTDialog.hpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
+++ src/UIElements/QT4/QTDialog.hpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -0,0 +1,226 @@
+/*
+ * QTDialog.hpp
+ *
+ *  Created on: Jan 18, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTDIALOG_HPP_
+#define QTDIALOG_HPP_
+
+#include "UIElements/Dialog.hpp"
+#include <QtGui/QDialog>
+
+class QBoxLayout;
+class QLabel;
+class QSpinBox;
+class QDoubleSpinBox;
+class QLineEdit;
+class QComboBox;
+class QDialogButtonBox;
+
+
+// Forward declarations for plumbing
+class StringQTQueryPipe;
+class IntQTQueryPipe;
+class DoubleQTQueryPipe;
+class MoleculeQTQueryPipe;
+class ElementQTQueryPipe;
+
+class QTDialog : public QDialog, public Dialog
+{
+  Q_OBJECT
+public:
+  QTDialog();
+  virtual ~QTDialog();
+
+  virtual void queryEmpty(const char*, std::string);
+  virtual void queryBoolean(const char *, bool *, std::string = "");
+  virtual void queryInt(const char *, int *,std::string = "");
+  virtual void queryDouble(const char*,double *,std::string = "");
+  virtual void queryString(const char*, std::string *,std::string = "");
+  virtual void queryAtom(const char*,atom**,std::string = "");
+  virtual void queryMolecule(const char*,molecule**,std::string = "");
+  virtual void queryVector(const char*,Vector *,const double *const,bool,std::string = "");
+  virtual void queryBox(const char*,double ** const, std::string = "");
+  virtual void queryElement(const char*,std::vector<element *> *_target,std::string = "");
+
+  virtual bool display();
+
+  virtual void update();
+
+protected:
+  class IntQTQuery : public Dialog::IntQuery {
+    public:
+      IntQTQuery(std::string _title, int *_target,QBoxLayout *_parent,QTDialog *_dialog);
+      virtual ~IntQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QSpinBox *inputBox;
+
+      IntQTQueryPipe *pipe;
+    };
+
+    class DoubleQTQuery : public Dialog::DoubleQuery {
+    public:
+      DoubleQTQuery(std::string title, double *_target,QBoxLayout *_parent,QTDialog *_dialog);
+      virtual ~DoubleQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QDoubleSpinBox *inputBox;
+
+      DoubleQTQueryPipe *pipe;
+    };
+
+    class StringQTQuery : public Dialog::StringQuery {
+    public:
+      StringQTQuery(std::string _title, std::string *_target, QBoxLayout *_parent,QTDialog *_dialog);
+      virtual ~StringQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QLineEdit *inputBox;
+
+      StringQTQueryPipe *pipe;
+    };
+
+    class MoleculeQTQuery : public Dialog::MoleculeQuery {
+    public:
+      MoleculeQTQuery(std::string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog);
+      virtual ~MoleculeQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      MoleculeQTQueryPipe *pipe;
+    };
+
+    class VectorQTQuery : public Dialog::VectorQuery {
+    public:
+      VectorQTQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check,QBoxLayout *,QTDialog *);
+      virtual ~VectorQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *mainLayout;
+      QLabel *titleLabel;
+      QBoxLayout *subLayout;
+      QBoxLayout *coordLayout[3];
+      QLabel *coordLabel[3];
+      QDoubleSpinBox *coordInput[3];
+
+      DoubleQTQueryPipe *pipe[3];
+    };
+
+    class ElementQTQuery : public Dialog::ElementQuery {
+    public:
+      ElementQTQuery(std::string _title, std::vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog);
+      virtual ~ElementQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      ElementQTQueryPipe *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
+
+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 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 ElementQTQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox);
+  virtual ~ElementQTQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  std::vector<element *> *content;
+  QTDialog *dialog;
+  QComboBox *theBox;
+};
+#endif /* QTDIALOG_HPP_ */
Index: src/UIElements/QT4/QTMainWindow.cpp
===================================================================
--- src/UIElements/QT4/QTMainWindow.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
+++ src/UIElements/QT4/QTMainWindow.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -0,0 +1,64 @@
+/*
+ * QTMainWindow.cpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#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<boost/bind.hpp>
+
+#include "atom.hpp"
+#include "molecule.hpp"
+#include "Menu/QT4/QTMenu.hpp"
+#include "Views/QT4/QTWorldView.hpp"
+#include "Views/QT4/GLMoleculeView.hpp"
+#include "Views/QT4/QTMoleculeView.hpp"
+#include "Views/QT4/QTStatusBar.hpp"
+#include "Helpers/MemDebug.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();
+
+  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();
+}
Index: src/UIElements/QT4/QTMainWindow.hpp
===================================================================
--- src/UIElements/QT4/QTMainWindow.hpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
+++ src/UIElements/QT4/QTMainWindow.hpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -0,0 +1,42 @@
+/*
+ * QTMainWindow.hpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTMAINWINDOW_HPP_
+#define QTMAINWINDOW_HPP_
+
+#include "UIElements/MainWindow.hpp"
+#include <QtGui/QMainWindow>
+
+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();
+
+private:
+  // All kinds of QTStuff used in this window
+  QApplication *theApp;
+  QTWorldView *worldDisplay;
+  QTMenu *editMoleculesMenu;
+  GLMoleculeView *molecule3dDisplay;
+  QTMoleculeView *moleculeDisplay;
+  QTStatusBar *statusBar;
+
+};
+
+#endif /* QTMAINWINDOW_HPP_ */
Index: src/UIElements/QT4/QTUIFactory.cpp
===================================================================
--- src/UIElements/QT4/QTUIFactory.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
+++ src/UIElements/QT4/QTUIFactory.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -0,0 +1,56 @@
+/*
+ * QTUIFactory.cpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#include <iostream>
+#include <cassert>
+
+using namespace std;
+
+#include <qapplication.h>
+
+#include "UIElements/QT4/QTUIFactory.hpp"
+#include "UIElements/QT4/QTMainWindow.hpp"
+#include "UIElements/QT4/QTDialog.hpp"
+#include "version.h"
+#include "defs.hpp"
+#include "Helpers/MemDebug.hpp"
+
+QTUIFactory::QTUIFactory()
+{
+  // For now we just fake the command line parameters to make QT happy
+  argc=1;
+  argv = new char*[1];
+  argv[0] = new char[256];
+  strcpy(argv[0],ESPACKVersion);
+  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 257c77c0c7706fd4745edd8fffdb365d94c06777)
+++ src/UIElements/QT4/QTUIFactory.hpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -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_ */
Index: src/UIElements/TextUI/TextUIFactory.cpp
===================================================================
--- src/UIElements/TextUI/TextUIFactory.cpp	(revision 5f5a7be8b7a95cd7fe35e9d728b89d6bc36b2f6a)
+++ src/UIElements/TextUI/TextUIFactory.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -9,5 +9,4 @@
 #include "UIElements/TextUI/TextWindow.hpp"
 #include "UIElements/TextUI/TextDialog.hpp"
-
 
 TextUIFactory::TextUIFactory()
Index: src/UIElements/TextUI/TextUIFactory.hpp
===================================================================
--- src/UIElements/TextUI/TextUIFactory.hpp	(revision 5f5a7be8b7a95cd7fe35e9d728b89d6bc36b2f6a)
+++ src/UIElements/TextUI/TextUIFactory.hpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -13,5 +13,5 @@
 class TextUIFactory : public UIFactory
 {
-friend class UIFactory;
+  friend class UIFactory;
 
 public:
Index: src/UIElements/TextUI/TextWindow.cpp
===================================================================
--- src/UIElements/TextUI/TextWindow.cpp	(revision 5f5a7be8b7a95cd7fe35e9d728b89d6bc36b2f6a)
+++ src/UIElements/TextUI/TextWindow.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -46,4 +46,5 @@
 #include "Views/StreamStringView.hpp"
 #include "Views/MethodStringView.hpp"
+#include "Helpers/MemDebug.hpp"
 
 #include <iostream>
Index: src/UIElements/UIFactory.cpp
===================================================================
--- src/UIElements/UIFactory.cpp	(revision 5f5a7be8b7a95cd7fe35e9d728b89d6bc36b2f6a)
+++ src/UIElements/UIFactory.cpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -12,4 +12,5 @@
 #include "UIElements/UIFactory.hpp"
 #include "Helpers/Assert.hpp"
+#include "Helpers/MemDebug.hpp"
 
 using namespace std;
Index: src/UIElements/UIFactory.hpp
===================================================================
--- src/UIElements/UIFactory.hpp	(revision 5f5a7be8b7a95cd7fe35e9d728b89d6bc36b2f6a)
+++ src/UIElements/UIFactory.hpp	(revision 257c77c0c7706fd4745edd8fffdb365d94c06777)
@@ -30,4 +30,5 @@
   friend class Singleton<UIFactory,false>;
 public:
+
   /**
    * Produce some kind of main window, of whichever type was chosen when the factory was created
