Results 1 to 5 of 5

Thread: Unwanted padding on QWidget

  1. #1
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    1

    Default Unwanted padding on QWidget

    I'm trying to add a generic widget (to be used as a container for other widgets) to a dock widget, and there's some padding I can't seem to get rid of. Can I overwrite this somehow? I've tried using stylesheets but no luck.

    In the attached image: said widget with orange background (for testing purposes) is sandwiched between two labels, with correct padding. Widget contains two other widgets in a couple layouts with default values.
    Attached Images Attached Images

  2. #2
    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: Unwanted padding on QWidget

    Try setting margins for the layouts / widgets.

  3. #3
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    1

    Default Re: Unwanted padding on QWidget

    You mean as in style margins or something else? I've setStyleSheet("margin: 0; padding: 0;")'d all the elements involved, to no avail (not layouts since they can't carry style sheets, I think).

  4. #4
    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: Unwanted padding on QWidget

    • QLayout::setContentsMargins() (since Qt 4.3)
    • QLayout::setMargin()
    • QLayout::setSpacing()
    J-P Nurmi

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

    etru1927 (7th August 2008)

  6. #5
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    1

    Default Re: Unwanted padding on QWidget

    and it's not made its way into stylesheets yet eh?
    thank you very much my good chap!

Similar Threads

  1. Dynamic updates of a QWidget in a QScrollArea
    By plamkata in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2008, 23:45
  2. Error in put one QWidget in another QWidget
    By xjtu in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2008, 16:05

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.