Search code examples
qtuser-interfaceqt4paddingqlabel

Get rid of extra space on top of QLabel


As shown by the picture below, I have a QLabel with unwanted whitespace between the "Actual definition" and the text in the QLabel. I've tried setting the vertical alignment to AlignTop, setting the style sheet to QLabel{padding: 0 0 0 0px;}, but this is the end result:

awww man

How can I fix this?

EDIT While creating a test UI file, I discovered that the cause behind this was my setting the indent to 15. How can I keep the indent to the right without causing the indent to the bottom (and while keeping the alignment of the text to the top of the label)? It seems as if I can't just use indent anymore.


Solution

  • Instead of using indent, try using padding-left in a style sheet.