[Qt-interest] QDialog with wrong contentsMargins()
Anton Chernov
mechernov at gmail.com
Sat Aug 27 16:03:52 CEST 2011
Use style sheets - QString( "QDialog { margin: %1; }" ).arg( value );
Set on the main window, or any other global parents.
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/20110827/4d0c7251/attachment.html
More information about the Qt-interest-old
mailing list