DockTest
::DockTest(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
Docker1->setObjectName("Docker1");
frame1->setLayout(la1);
la1->addWidget(lw1);
la1->addWidget(pb1);
Docker1->setWidget(frame1);
addDockWidget(Qt::RightDockWidgetArea,Docker1);
Docker1
->setFeatures
(QDockWidget::DockWidgetFloatable|QDockWidget
::DockWidgetMovable);
Docker1->setFloating(true);
Docker1->setGeometry(100,100,100,200);
// --------------------------------------------
Docker2->setObjectName("Docker2");
frame2->setLayout(la2);
la2->addWidget(lw2);
la2->addWidget(pb2);
Docker2->setWidget(frame2);
addDockWidget(Qt::LeftDockWidgetArea,Docker2);
Docker2
->setFeatures
(QDockWidget::DockWidgetFloatable|QDockWidget
::DockWidgetMovable);
Docker2->setFloating(false);
// Docker2 should be displayed with a width of 100
Docker2->setGeometry(10,10,100,100); // does not work
Docker2->setMinimumWidth(100); // does not work
}
DockTest::DockTest(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
ui.setupUi(this);
QDockWidget *Docker1 = new QDockWidget(this);
Docker1->setObjectName("Docker1");
QFrame *frame1 = new QFrame(Docker1);
QVBoxLayout *la1 = new QVBoxLayout(Docker1);
QListWidget *lw1 = new QListWidget(Docker1);
QPushButton *pb1 = new QPushButton(Docker1);
frame1->setLayout(la1);
la1->addWidget(lw1);
la1->addWidget(pb1);
Docker1->setWidget(frame1);
addDockWidget(Qt::RightDockWidgetArea,Docker1);
Docker1->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
Docker1->setFloating(true);
Docker1->setGeometry(100,100,100,200);
// --------------------------------------------
QDockWidget *Docker2 = new QDockWidget(this);
Docker2->setObjectName("Docker2");
QFrame *frame2 = new QFrame(this);
QVBoxLayout *la2 = new QVBoxLayout(Docker2);
QListWidget *lw2 = new QListWidget(Docker2);
QPushButton *pb2 = new QPushButton(Docker2);
frame2->setLayout(la2);
la2->addWidget(lw2);
la2->addWidget(pb2);
Docker2->setWidget(frame2);
addDockWidget(Qt::LeftDockWidgetArea,Docker2);
Docker2->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
Docker2->setFloating(false);
// Docker2 should be displayed with a width of 100
Docker2->setGeometry(10,10,100,100); // does not work
Docker2->setMinimumWidth(100); // does not work
}
To copy to clipboard, switch view to plain text mode
Bookmarks