[Qt-interest] resize of window

william.crocker at analog.com william.crocker at analog.com
Wed Nov 18 15:27:05 CET 2009


>>>
>>> I compiled Qt for arm-based embedded platform (linux) and try to run
>>> some sample application. Our display screen is 640 * 240.
>>> I called resize function in the constructor and observed that both
>>> width & height is not changing to correct values. For example, If I
>>> call resize(120, 120), width is displayed to 240 and height is
>>> displayed to 240.
>>>
>>> can anyone suggest how to debug this issue?
>>>
>>> Thanks
>>>
> Don't call resize in the constructor. Call resize after show().
>

Here are the gymnastics I have to go through to trick
the X11 Window system into placing windows where I want them:
I'm sure there are aspects of it which could be criticized.
The sz and pos are suspect because there were, at some point,
queried from the same sadistic window system.

void
MyDialog::locateFromSettings() {
     if( sizeSettingName().size() > 0 ) {
         QSettings settings;
         QSize   sz = settings.value(sizeSettingName(),sizeSettingFactoryDefault()).toSize();
         QPoint pos = settings.value(posSettingName(),posSettingFactoryDefault()).toPoint();
         if( sz.width() > 0 && sz.height() > 0 )
             resize(sz);
         if( pos.x() != 0 && pos.y() != 0 )
             move(pos);
         show();
         qApp->processEvents(QEventLoop::ExcludeUserInputEvents,5000);
         if( pos.x() != 0 && pos.y() != 0 )
             move(pos);
         if( sz.width() > 0 && sz.height() > 0 )
             resize(sz);
         raise();
     }
     showNormal();
     show();
     raise();
}




  _______________________________________________
> 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