I have just started using Qt (5.3) and encountered the fact that some controls appears with margins which I cannot control.
First, I tried to put QLabel and QPushButton right inside QMainWindow
window = new QMainWindow;
label = new QLabel( title, window );
In this case label appears with a margin of 12 pixels at the top (see picture). QPushButton appears with 1 pixel top & left margins. But if I insert QFrame with a border, it appears without any margin.
So the margins seem to be attributes of QLabel and QPushButton. BUT:
When I tried to add extra QFrame between windows and controls:
window = new QMainWindow;
frame = new QFrame(window );
label = new QLabel( title, frame);
I had got different picture: QLabels top margin had shortened to 1 pixel QPushButton 1 pixel margins remained intact, but the height of the button had changed
I have tried: setStyleSheet( "padding:0px" ) and setContentsMargins( 0, 0, 0, 0 )
for all elements, but without any success.
Any help would be greatly appreciated