From a76f8caf29c9acf83f12dfe90f68cd3f13e45456 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 30 Oct 2018 15:50:39 +0100 Subject: [PATCH] [Micro]Optimize QStyleSheetStyle::subElementRect No need to make a QStyleOptionButton copy, we can just use the pointer we already have Change-Id: I3ef5f59eb4fe25adf675e67ebf548f4358456379 Reviewed-by: Christian Ehrlicher Reviewed-by: Richard Moe Gustavsen --- src/widgets/styles/qstylesheetstyle.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 6cfb65a800e..654bd19d9bd 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5777,11 +5777,10 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c case SE_PushButtonContents: case SE_PushButtonFocusRect: if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { - QStyleOptionButton btnOpt(*btn); if (rule.hasBox() || !rule.hasNativeBorder()) return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect)); - return rule.baseStyleCanDraw() ? baseStyle()->subElementRect(se, &btnOpt, w) - : QWindowsStyle::subElementRect(se, &btnOpt, w); + return rule.baseStyleCanDraw() ? baseStyle()->subElementRect(se, btn, w) + : QWindowsStyle::subElementRect(se, btn, w); } break;