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 <gabriel.dedietrich@qt.io>bb10
parent
c2c3452ba5
commit
2162f01111
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue