May 18, 2012

jesuisbenjamin jesuisbenjam..
Lab Rat
79 posts

[SOLVED] setContentsMargins() not working?

 

I am working on an application built this way:

  1.    |_ QMainwindow
  2.          |_ QScrollArea (central widget)
  3.                |_ QFrame (child of scroll area)
  4.                      |_ QFrame
  5.                      |      |_ QLabel
  6.                      |            |_ QPixmap
  7.                      |_ QFrame
  8.                      |      |_ QLabel
  9.                      |            |_ QPixmap
  10.                      |_ QFrame
  11.                            |_ ect...

I want there to be no margins between the sub-QFrames and their QLabels and equally between QLabels and their QPixmap. The latter seems to occur naturally, but no amount of effort seems to help me reduce the margin of the QFrames with their child QLabel. I have been able to test that by applying a Style Sheet to the components. I have requested to reduce the sub-QFrame’s margins with QFrame.setContentsMargins(0, 0, 0, 0) and with its layout’s QBoxLayout.setSpacing(0). In spite of all this, margins persist i showing up.

What can I do?

Thanks.

2 replies

May 19, 2012

1+1=2 1+1=2
Robot Herder
638 posts

  1. QLayout::setContentsMargins()

May 19, 2012

jesuisbenjamin jesuisbenjam..
Lab Rat
79 posts

It works thanks :)

 
  ‹‹ SQL widgets in QT4-designer?      [SOLVED] Application not displaying .ico file format ››

You must log in to post a reply. Not a member yet? Register here!