iOS: don't show separator in native menus
There might be menu types later that should show them, but for now we just hide them. Change-Id: Iac31e3204d8dcfd5beb5a2d5a372478ca811776c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
parent
f1a8d7dc9b
commit
28b5038d1b
@ -64,7 +64,7 @@ public:
|
||||
void setIcon(const QIcon &) Q_DECL_OVERRIDE {}
|
||||
void setMenu(QPlatformMenu *) Q_DECL_OVERRIDE {}
|
||||
void setVisible(bool isVisible) Q_DECL_OVERRIDE;
|
||||
void setIsSeparator(bool) Q_DECL_OVERRIDE {}
|
||||
void setIsSeparator(bool) Q_DECL_OVERRIDE;
|
||||
void setFont(const QFont &) Q_DECL_OVERRIDE {}
|
||||
void setRole(MenuRole role) Q_DECL_OVERRIDE;
|
||||
void setCheckable(bool) Q_DECL_OVERRIDE {}
|
||||
@ -78,6 +78,7 @@ public:
|
||||
QString m_text;
|
||||
MenuRole m_role;
|
||||
bool m_enabled;
|
||||
bool m_separator;
|
||||
|
||||
private:
|
||||
QString removeMnemonics(const QString &original);
|
||||
|
@ -215,6 +215,7 @@ QIOSMenuItem::QIOSMenuItem()
|
||||
, m_text(QString())
|
||||
, m_role(MenuRole(0))
|
||||
, m_enabled(true)
|
||||
, m_separator(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -238,6 +239,11 @@ void QIOSMenuItem::setVisible(bool isVisible)
|
||||
m_visible = isVisible;
|
||||
}
|
||||
|
||||
void QIOSMenuItem::setIsSeparator(bool isSeparator)
|
||||
{
|
||||
m_separator = isSeparator;
|
||||
}
|
||||
|
||||
void QIOSMenuItem::setRole(QPlatformMenuItem::MenuRole role)
|
||||
{
|
||||
m_role = role;
|
||||
@ -487,7 +493,7 @@ QIOSMenuItemList QIOSMenu::visibleMenuItems() const
|
||||
|
||||
for (int i = visibleMenuItems.count() - 1; i >= 0; --i) {
|
||||
QIOSMenuItem *item = visibleMenuItems.at(i);
|
||||
if (!item->m_enabled || !item->m_visible)
|
||||
if (!item->m_enabled || !item->m_visible || item->m_separator)
|
||||
visibleMenuItems.removeAt(i);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user