[Qt-interest] QMainWindow and QDialog.

Shabd Swarup V shabd at cadence.com
Thu Mar 26 14:27:10 CET 2009


Thanks a lot, that worked!

Regards,
Shabd

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Alessandro
Portale
Sent: Thursday, March 26, 2009 6:47 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] QMainWindow and QDialog.

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.
> ...
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list