Support modes with context menus.

If modes provide a QMenu, a little arrow is shown next to the mode icon.
If the user clicks there, the menu is shown instead of changing the
mode.

Limitations: Modes need to provide some QMenu instance already when they
are added to the object pool. Setting or removing the menu later will
not update the UI.

Change-Id: Ic4ef709e6200afcff14f41054a5dd98c37b0b849
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Eike Ziller
2016-05-19 11:50:45 +02:00
parent d984a83611
commit 685bc2cca1
5 changed files with 63 additions and 35 deletions

View File

@@ -32,6 +32,12 @@ IMode::IMode(QObject *parent)
{
}
IMode::~IMode()
{
if (m_menu)
delete m_menu;
}
void IMode::setEnabled(bool enabled)
{
if (m_isEnabled == enabled)