Index: src/UIElements/Views/Qt4/QtWorldView.cpp
===================================================================
--- src/UIElements/Views/Qt4/QtWorldView.cpp	(revision 59a28ec90c4e8631aeaf66b49d200d2e6fc3e72e)
+++ src/UIElements/Views/Qt4/QtWorldView.cpp	(revision 79b59b34898604a6632f6ba8004edb82aa1e19ea)
@@ -36,19 +36,17 @@
 // these attributes are skiped so far
 const int QtWorldView::COLUMNCOUNT = COLUMNTYPES_MAX;
-const char *QtWorldView::COLUMNNAMES[QtWorldView::COLUMNCOUNT]={"Name","Atoms","Formula"/*,"Size"*/};
+const char *QtWorldView::COLUMNNAMES[QtWorldView::COLUMNCOUNT]={"Name","Atoms","Formula","Occurrence"/*,"Size"*/};
 
 QtWorldView::QtWorldView(QWidget * _parent) :
-  QTableWidget (_parent),
+  QTreeWidget (_parent),
   Observer("QtWorldView")
 {
-  setRowCount(0);
   setColumnCount(COLUMNCOUNT);
+  setSelectionMode(QAbstractItemView::MultiSelection);
 
-  for(int i=0; i<COLUMNCOUNT;++i) {
-    QTableWidgetItem *heading = new QTableWidgetItem();
-    std::cout << "Creating heading item " << heading << "." << std::endl;
-    heading->setText(QString(COLUMNNAMES[i]));
-    setHorizontalHeaderItem(i,heading);
-  }
+  QStringList header;
+  for(int i=0; i<COLUMNCOUNT;++i)
+    header << COLUMNNAMES[i];
+  setHeaderLabels(header);
 
   molecules = World::getInstance().getMolecules();
@@ -56,6 +54,6 @@
   update(molecules);
 
-  connect(this,SIGNAL(cellChanged(int,int)),this,SLOT(moleculeChanged(int,int)));
-  connect(this,SIGNAL(cellClicked(int,int)),this,SLOT(cellSelected(int,int)));
+  //connect(this,SIGNAL(cellChanged(int,int)),this,SLOT(moleculeChanged(int,int)));
+  connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(rowSelected()));
 
 }
@@ -68,6 +66,10 @@
 void QtWorldView::update(Observable *publisher) {
   int numMolecules = molecules->ListOfMolecules.size();
-  setRowCount(numMolecules);
+  clear();
   molSelection.resize(numMolecules);
+
+  // list of (unique) formulas in the world
+  std::vector<Formula> formula;
+
   int i;
   MoleculeList::iterator iter;
@@ -76,32 +78,36 @@
       ++i,++iter) {
 
+    // find group if already in list
+    QTreeWidgetItem *groupItem = NULL;
+    for (unsigned int j=0;j<formula.size();j++)
+      if ((*iter)->getFormula() == formula[j]){
+        groupItem = topLevelItem(j);
+        break;
+      }
+
+    // new molecule type -> create new group
+    if (!groupItem){
+      formula.push_back((*iter)->getFormula());
+      groupItem = new QTreeWidgetItem(this);
+      groupItem->setText(0, QString((*iter)->getName().c_str()));
+      groupItem->setText(1, QString::number((*iter)->getAtomCount()));
+      groupItem->setText(2, QString((*iter)->getFormula().toString().c_str()));
+      groupItem->setText(3, "0");
+    }
+
+    // add molecule
+    QTreeWidgetItem *molItem = new QTreeWidgetItem(groupItem);
+    molItem->setText(0, QString((*iter)->getName().c_str()));
+    molItem->setText(1, QString::number((*iter)->getAtomCount()));
+    molItem->setText(2, QString((*iter)->getFormula().toString().c_str()));
     const int index = (*iter)->IndexNr;
-    QTableWidgetItem *indexWidget = new QTableWidgetItem();
-    //std::cout << "Creating index item " << indexWidget << "." << std::endl;
-    indexWidget->setText(QString::number(index));
-    indexWidget->setData(Qt::UserRole,QVariant(index));
-    setVerticalHeaderItem(i,indexWidget);
+    molItem->setData(0, Qt::UserRole, QVariant(index));
 
-    const string name = (*iter)->getName();
-    QTableWidgetItem *nameWidget = new QTableWidgetItem();
-    //std::cout << "Creating name item " << nameWidget << " at " << i << "," << NAME << "." << std::endl;
-    nameWidget->setText(QString(name.c_str()));
-    setItem(i,NAME,nameWidget);
 
-    const int atomCount = (*iter)->getAtomCount();
-    QTableWidgetItem *countWidget= new QTableWidgetItem();
-    //std::cout << "Creating count item " << countWidget << " at " << i << "," << ATOMCOUNT << "." << std::endl;
-    countWidget->setText(QString::number(atomCount));
-    countWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-    setItem(i,ATOMCOUNT,countWidget);
+    // increase group occurrence
+    int count = groupItem->text(3).toInt() + 1;
+    groupItem->setText(3, QString::number(count));
 
-    const Formula formula = (*iter)->getFormula();
-    QTableWidgetItem *formulaWidget= new QTableWidgetItem();
-    //std::cout << "Creating formula item " << formulaWidget << " at " << i << "," << FORMULA << "." << std::endl;
-    formulaWidget->setText(QString(formula.toString().c_str()));
-    formulaWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-    setItem(i,FORMULA,formulaWidget);
-
-    molSelection[i]=nameWidget->isSelected();
+    //molSelection[i]=nameWidget->isSelected();
   }
 }
