From 2162f01111d21d0ce66ceb8be290b0a13653e691 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Mon, 13 Mar 2017 14:22:06 -0700 Subject: Remove some redundant code in QAction Only 2 bits are needed to represent -1, 0, and 1 in a signed integer, and !(n != -1) implies n == -1 so the second condition was redundant. Change-Id: I200a17fe4e49ebc0eaa9a1988b4625267cef61a4 Reviewed-by: Gabriel de Dietrich --- src/widgets/kernel/qaction.cpp | 3 +-- src/widgets/kernel/qaction_p.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index ec7dc34d4d..130c354132 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -1278,8 +1278,7 @@ void QAction::setIconVisibleInMenu(bool visible) d->iconVisibleInMenu = visible; // Only send data changed if we really need to. if (oldValue != -1 - || (oldValue == -1 - && visible == !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus))) { + || visible == !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus)) { d->sendDataChanged(); } } diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h index 5f4c9a35a3..6813ca08f6 100644 --- a/src/widgets/kernel/qaction_p.h +++ b/src/widgets/kernel/qaction_p.h @@ -105,7 +105,7 @@ public: uint separator : 1; uint fontSet : 1; - int iconVisibleInMenu : 3; // Only has values -1, 0, and 1 + int iconVisibleInMenu : 2; // Only has values -1, 0, and 1 int shortcutVisibleInContextMenu : 2; // Only has values -1, 0, and 1 QAction::MenuRole menuRole; -- cgit v1.2.3