summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2016-01-22 10:46:05 +0300
committerDmitry Shachnev <mitya57@gmail.com>2016-02-09 16:54:58 +0000
commit488cf78e44947efffcf3ebde62d7fb2d4fbf4345 (patch)
treee8857d0de4d8eb21f57df5a8ed358709f70ef656 /src/widgets
parentb30edc51535c389bdee9f676c4b5003d37242092 (diff)
dbusmenu: Use proper toggle-type for items that are part of group
To achieve that, add a new virtual setHasExclusiveGroup() method to QPlatformMenuItem class (optional because we don't want to break existing platform themes), call it when converting QActions into platform menu items, and use it when exporting the menu items over D-Bus. Also, send ActionChanged event for actions when their group is changed, so that the platform menus are updated too. Change-Id: I8d951ace8c4097decec2a0154163e3672214effb Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qaction.cpp1
-rw-r--r--src/widgets/kernel/qactiongroup.cpp1
-rw-r--r--src/widgets/widgets/qmenu.cpp1
3 files changed, 3 insertions, 0 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 72d6fffefd..718ecffcc9 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -612,6 +612,7 @@ void QAction::setActionGroup(QActionGroup *group)
d->group = group;
if(group)
group->addAction(this);
+ d->sendDataChanged();
}
/*!
diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp
index 98ed132e95..7934ae1d90 100644
--- a/src/widgets/kernel/qactiongroup.cpp
+++ b/src/widgets/kernel/qactiongroup.cpp
@@ -196,6 +196,7 @@ QAction *QActionGroup::addAction(QAction* a)
if (oldGroup)
oldGroup->removeAction(a);
a->d_func()->group = this;
+ a->d_func()->sendDataChanged();
}
return a;
}
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index ae20159473..514cb1a8c9 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -3231,6 +3231,7 @@ static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *i
item->setShortcut(action->shortcut());
item->setCheckable(action->isCheckable());
item->setChecked(action->isChecked());
+ item->setHasExclusiveGroup(action->actionGroup() && action->actionGroup()->isExclusive());
item->setFont(action->font());
item->setRole((QPlatformMenuItem::MenuRole) action->menuRole());
item->setEnabled(action->isEnabled());