Results 1 to 9 of 9

Thread: Widget Margins

  1. #1
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Widget Margins

    When I set the layout of a parent widget, for example to horizontal, the child (contained widgets) are aligned correctly except the margins w.r.t their parent are changed (shifted) differently than what I set in the designer. I tried to change the grid granularity but the problem remains. I need to keep the child widget(s) within specific margins and still maintains the layout policy.

    Is there something I need to do? Any setting?

    Thanks.

  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: Widget Margins

    Please post your ui file and tell us what you mean exactly.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widget Margins

    Here's the buttons how they should be aligned before and after setting their container (tabbed widget) to horizontal layout:
    Attached Images Attached Images

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Widget Margins

    You seem to be wanting to adjust the layoutSpacing and layout*Margin properties of the tab layout.

  5. #5
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widget Margins

    I've accompanied the UI file. Although I set a horizontal layout for the buttons, I cannot find it on the Designer object list.
    Attached Files Attached Files

  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: Widget Margins

    You are forcing a maximum size of the tab widget so the layout can't expand your widget to make necessary space. Forcing absolute sizes of widgets is in general a BadThing(TM). Remove the maximumSize property from all widgets on the form and everything will work as expected.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widget Margins

    The spacing, or the layout granularity is unaffected. The buttons still have fixed spacing from the boundaries of their container and each other.

    I think Designer has missed an option to set granularity of layout...not to mention that the layout I set are inaccessible on the object selector. Weird!

  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: Widget Margins

    Quote Originally Posted by qtoptus View Post
    The spacing, or the layout granularity is unaffected
    Did you modify the values of spacing for the layout?

    I think Designer has missed an option to set granularity of layout...
    I don't think so.

    not to mention that the layout I set are inaccessible on the object selector. Weird!
    Sure it is.
    Attached Files Attached Files
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widget Margins

    Thanks a lot. That worked.

Similar Threads

  1. QwtPlot margins
    By jmsbc in forum Qwt
    Replies: 0
    Last Post: 2nd October 2009, 18:11
  2. QToolButton margins
    By bjoernbg in forum Qt Programming
    Replies: 3
    Last Post: 24th January 2008, 09:28
  3. QScrollArea margins
    By munna in forum Qt Programming
    Replies: 12
    Last Post: 18th September 2006, 18:56
  4. QComboBox Margins
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 19th August 2006, 11:58
  5. margins in QSimpleRichText
    By Pan Wojtas in forum Qt Programming
    Replies: 3
    Last Post: 10th February 2006, 16:34

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.