Results 1 to 4 of 4

Thread: windowState error Qt 3.3.4

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    Los Angeles, California
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default windowState error Qt 3.3.4

    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? I want to make a short but full screen width dialog behave as a normal window size.

    I've attached my test project code.

    Qt Code:
    1. void stForm::init()
    2. {
    3. installEventFilter( this );
    4. }
    5.  
    6. void stForm::moveEvent ( QMoveEvent* e )
    7. {
    8. int fx = frameGeometry().x();
    9. int fy = frameGeometry().y();
    10. int x = e->pos().x();
    11. int y = e->pos().y();
    12. int ox = e->oldPos().x();
    13. int oy = e->oldPos().y();
    14. qDebug("moveEvent: pos %d,%d oldPos %d,%d frame %d,%d",x,y,ox,oy,fx,fy);
    15. }
    16.  
    17. void stForm::resizeEvent ( QResizeEvent * re )
    18. {
    19. int ow = re->oldSize().width();
    20. int oh = re->oldSize().height();
    21. int w = re->size().width();
    22. int h = re->size().height();
    23. int ws = windowState();
    24. int normal = ws & Qt::WindowNoState;
    25. int minimized = ws & Qt::WindowMinimized;
    26. int maximized = ws & Qt::WindowMaximized;
    27. int fullScreen = ws & Qt::WindowFullScreen;
    28. 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);
    29. }
    30.  
    31. bool stForm::eventFilter( QObject* obj,QEvent* e )
    32. {
    33. if ( obj != this ) {
    34. return false;
    35. }
    36.  
    37. if ( e->type() == QEvent::WindowStateChange ) {
    38. int ws = windowState();
    39. int normal = ws & Qt::WindowNoState;
    40. int minimized = ws & Qt::WindowMinimized;
    41. int maximized = ws & Qt::WindowMaximized;
    42. int fullScreen = ws & Qt::WindowFullScreen;
    43. qDebug("QEvent::WindowStateChange: windowState normal %d min %d max %d full %d",normal,minimized,maximized,fullScreen);
    44. }
    45. return false;
    46. }
    47.  
    48. void stForm::showMaximized()
    49. {
    50. int w = frameGeometry().width();
    51. int h = frameGeometry().height();
    52. int x = frameGeometry().x();
    53. int y = frameGeometry().y();
    54. qDebug("showMaximized: x,y,w,h %d %d %d %d",x,y,w,h);
    55. QWidget::showMaximized();
    56. }
    57.  
    58. void stForm::showNormal()
    59. {
    60. int w = frameGeometry().width();
    61. int h = frameGeometry().height();
    62. int x = frameGeometry().x();
    63. int y = frameGeometry().y();
    64. qDebug("showNormal: x,y,w,h %d %d %d %d",x,y,w,h);
    65. QWidget::showNormal();
    66. }
    67.  
    68. void stForm::setWindowState( uint ws )
    69. {
    70. int w = frameGeometry().width();
    71. int h = frameGeometry().height();
    72. int x = frameGeometry().x();
    73. int y = frameGeometry().y();
    74. qDebug("setWindowState: w,h,x,y %d %d %d %d",w,h,x,y);
    75. QWidget::setWindowState( ws );
    76. }
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files
    Last edited by tt; 24th March 2006 at 19:08.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.