tt
24th March 2006, 18:47
windowState seems to have changed behavior between 3.3.3 and 3.3.4. If I make a short window span the width of my screen, the windowState changes to Qt::WindowMaximized. This shows up in the qDebug statements from the test code as well as the icons in the window frame. The same thing happens if I make a skinny window span the height of my screen. By the way, all windows in 3.3.4 have this behavior.
I checked the Qt bug list and haven't found any fixes. Is the behavior the same in later releases?
The system also 'forgets' the size and location of the dialog if I move it to the edge of the screen. The scenario is:
1. move window to left edge.
2. make the dialog wider to the right.
3. pick showNormal button on dialog -> size and position stay the same.
4. make the dialog as wide as the screen.
5. pick showMaximized -> size and position stay the same.
6. pick showNormal -> size and position change to where it was when the dialog opened.
What compounds this problem is that the virtual slots showNormal and showMaximized aren't called when the window frame buttons are picked, so I don't know how to change the behavior.
Any ideas? :confused: I want to make a short but full screen width dialog behave as a normal window size.
I've attached my test project code.
void stForm::init()
{
installEventFilter( this );
}
void stForm::moveEvent ( QMoveEvent* e )
{
int fx = frameGeometry().x();
int fy = frameGeometry().y();
int x = e->pos().x();
int y = e->pos().y();
int ox = e->oldPos().x();
int oy = e->oldPos().y();
qDebug("moveEvent: pos %d,%d oldPos %d,%d frame %d,%d",x,y,ox,oy,fx,fy);
}
void stForm::resizeEvent ( QResizeEvent * re )
{
int ow = re->oldSize().width();
int oh = re->oldSize().height();
int w = re->size().width();
int h = re->size().height();
int ws = windowState();
int normal = ws & Qt::WindowNoState;
int minimized = ws & Qt::WindowMinimized;
int maximized = ws & Qt::WindowMaximized;
int fullScreen = ws & Qt::WindowFullScreen;
qDebug("resizeEvent: size %d,%d oldSize %d,%d windowState: normal %d min %d max %d full %d ",w,h,ow,oh,normal,minimized,maximized,fullScreen);
}
bool stForm::eventFilter( QObject* obj,QEvent* e )
{
if ( obj != this ) {
return false;
}
if ( e->type() == QEvent::WindowStateChange ) {
int ws = windowState();
int normal = ws & Qt::WindowNoState;
int minimized = ws & Qt::WindowMinimized;
int maximized = ws & Qt::WindowMaximized;
int fullScreen = ws & Qt::WindowFullScreen;
qDebug("QEvent::WindowStateChange: windowState normal %d min %d max %d full %d",normal,minimized,maximized,fullScreen);
}
return false;
}
void stForm::showMaximized()
{
int w = frameGeometry().width();
int h = frameGeometry().height();
int x = frameGeometry().x();
int y = frameGeometry().y();
qDebug("showMaximized: x,y,w,h %d %d %d %d",x,y,w,h);
QWidget::showMaximized();
}
void stForm::showNormal()
{
int w = frameGeometry().width();
int h = frameGeometry().height();
int x = frameGeometry().x();
int y = frameGeometry().y();
qDebug("showNormal: x,y,w,h %d %d %d %d",x,y,w,h);
QWidget::showNormal();
}
void stForm::setWindowState( uint ws )
{
int w = frameGeometry().width();
int h = frameGeometry().height();
int x = frameGeometry().x();
int y = frameGeometry().y();
qDebug("setWindowState: w,h,x,y %d %d %d %d",w,h,x,y);
QWidget::setWindowState( ws );
}
I checked the Qt bug list and haven't found any fixes. Is the behavior the same in later releases?
The system also 'forgets' the size and location of the dialog if I move it to the edge of the screen. The scenario is:
1. move window to left edge.
2. make the dialog wider to the right.
3. pick showNormal button on dialog -> size and position stay the same.
4. make the dialog as wide as the screen.
5. pick showMaximized -> size and position stay the same.
6. pick showNormal -> size and position change to where it was when the dialog opened.
What compounds this problem is that the virtual slots showNormal and showMaximized aren't called when the window frame buttons are picked, so I don't know how to change the behavior.
Any ideas? :confused: I want to make a short but full screen width dialog behave as a normal window size.
I've attached my test project code.
void stForm::init()
{
installEventFilter( this );
}
void stForm::moveEvent ( QMoveEvent* e )
{
int fx = frameGeometry().x();
int fy = frameGeometry().y();
int x = e->pos().x();
int y = e->pos().y();
int ox = e->oldPos().x();
int oy = e->oldPos().y();
qDebug("moveEvent: pos %d,%d oldPos %d,%d frame %d,%d",x,y,ox,oy,fx,fy);
}
void stForm::resizeEvent ( QResizeEvent * re )
{
int ow = re->oldSize().width();
int oh = re->oldSize().height();
int w = re->size().width();
int h = re->size().height();
int ws = windowState();
int normal = ws & Qt::WindowNoState;
int minimized = ws & Qt::WindowMinimized;
int maximized = ws & Qt::WindowMaximized;
int fullScreen = ws & Qt::WindowFullScreen;
qDebug("resizeEvent: size %d,%d oldSize %d,%d windowState: normal %d min %d max %d full %d ",w,h,ow,oh,normal,minimized,maximized,fullScreen);
}
bool stForm::eventFilter( QObject* obj,QEvent* e )
{
if ( obj != this ) {
return false;
}
if ( e->type() == QEvent::WindowStateChange ) {
int ws = windowState();
int normal = ws & Qt::WindowNoState;
int minimized = ws & Qt::WindowMinimized;
int maximized = ws & Qt::WindowMaximized;
int fullScreen = ws & Qt::WindowFullScreen;
qDebug("QEvent::WindowStateChange: windowState normal %d min %d max %d full %d",normal,minimized,maximized,fullScreen);
}
return false;
}
void stForm::showMaximized()
{
int w = frameGeometry().width();
int h = frameGeometry().height();
int x = frameGeometry().x();
int y = frameGeometry().y();
qDebug("showMaximized: x,y,w,h %d %d %d %d",x,y,w,h);
QWidget::showMaximized();
}
void stForm::showNormal()
{
int w = frameGeometry().width();
int h = frameGeometry().height();
int x = frameGeometry().x();
int y = frameGeometry().y();
qDebug("showNormal: x,y,w,h %d %d %d %d",x,y,w,h);
QWidget::showNormal();
}
void stForm::setWindowState( uint ws )
{
int w = frameGeometry().width();
int h = frameGeometry().height();
int x = frameGeometry().x();
int y = frameGeometry().y();
qDebug("setWindowState: w,h,x,y %d %d %d %d",w,h,x,y);
QWidget::setWindowState( ws );
}