[Qt-interest] How to control QWidget margin

birman birman at mac.com
Wed Sep 23 13:56:05 CEST 2009


Hi all,

I want to control the margin of QWidget.
In my situation, some Widgets are added to QWidget using Layout as  
below.

CustomWidget:: CustomWidget(QWidget *parent) : QWidget(parent)
{
	setContentsMargins(0, 0, 0, 0);
	
	layout = new QHBoxLayout;
	layout->setSpacing(0);
		
	(Create some Widgets....)
	
	layout->addWidget(aWidget1);
	layout->addWidget(aWidget2);
	
	setLayout(layout);
}

But, when CustomWidget was shown, there is the margin of about 20  
pixels.
Can I control it?

Environment:
    Qt 4.4.3 on Mac OSX

Thanks in advance.

birman



More information about the Qt-interest-old mailing list