Results 1 to 7 of 7

Thread: Show/hide part of dialog with resizing.

  1. #1
    Join Date
    Apr 2006
    Posts
    40
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Show/hide part of dialog with resizing.

    Here's the basic outline of a dialog I have designed:
    Qt Code:
    1. +--------------------------------------------------+
    2. |Gridlayout->contains "show more" button |
    3. |--------------------------------------------------|
    4. |Gridlayout-> contains more stuff |
    5. +--------------------------------------------------+
    To copy to clipboard, switch view to plain text mode 

    Now, what I want to have happen is when the "more" button is pressed, the dialog expands, and the rest of the options are displayed. When it is pressed again, those extra options should just diappear and the dialog should be resized appropriately.

    What actually happens is the top gridlayout expands to the size of the whole dialog box. When the more button is pressed, the dialog box is not resized, but the second layout is shown, squishing both within the dialog box.

    I've tried setting the layouts, sizes, size preferences, etc to everything I can think of, but it never behaves the way I want it to.

    There's an example in the Tutorials/Examples in the docs on trolltech's site http://doc.trolltech.com/4.1/dialogs-extension.html, and I can follow that and get things to work using their set up, but I can't figure out how to do the same thing using just the designer. Does anyone have any suggestions?

  2. #2
    Join Date
    Apr 2006
    Posts
    40
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Show/hide part of dialog with resizing.

    No one has any ideas? I suppose I could just do it in code like the example shows, but using the designer would definitly be the best way if it worked.

  3. #3
    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: Show/hide part of dialog with resizing.

    But what exactly doesn't work? Which part you're not able to do with designer?

  4. #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: Show/hide part of dialog with resizing.

    That's as close as I can get with doing everything from within designer. Two lines of external code needed.
    Attached Files Attached Files

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

    Spockmeat (25th May 2006)

  6. #5
    Join Date
    Apr 2006
    Posts
    40
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Show/hide part of dialog with resizing.

    Oh thanks, the problem was I needed to stick in one more line:
    Qt Code:
    1. this->layout()->setSizeConstraint(QLayout::SetFixedSize);
    To copy to clipboard, switch view to plain text mode 
    I thought that was something that could be set in the designer. Really, I wish more of the examples would be done in the disigner and not straight code, or perhaps both, it'd make it easier to know which settings can be set and where.

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

    joro (20th January 2009)

  8. #6
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    1
    Platforms
    Unix/X11 Windows

    Default Re: Show/hide part of dialog with resizing.

    Hi,
    i want to hide widget(s). But with that i want to shrink the size of Dialog.
    i am using 4 or 5 QGroupBox and under it other widgets. when i hide one QGroupBox using hide(), other boxes adjust there size in free space. I want to shrink the Dialog Box when i hide the QGroupBox .
    <BR>

  9. #7
    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: Show/hide part of dialog with resizing.

    You can use the same solution. Take a look at the archive in my previous post in this thread.

Similar Threads

  1. Issue with Modelless dialog on Mac
    By Satyanarayana Chebrolu in forum Qt Programming
    Replies: 0
    Last Post: 24th February 2009, 10:10
  2. Resizing the dialog boxes
    By anju123 in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2007, 10:41
  3. disabling resizing of a dialog
    By deepakn in forum Newbie
    Replies: 2
    Last Post: 21st June 2007, 09:14
  4. Resizing the dialog box dynamically
    By vvbkumar in forum Newbie
    Replies: 5
    Last Post: 20th June 2006, 08:54
  5. Problem with resizing dialog
    By Seema Rao in forum Qt Programming
    Replies: 8
    Last Post: 5th May 2006, 17:27

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.