diff options
author | Hannah von Reth <hannah.vonreth@kdab.com> | 2016-03-29 09:50:50 +0200 |
---|---|---|
committer | Hannah von Reth <hannah.vonreth@kdab.com> | 2016-04-05 20:32:26 +0000 |
commit | 1726352207273465c12852d027f97b99884b78e4 (patch) | |
tree | d058c5268ddb085345b6eddb190a54f6b981e8f2 /src | |
parent | 65aff4dc422f53faa44e961850cb4f1e4501a8c7 (diff) |
Make sure QStyleOption is correctly initialized.
Ensures that QStyleOption is correctly initialized.
This prevents possible styling issues due to
QStyleOption's reporting version 0, see qstyleoption_cast.
This enables users to handle more cases in their QProxyStyle.
For now the test is only used for QCommonStyle.
Change-Id: I768db00b12b46890343fffe44e4f562762e9cf80
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 4b6e3ac5c4..7b0d8eacd5 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -784,10 +784,8 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut default: return; } - QStyleOption arrowOpt; + QStyleOption arrowOpt = *toolbutton; arrowOpt.rect = rect; - arrowOpt.palette = toolbutton->palette; - arrowOpt.state = toolbutton->state; style->drawPrimitive(pe, &arrowOpt, painter, widget); } #endif // QT_NO_TOOLBUTTON @@ -3309,8 +3307,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl mflags |= State_Sunken; } - QStyleOption tool(0); - tool.palette = toolbutton->palette; + QStyleOption tool = *toolbutton; if (toolbutton->subControls & SC_ToolButton) { if (bflags & (State_Sunken | State_On | State_Raised)) { tool.rect = button; @@ -3379,8 +3376,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl bool down = false; QPixmap pm; - QStyleOption tool(0); - tool.palette = tb->palette; + QStyleOption tool = *tb; if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) { ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget); down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken); |