@@ -110,6 +116,6 @@
 }
 
-void QtWorldView::moleculeChanged(int row, int column) {
-  int idx = verticalHeaderItem(row)->data(Qt::UserRole).toInt();
+void QtWorldView::moleculeChanged() {
+  /*int idx = verticalHeaderItem(row)->data(Qt::UserRole).toInt();
   molecule *mol = molecules->ReturnIndex(idx);
   string cellValue = item(row,NAME)->text().toStdString();
@@ -119,11 +125,11 @@
   else if(cellValue==""){
     item(row,NAME)->setText(QString(mol->getName().c_str()));
-  }
+  }*/
 }
 
 
-void QtWorldView::cellSelected(int row, int column){
+void QtWorldView::rowSelected(){
   //std::cout << "Selection in (" << row << "," << column << "): " << item(row,column) << std::endl;
-  bool state = item(row,column)->isSelected();
+  /*bool state = item(row,column)->isSelected();
   for(int i = 0; i<COLUMNCOUNT; i++){
     //std::cout << "Setting " << i << "-th item " << item(row,i) << " in row " << row << " to state selected." << std::endl;
@@ -144,4 +150,4 @@
       molSelection[i]=state;
     }
-  }
+  }*/
 }
Index: src/UIElements/Views/Qt4/QtWorldView.hpp
===================================================================
--- src/UIElements/Views/Qt4/QtWorldView.hpp	(revision 59a28ec90c4e8631aeaf66b49d200d2e6fc3e72e)
+++ src/UIElements/Views/Qt4/QtWorldView.hpp	(revision 79b59b34898604a6632f6ba8004edb82aa1e19ea)
@@ -15,5 +15,5 @@
 
 
-#include <QtGui/QTableWidget>
+#include <QtGui/QTreeWidget>
 #include "CodePatterns/Observer/Observer.hpp"
 
@@ -21,5 +21,5 @@
 class MoleculeListClass;
 
-class QtWorldView : public QTableWidget, public Observer
+class QtWorldView : public QTreeWidget, public Observer
 {
   Q_OBJECT
@@ -34,11 +34,11 @@
 
   static const int COLUMNCOUNT;
-  enum {NAME,ATOMCOUNT,FORMULA,COLUMNTYPES_MAX} COLUMNTYPES;
+  enum {NAME,ATOMCOUNT,FORMULA,OCCURRENCE,COLUMNTYPES_MAX} COLUMNTYPES;
   static const char *COLUMNNAMES[];
 
 private slots:
-  void moleculeChanged(int row, int column);
+  void moleculeChanged();
 
-  void cellSelected(int row, int column);
+  void rowSelected();
 
 signals:
