Results 1 to 2 of 2

Thread: What to use QSpacerItem or layout's margin and spacing?

  1. #1
    Join Date
    Feb 2010
    Thanked 3 Times in 3 Posts
    Qt products
    MacOS X Unix/X11 Windows

    Default What to use QSpacerItem or layout's margin and spacing?


    I am in a dilemma on what to use to add space between widgets in the layout. I am using QVBoxLayout and QHBoxLayout.
    One option is to use QSpacerItem and call layout->addSpacerItem() and other option is to set the margins and spacing in layout. I can achieve my desired result by using both approaches.

    Does Qt recommend to prefer one before another?


  2. #2
    Join Date
    Jun 2010
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Unix/X11 Windows Maemo/MeeGo

    Default Re: What to use QSpacerItem or layout's margin and spacing?


    addSpacerItem() insert a space between two objects. spacing and margin add a space around all objects. have a look at this picture i uploaded for you:
    Stelios: What the hell are you laughing at?
    Astinos: Well, you had to say it!
    Stelios: What?
    Astinos: "Fight in the shade"!
    If my answer has helped you, i would appreciate it if you use the thanks button.

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

    dpatel (11th June 2010)

Similar Threads

  1. Setting layout margin and spacing globally
    By aarpon in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2009, 12:23
  2. Replies: 3
    Last Post: 27th November 2008, 23:57
  3. Problem in layout spacing
    By mails.hemant in forum Qt Tools
    Replies: 15
    Last Post: 24th November 2008, 11:48
  4. Layout without margin??
    By zlosynus in forum Qt Programming
    Replies: 1
    Last Post: 2nd August 2008, 09:59
  5. QDialog margin and spacing
    By TheRonin in forum Qt Programming
    Replies: 4
    Last Post: 29th October 2007, 10:11


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.