[Qt-interest] QMainWindow and QDialog.
Alessandro Portale
alessandro.portale at trolltech.com
Thu Mar 26 14:17:02 CET 2009
Hi,
it seems that setLayout() has another effect in QMainWindow. Test: create an empty *centralWidget which takes your *mainLayout, and call QMainWindow::setCentralWidget() with it.
http://doc.qtsoftware.com/latest/qmainwindow.html#setCentralWidget
- Alessandro
Shabd Swarup V wrote:
> Hi,
>
> I have a class called Window which inherits from QMainWindow. Following
> is its constructor:
>
> Window::Window(QWidget *parent)
> : QMainWindow(parent)
> {
> ...
> mainLayout->addLayout(buttonsLayout, 2, 2, 1, 1);
> setLayout(mainLayout);
>
> setWindowTitle(tr("Gambler"));
> resize(800, 700);
> }
>
> This displays a completely blank window. Although, if I make Window
> inherit from QDialog instead of QMainWindow, the widgets are displayed
> perfectly fine.
>
> Please suggest how I can make this work while keeping the base class as
> QMainWindow.
> ...
More information about the Qt-interest-old
mailing list