Results 1 to 19 of 19

Thread: QDialog resize

  1. #1
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up QDialog resize

    Hi all,

    I have created one dailag using QDialog , while resizing using mouse only dialog is getting resized.

    I want my all dialog elements( I have some lineedit label and listctrl in my dialog ) also

    getting resized when resize using mouse , how to achieve this, is there any layouts

    available for this ?
    Thanks,
    Rajesh.S

  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: QDialog resize

    Yes, you need to apply a layout on the dialog object itself.

  3. #3
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDialog resize

    sorry , which layout can i use , please explain me?
    Thanks,
    Rajesh.S

  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: QDialog resize

    Whichever one you want. All subclasses of QLayout are for you to use.

  5. #5
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDialog resize

    i am using designer to desing dialog , i have applied horizontal layout , still only my dialog is expanding not all other objects, is there any other properties we need to set for QDialog ?
    Thanks,
    Rajesh.S

  6. #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: QDialog resize

    Did you apply a layout to the form itself? You do this by clicking on the form outside any child widgets and then clicking on one of the layout icons. All widgets should then snap in place and resizing the form should cause all child widgets to be resized as well.

  7. #7
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDialog resize

    If I apply Layout my controls positions and dialog size is increased , how to apply Layout without losing dialog size and controls positions.
    Thanks,
    Rajesh.S

  8. #8
    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: QDialog resize

    Layouts can be nested. You can also add spacers and set size policies of widgets. All that together should allow you to obtain positioning you need.

  9. #9
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDialog resize

    can u explain wich layout can we use with spacers?
    Thanks,
    Rajesh.S

  10. #10
    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: QDialog resize

    Any layout can be used with spacers. Insert a spacer on the form in the desired position and wrap it into a layout together with the widgets.

  11. #11
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QDialog resize

    I'd recommend reading: Layout Classes
    J-P Nurmi

  12. #12
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDialog resize

    i used Layouts , itried vertical , horizantal and grid layouts,

    in vertivcal layout In runtime if i resize my dialog horizontally its not expanding controls width,

    in horizontall layout if i resize my dialiog vertically its not expoanding contols height

    If i resize my form my controls height and width should be resized accordingly , how to achieve this ?
    Thanks,
    Rajesh.S

  13. #13
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QDialog resize

    Would you mind reading the document I gave link to? Pay attention to section where it says something about size policies and stretch factors.
    J-P Nurmi

  14. #14
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDialog resize

    how to set these properties in designer ?
    Thanks,
    Rajesh.S

  15. #15
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QDialog resize

    It's the "sizePolicy" property under QWidget category.
    J-P Nurmi

  16. #16
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDialog resize

    I want my dialog to be displayed in particular fixed size initially,and then if we resize it should resize all controlls,

    For this need if I apply layout and size policy initially its increasing size,

    How to create a dialog with particular fixed size by applying layouts ?
    Thanks,
    Rajesh.S

  17. #17
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDialog resize

    Keep the sizepolicy as fixed.

  18. #18
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDialog resize

    I kept sizepolicy as fixed and then i applied layout , now my dialog size is increasing , if i resize in runtime, its not resizing controls in it....
    Thanks,
    Rajesh.S

  19. #19
    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: QDialog resize

    Quote Originally Posted by rajeshs View Post
    I want my dialog to be displayed in particular fixed size initially,
    So resize() it before showing it.

    and then if we resize it should resize all controlls,
    Apply a layout to the dialog.

Similar Threads

  1. QDialog resize ?
    By allensr in forum Qt Programming
    Replies: 5
    Last Post: 11th December 2007, 20:47
  2. QDialog resize ?
    By allensr in forum Qt Programming
    Replies: 6
    Last Post: 28th October 2007, 23:41
  3. Resizing a QDialog to the content size
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 15th March 2007, 09:16
  4. Custom Shape Widget (resize)
    By PiXeL16 in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2007, 08:00
  5. postponing resize event
    By Honestmath in forum Qt Programming
    Replies: 11
    Last Post: 26th February 2006, 01:32

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.