Hi everybody,
I have a simple QMainWindow with a QDockWidget (a tool box) and a central widget (see the joined file called MainWindow1.jpg I don't know how to insert them directly in the text).
When I click on one button of the tool box, I need to change the central widget of the main window :
delete centralWidget();
setCentralWidget(quit);
updateGeometry();
update();
QPushButton *quit = new QPushButton(tr("&Quit"));
quit->setFont(QFont("Times", 18, QFont::Bold));
quit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
delete centralWidget();
setCentralWidget(quit);
updateGeometry();
update();
To copy to clipboard, switch view to plain text mode
But the problem is that the dock widget (the tool box) now takes a half of the main window horizontaly !!!! (see MainWindow2.jpg)
To avoid the resizing of the dock widget I wrote the following code:
setMinimumWidth(m_toolBox->width());
setMaximumWidth(m_toolBox->width());
setMinimumWidth(m_toolBox->width());
setMaximumWidth(m_toolBox->width());
To copy to clipboard, switch view to plain text mode
The result was not what I expected : the dock widget is correctly resized but there is a kind of frame taking a half of the main window !!!! (see MainWindow3.jpg)
Somebody have an idea?
Bookmarks