[Qt-interest] How to control QWidget margin
John McClurkin
jwm at nei.nih.gov
Wed Sep 23 18:34:51 CEST 2009
birman wrote:
> 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
I think you need to call
layout->setMargin(0);
as well.
More information about the Qt-interest-old
mailing list