[Qt-interest] QMainWindow size...
David Boosalis
david.boosalis at gmail.com
Mon Aug 10 15:57:38 CEST 2009
mainWindow->setFixedSize(SCREEN_WIDTH, SCREEN_HEIGHT);
mainWIndow->show();
Incidently if your sizes are done with defines like:
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
a more robust way is to you use QDesktopWidget:
QDesktopWidget *desktop = qapp->desktop();
QRect r = desktop->screenGeometry;
mainWindow->setFixedSize(r.width(),r.height());
Hope this helps
David
On Mon, Aug 10, 2009 at 6:18 AM, OS Prog<osprog at gmail.com> wrote:
> Hi,
>
> I'd like to initialize some graphics in QMainWindow's constructor. I want to
> set the Main window with exact geometry:
> MainWindow::MainWindow(...)
> :QMainWindow
> {
> setMinimumSize( SCREEN_WIDTH, SCREEN_HEIGHT);
> setMaximumSize(SCREEN_WIDTH, SCREEN_HEIGHT);
>
>
> ...... do something .....
>
> qDebug("width():%d",width());
> qDebug("\theight():%d",height());
> ...... do something .....
>
> }
>
> ,but at 'qDebug()' I've got the different geometry. It seems that these 2
> functions are asynchronous... Is that correct?
>
> How can I set the window geomettry synchronous or before the MainWindow
> claas is creatred?
>
> Regards,
> Nikolay
>
> _______________________________________________
> 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