[Qt-interest] QDialog with wrong contentsMargins()
Kishore Jonnalagadda
kitts.mailinglists at gmail.com
Mon Aug 29 06:22:51 CEST 2011
On Aug 27, 2011 7:33 PM, "Anton Chernov" <mechernov at gmail.com> wrote:
>
> Use style sheets - QString( "QDialog { margin: %1; }" ).arg( value );
>
> Set on the main window, or any other global parents.
Did not work. I tried applying this stylesheet on both the application and
to the dialog directly but it did not help.
> 2011/8/26 Kishore Jonnalagadda <kitts.mailinglists at gmail.com>
>>
>> In alomost all my QDialog subclasses (using designer), I find that i need
to
>> add this to the constructor.
>>
>> layout()->setContentsMargins(
>> style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
>> style()->pixelMetric(QStyle::PM_LayoutTopMargin),
>> style()->pixelMetric(QStyle::PM_LayoutRightMargin),
>> style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
>>
>> Without that it uses 11 pixels as the margins which is said to be the
common
>> default in the docs but is dependent on the style. Here on my system with
the
>> Oxygen style it should be 4 pixels (which is what is shown in designer
when
>> designing the dialog). However, i have to explicitly set it with the code
>> above.
>>
>> 11 pixels is a bit too much and looks ugly. While i atleast have the
option of
>> putting the code above for most dialogs, the same i can't do with a
QWizard
>> (layout() return a NULL).
>>
>> I'd like to know if my understanding is wrong* or if this is indeed a bug
in
>> Qt/Oxygen?
>> --
>> Cheers!
>> Kishore
>>
>> * The layout system for widgets is quite complex I yet have not a grasp
of how
>> things work.
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110829/398fcc84/attachment.html
More information about the Qt-interest-old
mailing list