Qwidget Show abnormal /setGeometry not working
I build a app use QtCreator /MSVC2010 (Win7 )
my app UI extend QWidget,the geometry is (0,0,860,600)
Where i run it on windows xp sp3(only one system is abnormal,anothers is good) , the app show abnormal,show a big big window.
I'm Rewrite the QWidget::resizeEvent(e){
} function,print the size and oldsize information:
i print :
old size -1,-1, new size > 3766,600
but on my PC,the UI show normal,
print:
old size -1,-1, new size > 860,600
then ,i write these code :
if(oldWin.width() == -1 &&
oldWin.height() == -1){
if(size.width() != 860 || size.height() != 600){
resize(860,600);
setGeometry(0,0,860,600);
}
}
in resizeEvent(e);
and the resize and setGeometry do not work ,the window still show abnormal~
who can tell me ? Why ?
Re: Qwidget Show abnormal /setGeometry not working
Don't you think that it never enters the condition ? why would it ever be necessary to check width and height with -1 ?
(insert your code between tags. and don't mix code with statements)
Re: Qwidget Show abnormal /setGeometry not working
Maybe you should read the documentation for QWidget::geometry(), especially this part:
Quote:
Warning: Calling setGeometry() inside resizeEvent() or moveEvent() can lead to infinite recursion.
See the Window Geometry documentation for an overview of geometry issues with windows.
Re: Qwidget Show abnormal /setGeometry not working
thanks for your reply,
my problem is qwidget show abnormal ,at begin, my widget geometry is 0,0,860,600, but it's display an 0,0,3766,600 window. my layout is HorizontalLayout
Re: Qwidget Show abnormal /setGeometry not working
If you use layouts then calling setGeometry is a no-op as the layout will override it.