diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-02-09 14:41:46 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-02-13 05:55:36 +0000 |
commit | 3c907d0f4a0bbd4f2d4116d9bb0929c51f7cc905 (patch) | |
tree | 6a3e1432b1c2841d3025342d80bffd29a330cbe5 /src/widgets/styles/qcommonstyle.cpp | |
parent | 7c254024f32ab783385718dea08829c5e0c82408 (diff) |
Replace QWidget::margin() with QWidget::contentsMargins()
Replace deprecated QWidget::margin/setMargin() calls with
contentsMargin/setContentsMargins().
Change-Id: I7fe8056196d73d1be97446d40a438cd0b1a13817
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets/styles/qcommonstyle.cpp')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 01c400c5da..56bc329827 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -3140,13 +3140,17 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, ///we need to access the widget here because the style option doesn't //have all the information we need (ie. the layout's margin) const QToolBar *tb = qobject_cast<const QToolBar*>(widget); - const int margin = tb && tb->layout() ? tb->layout()->margin() : 2; + const QMargins margins = tb && tb->layout() ? tb->layout()->contentsMargins() : QMargins(2, 2, 2, 2); const int handleExtent = proxy()->pixelMetric(QStyle::PM_ToolBarHandleExtent, opt, tb); if (tbopt->state & QStyle::State_Horizontal) { - r = QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin); + r = QRect(margins.left(), margins.top(), + handleExtent, + tbopt->rect.height() - (margins.top() + margins.bottom())); r = QStyle::visualRect(tbopt->direction, tbopt->rect, r); } else { - r = QRect(margin, margin, tbopt->rect.width() - 2*margin, handleExtent); + r = QRect(margins.left(), margins.top(), + tbopt->rect.width() - (margins.left() + margins.right()), + handleExtent); } } } |