Results 1 to 5 of 5

Thread: Positioning of QFormLayout

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2013
    Posts
    10
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Positioning of QFormLayout

    Hello,

    I have built a little QT-based application but I have a difficulty to correclty position a QFormLayout.

    As it can be seen in the attached file, I have a QBoxLayout containing a form, a QFrame (separator line) and a graphic. I would like the QFormLayout to adjust in order to let as space as possible to the graphic but I did not succeed. Do you have any idea ? Thanks by advance !

    Capture du 2013-08-28 23:17:35.jpg

    For information, I have used without success :
    Qt Code:
    1. setSizeConstraint(QLayout::SetMinimumSize) on the QFormLayout
    2. setSizeConstraint(QLayout::SetMaximumSize) on the graphic
    3. setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint) on the QFromLayout
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Positioning of QFormLayout

    Set minimum size policy on form, maximum size policy on graphics

    (or)

    While adding the widgets to the QVBoxLayout set the stretch as form=1, frame=1, graphic=2
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Aug 2013
    Posts
    10
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default [SOLVED] Positioning of QFormLayout

    Thanks a lot for your answer, the second solution works fine !

    Set minimum size policy on form, maximum size policy on graphics
    For my information, I know how to set sizepolicy to the graphic since it is a widget but I do not know how to do it on the form (it is a layout). I have found setsizeconstraint but not setsizepolicy or equivalent on a layout. Could you help me by giving the function or a reference to this function ?
    Last edited by Julieng031; 29th August 2013 at 10:33.

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Positioning of QFormLayout

    For layouts use setsizeconstraint
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

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

    Julieng031 (29th August 2013)

  6. #5
    Join Date
    Aug 2013
    Posts
    10
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default [SOLVED] Positioning of QFormLayout

    Ok, thanks again !
    Last edited by Julieng031; 29th August 2013 at 10:33.

Similar Threads

  1. How to extract data from QFormLayout?
    By szisziszilvi in forum Qt Programming
    Replies: 5
    Last Post: 17th May 2011, 09:18
  2. remove row of QFormLayout
    By jorg in forum Newbie
    Replies: 1
    Last Post: 31st January 2011, 05:19
  3. Removing Rows from QFormLayout
    By jeffbobble in forum Qt Programming
    Replies: 0
    Last Post: 12th November 2010, 19:54
  4. How to collapse rows of a QFormLayout?
    By abey in forum Qt Programming
    Replies: 2
    Last Post: 14th December 2009, 07:39
  5. qformlayout: no addSpacing?
    By mattc in forum Qt Programming
    Replies: 0
    Last Post: 11th October 2009, 19:30

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.