I am pretty new with Qt, and I am sure for an experienced programmer this problem is more than ridiculous. But I am eager to learn it. Hence, I am most interested to understand why my code is not working.
Thanks to everybody, who brings me into the right direction to solve my problem!

Okay, here is my problem:
In an QApplication I have QTabWidget (NOT QTableWidget!) as a central Widget.
The QTabWidget has three tabs.
The content for each Tab should come from a "selfmade" class derived from QWidget.

For the first tab "ra", it work as desired. But now I am stuck with the second tab "rf". This second tab should show a QTableView. I have marked the relevant parts in the code below with "//PROBLEM".

mainwindow.cpp
Qt Code:
  1. #include <QtGui/QMainWindow>
  2. #include <QAction>
  3. #include <QMenuBar>
  4. #include "mainwindow.h"
  5. #include "Reiseangaben/reiseangaben.h"
  6. #include "Reiseabfolge/reiseabfolge.h"
  7. #include "Reisespesen/reisespesen.h"
  8.  
  9. MainWindow::MainWindow() {
  10.  
  11. setWindowTitle(tr("Alexander's Reisekostenabrechner"));
  12. resize(400, 200);
  13. createActions();
  14. createMenus();
  15.  
  16. widget_TabCentral = new QTabWidget(this);
  17. setCentralWidget(widget_TabCentral);
  18.  
  19. widget_TabCentral->setObjectName(QString::fromUtf8("widget_TabCentral"));
  20.  
  21. Reiseangaben *ra = new(Reiseangaben); // WORKS WELL
  22. widget_TabCentral->addTab(ra, "Allgemeine Reiseangaben");
  23.  
  24. Reiseabfolge *rf = new(Reiseabfolge); // PROBLEM
  25. widget_TabCentral->addTab(rf, "Reiseabfolge / Tagespauschale");
  26.  
  27. Reisespesen *sp = new(Reisespesen);
  28. widget_TabCentral->addTab(sp, "Spesen");
  29. }
To copy to clipboard, switch view to plain text mode 


To keep it simple for the beginning, I decide just to display in the second (Problem-)Tab rf a QTableView with content about the current directory (QDirModel). I have putted the QTableView into a QGridLayout. I am not sure if this is necessary. I did this to make sure my QTableView is within a widget, since addTab requires a widget as an argument.

reiseabfolge.cpp
Qt Code:
  1. #include <QtGui>
  2. #include "reiseabfolge.h"
  3.  
  4. Reiseabfolge::Reiseabfolge() {
  5.  
  6. QGridLayout *layoutGrid = new QGridLayout(this);
  7.  
  8. QDirModel dirModel;
  9.  
  10. QTableView *tav = new QTableView;
  11. tav->setModel(&dirModel);
  12. layoutGrid->addWidget(tav, 0, 0);
  13.  
  14. QModelIndex cwdIndex = dirModel.index(QDir::currentPath());
  15. tav->setRootIndex(cwdIndex);
  16. }
To copy to clipboard, switch view to plain text mode 


What is my problem:
The second Tab shows only a white box with noting in it. The white box must be the QGridLayout, but this QGridLayout is empty. It does not show the QTableView .

For completeness, here some further files:
reiseabfolge.h
Qt Code:
  1. #ifndef REISEABFOLGE_H
  2. #define REISEABFOLGE_H
  3.  
  4. #include <QtGui/QWidget>
  5.  
  6. class Reiseabfolge : public QWidget {
  7.  
  8. public:
  9. Reiseabfolge();
  10. };
  11.  
  12. #endif // REISEABFOLGE_H
To copy to clipboard, switch view to plain text mode 

mainwindow.h:
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5.  
  6. class MainWindow : public QMainWindow {
  7.  
  8. private:
  9. Q_OBJECT
  10. QTabWidget *widget_TabCentral;
  11. void createActions();
  12. void createMenus();
  13.  
  14. QMenu *dateiMenu;
  15. QAction *neueDatei_Action;
  16. QAction *oeffneDatei_Action;
  17. QAction *speicherDatei_Action;
  18. QAction *speicherDateiUnter_Action;
  19. QAction *beendeProgramm_Action;
  20.  
  21. public:
  22. MainWindow();
  23. ~MainWindow();
  24.  
  25. private slots:
  26. void neueDatei();
  27. void oeffneDatei();
  28. bool speicherDatei();
  29. bool speicherDateiUnter();
  30. bool beendeProgramm();
  31.  
  32. };
  33.  
  34. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

Thanks to everybody, who can tell me what I have misunderstood and made wrong.