From 0d4711e2f52366e9cb167f5c144b1742082a3f31 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 24 Jun 2015 21:48:36 +0200 Subject: [PATCH] QStyleSheetStyle: scope a ButtonInfo object better Only one of the three following branches actually uses the ButtonInfo object, so create it only in that branch. Change-Id: I65c1d45d807258ed3352018c088bb4c4c66f9b84 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qstylesheetstyle.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 235c3307da..34bc59c86f 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -746,14 +746,15 @@ QHash QStyleSheetStyle::titleBarLayout(const QWidget enum Where { Left, Right, Center, NoWhere } where = Left; QList infos; for (int i = 0; i < layout.count(); i++) { - ButtonInfo info; - info.element = layout[i].toInt(); - if (info.element == '(') { + const int element = layout[i].toInt(); + if (element == '(') { where = Center; - } else if (info.element == ')') { + } else if (element == ')') { where = Right; } else { - switch (info.element) { + ButtonInfo info; + info.element = element; + switch (element) { case PseudoElement_TitleBar: if (!(tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint))) continue;