Mercurial > hg > svapp
changeset 426:03fd6990ab52 alignment_view
Open to show/hide icons in menus
author | Chris Cannam |
---|---|
date | Fri, 21 Nov 2014 10:36:44 +0000 |
parents | 5882462fa747 |
children | a67245dce0d4 |
files | framework/MainWindowBase.cpp framework/MainWindowBase.h |
diffstat | 2 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Thu Nov 20 17:17:45 2014 +0000 +++ b/framework/MainWindowBase.cpp Fri Nov 21 10:36:44 2014 +0000 @@ -156,6 +156,7 @@ m_initialDarkBackground(false), m_defaultFfwdRwdStep(2, 0), m_statusLabel(0), + m_iconsVisibleInMenus(true), m_menuShortcutMapper(0) { Profiler profiler("MainWindowBase::MainWindowBase"); @@ -305,12 +306,12 @@ } void -MainWindowBase::finaliseMenu(QMenu * -#ifdef Q_OS_MAC - menu -#endif - ) +MainWindowBase::finaliseMenu(QMenu *menu) { + foreach (QAction *a, menu->actions()) { + a->setIconVisibleInMenu(m_iconsVisibleInMenus); + } + #ifdef Q_OS_MAC // See https://bugreports.qt-project.org/browse/QTBUG-38256 and // our issue #890 http://code.soundsoftware.ac.uk/issues/890 --
--- a/framework/MainWindowBase.h Thu Nov 20 17:17:45 2014 +0000 +++ b/framework/MainWindowBase.h Fri Nov 21 10:36:44 2014 +0000 @@ -426,10 +426,14 @@ virtual void updatePositionStatusDisplays() const = 0; // Call this after setting up the menu bar, to fix up single-key - // shortcuts on OS/X + // shortcuts on OS/X and do any other platform-specific tidying virtual void finaliseMenus(); virtual void finaliseMenu(QMenu *); + // Call before finaliseMenus if you wish to have a say in this question + void setIconsVisibleInMenus(bool visible) { m_iconsVisibleInMenus = visible; } + bool m_iconsVisibleInMenus; + // Only used on OS/X to work around a Qt/Cocoa bug, see finaliseMenus QSignalMapper *m_menuShortcutMapper; QList<QShortcut *> m_appShortcuts;