[Qt-interest] QMainWindow size...
OS Prog
osprog at gmail.com
Mon Aug 10 16:14:20 CEST 2009
Hi David,
Thanks for the reply.
The application is intended to run on embedded in fullscreen -
mainWindow.showMaximized();
Under windows I have defined
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
in order to develop/debug it.
The problem is that at the time of mainWindow creation (MainWindow
constructor) the window sizes are not what I want to be (the
mainWindow->width() and mainWindow->height() returns a value different from
that I want).
In the mainWindow constructor I initialize QAnimationFramework and a number
of widget, icons ... and I'd like to position them properly on the screen,
that's why I want the size to be set before the mainWindow is created and to
be constant(unchanged).
If I use the defines instead of width() and height() it works fine, but the
application should run on different screens (embedded target) maximized, so
I cannot use constant sizes.
Regards,
Nikolay
On Mon, Aug 10, 2009 at 2:57 PM, David Boosalis <david.boosalis at gmail.com>wrote:
> 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090810/04851b71/attachment-0001.html
More information about the Qt-interest-old
mailing list