Results 1 to 6 of 6

Thread: Prevent from resizing a QMainWindow

  1. #1
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    2

    Default Prevent from resizing a QMainWindow

    Hi !

    Does anyone know how to do from Qt Designer 3.2 to prevent the user from resizing a QMainWindow ?

    Thanks !
    Warning, I'm a beginner !

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Prevent from resizing a QMainWindow

    Just set the same values in minimumSize and maximumSize properties.

  3. #3
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    2

    Default Re: Prevent from resizing a QMainWindow

    I've tried this but though I'm not able to enlarge the window I'm still able to reduce his size.
    And how to get rid of the small triangle ?
    Warning, I'm a beginner !

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Prevent from resizing a QMainWindow

    Qt Code:
    1. statusBar()->setSizeGripEnabled( false );
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to jacek for this useful post:

    Flier (14th April 2006)

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Prevent from resizing a QMainWindow

    You should also be able use setFixedSize() (if it's not defined in QDialog).

  7. The following user says thank you to wysota for this useful post:

    Flier (14th April 2006)

  8. #6
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    2

    Default Re: Prevent from resizing a QMainWindow

    Thanks for your answers !

    As it would seem one could not manage totally this from Qt Designer 3.2, I did it that way (perhaps there's a better way ?) :

    I set up the maximumSize (width and height) in Qt Designer and in the code, I wrote the following :

    s_max = MyQMainWin->maximumSize();
    MyQMainWin->statusBar()->setSizeGripEnabled( FALSE );
    MyQMainWin->show();
    MyQMainWin->setFixedSize( s_max );

    If setFixedSize() is placed before show(), it's still possible to shrink the Window.
    Warning, I'm a beginner !

Similar Threads

  1. QMainWindow setCentralWidget from ui widget, Qt4
    By alan in forum Qt Programming
    Replies: 5
    Last Post: 13th May 2008, 14:00
  2. QMainWindow child of a QDialog
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 16th January 2008, 08:16

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.