Results 1 to 6 of 6

Thread: [QT4] Any way to disable window resizing ?

  1. #1
    Join Date
    May 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [QT4] Any way to disable window resizing ?

    Well, as the title of the thread suggest, I'm searching for a way to disable window-resizing on a QDialog (isn't a QDialog no-resizable by default ?). I've tried several Qt::WindowFlags, but without success...

    I'm currently running QT4 4.1.2 on kubuntu dapper.

  2. #2
    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: [QT4] Any way to disable window resizing ?

    Use setFixedSize(). It should disable resizing.

    For example:
    Qt Code:
    1. QDialog dlg;
    2. dlg.show();
    3. //...
    4. dlg.setFixedSize(dlg.size());
    To copy to clipboard, switch view to plain text mode 

  3. The following 2 users say thank you to wysota for this useful post:

    ntp (4th December 2007), oficjalne100 (4th November 2011)

  4. #3
    Join Date
    May 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QT4] Any way to disable window resizing ?

    Thanks a lot, that solved it...
    (I wonder why this isn't a window property, oh well...)

    Edit: well, it IS a property and I found where you can specify this in QT Designer : -> sizePolicy. Sometimes I think I should search more carefully.
    Last edited by Amalsek; 15th May 2006 at 02:18.

  5. #4
    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: [QT4] Any way to disable window resizing ?

    Quote Originally Posted by Amalsek
    Edit: well, it IS a property and I found where you can specify this in QT Designer : -> sizePolicy. Sometimes I think I should search more carefully.
    Not exactly. Size policy only specifies the behaviour while in a layout. It doesn't have influence on top-level widgets (like QDialog).

  6. #5
    Join Date
    May 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QT4] Any way to disable window resizing ?

    Well, I removed the code you gave me, and modified setPolicy, and the result was the same. I was working on a QDialog widget.

    Edit : Nevermind, you were rignt (forgot to remove old .o file)
    Last edited by Amalsek; 15th May 2006 at 11:45.

  7. #6
    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: [QT4] Any way to disable window resizing ?

    Which version? I am able to resize the dialog despite the policy unless minimum and maximum sizes are set for the same values (which is exactly the same as you would call setFixedSize).

Similar Threads

  1. Resizing a maximized, custom-frame window
    By Claymore in forum Qt Programming
    Replies: 9
    Last Post: 24th November 2010, 18:17
  2. How to disable Maximise button in Output window
    By durgarao in forum Qt Tools
    Replies: 1
    Last Post: 2nd January 2009, 12:55
  3. Double click resize window disable
    By MarkoSan in forum Qt Programming
    Replies: 3
    Last Post: 13th May 2008, 11:35
  4. Set a window as child at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2007, 09:30
  5. Replies: 1
    Last Post: 9th February 2007, 09:41

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.