Results 1 to 3 of 3

Thread: disabling resizing of a dialog

  1. #1
    Join Date
    Jun 2007
    Location
    India
    Posts
    33
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation disabling resizing of a dialog

    Hello all...

    I have a dialog whose default size i have set [to some desired value]. After that, i want its resizing disabled. Could anyone please tell how to do that?

    Here is a part of the code:
    Qt Code:
    1. QVBoxLayout *mainLayout = new QVBoxLayout;
    2. mainLayout->addWidget(headerLabel);
    3. mainLayout->addWidget(onoffGbx());
    4. .....
    5. mainLayout->addStretch();
    6. mainLayout->addLayout(buttonLayout);
    7.  
    8. resize(380, 420); //here i have fixed the size. i want it to remain the same throughout.
    9. //mainLayout->setSizeConstraint(QLayout::SetFixedSize);
    10. setLayout(mainLayout);
    11.  
    12. setWindowTitle("Testbed settings");
    To copy to clipboard, switch view to plain text mode 

    I tried mainLayout->setSizeConstraint(QLayout::SetFixedSize); but its changing the size to some default value of its own.

    Also, by using mainLayout->addStretch(); can we fix the value of space[gap]? i saw mainLayout->addStretch(1); somewhere in the examples. Whats the significance of '1' there?

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: disabling resizing of a dialog

    Hi,

    Simply use setFixedSize( QSize(380, 420) );

    It sets both minimum and maximum size in one call

    Guilugi.

  3. The following user says thank you to guilugi for this useful post:

    deepakn (21st June 2007)

  4. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    33
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disabling resizing of a dialog

    That worked. Thanks a lot.

Similar Threads

  1. Resizing the dialog box dynamically
    By vvbkumar in forum Newbie
    Replies: 5
    Last Post: 20th June 2006, 08:54
  2. Show/hide part of dialog with resizing.
    By Spockmeat in forum Qt Tools
    Replies: 6
    Last Post: 7th June 2006, 08:22
  3. Problem with resizing dialog
    By Seema Rao in forum Qt Programming
    Replies: 8
    Last Post: 5th May 2006, 17:27
  4. Dialog positioning in GNOME
    By simk in forum Qt Programming
    Replies: 2
    Last Post: 16th March 2006, 09:41
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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.