WilliamSpiderWeb
3rd March 2011, 22:34
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
void QAlexDockWidget::setLayout_List()
{
QVBoxLayout *vLayout = new QVBoxLayout;
QHBoxLayout *hLayout = new QHBoxLayout;
QListView *listView = new QListView;
QPushButton *btnNew = new QPushButton;
QPushButton *btnDel = new QPushButton;
QPushButton *btnEdit = new QPushButton;
hLayout->addWidget(btnNew);
hLayout->addWidget(btnDel);
hLayout->addWidget(btnEdit);
vLayout->addWidget(listView);
vLayout->addLayout(hLayout);
this->setLayout(vLayout);
}
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?
This is a function of the class QAlexDockWidget
void QAlexDockWidget::setLayout_List()
{
QVBoxLayout *vLayout = new QVBoxLayout;
QHBoxLayout *hLayout = new QHBoxLayout;
QListView *listView = new QListView;
QPushButton *btnNew = new QPushButton;
QPushButton *btnDel = new QPushButton;
QPushButton *btnEdit = new QPushButton;
hLayout->addWidget(btnNew);
hLayout->addWidget(btnDel);
hLayout->addWidget(btnEdit);
vLayout->addWidget(listView);
vLayout->addLayout(hLayout);
this->setLayout(vLayout);
}
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?