My application has a custom QSS, and I have a QLabel with an image. The image has big margins, however, which come from the style.
This is how the label looks, the QPixmap is solid red to show the actual contents, so the white parts are the margins:
The margins are 11 pixels for the top and bottom, 7 pixels for the left part, and 45 pixels for the right. I measured them with an image editor, and I counted the border as part of the margins.
I tried these functions:
qDebug() << label->contentsMargins() << label->margin();
But the output was QMargins(0, 0, 0, 0) 0
, even though there (big) margins. How do I calculate the real/actual margins of an image label?