I'm going to create a modified class of QDockWidget (lets call the class QAlexDockWidget) and place several objects of that class on my MainWindow during my App is running. The design of that class should be defined by layouts.

This is a function of the class QAlexDockWidget
Qt Code:
  1. void QAlexDockWidget::setLayout_List()
  2. {
  3. QVBoxLayout *vLayout = new QVBoxLayout;
  4. QHBoxLayout *hLayout = new QHBoxLayout;
  5. QListView *listView = new QListView;
  6. QPushButton *btnNew = new QPushButton;
  7. QPushButton *btnDel = new QPushButton;
  8. QPushButton *btnEdit = new QPushButton;
  9. hLayout->addWidget(btnNew);
  10. hLayout->addWidget(btnDel);
  11. hLayout->addWidget(btnEdit);
  12. vLayout->addWidget(listView);
  13. vLayout->addLayout(hLayout);
  14. this->setLayout(vLayout);
  15. }
To copy to clipboard, switch view to plain text mode 

My problem is, when i run the application the AlexDockWidget is still empty and I get the debugger message

QWidget::setLayout: Attempting to set QLayout "" on QAlexDockWidget "Titelleiste", which already has a layout
Why is there an existig layout and how could I place my own layout instead of this default layout?