summaryrefslogtreecommitdiff
path: root/src/controls/qtmenuitemcontainer_p.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-03-20 15:22:08 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-20 17:16:42 +0100
commitbdc872955933aaf93cdd434cc17cc29630600b88 (patch)
treea5c40c6bb82a30f7e1c31dde8ce3ec33ac61ee1a /src/controls/qtmenuitemcontainer_p.h
parent8d5e9969b54f80e646cc2b9fcc92e1f36da6d128 (diff)
downloadqtquickcontrols-bdc872955933aaf93cdd434cc17cc29630600b88.tar.gz
Menu: Update API, auto-tests
Add 'type' property to QtMenuBase (not exposed to QML explicitly, but is the base class for all things menu). Useful to inspect menu items after creation, for instance. Also, Menu gets addSeparator() and addMenu() functions. Since the Iterator type has been merged to QML, tst_menu now uses it. Change-Id: I4a2f43ecce6671885e523d720e4e1315eca8616e Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls/qtmenuitemcontainer_p.h')
-rw-r--r--src/controls/qtmenuitemcontainer_p.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/controls/qtmenuitemcontainer_p.h b/src/controls/qtmenuitemcontainer_p.h
index b4168b74..2dbad6c6 100644
--- a/src/controls/qtmenuitemcontainer_p.h
+++ b/src/controls/qtmenuitemcontainer_p.h
@@ -75,7 +75,7 @@ public:
m_menuItems.removeOne(item);
}
- const QList<QtMenuBase *> &items()
+ const QList<QPointer<QtMenuBase> > &items()
{
return m_menuItems;
}
@@ -84,13 +84,15 @@ public:
{
while (!m_menuItems.empty()) {
QtMenuBase *item = m_menuItems.takeFirst();
- item->setParentMenu(0);
- item->setContainer(0);
+ if (item) {
+ item->setParentMenu(0);
+ item->setContainer(0);
+ }
}
}
private:
- QList<QtMenuBase *> m_menuItems;
+ QList<QPointer<QtMenuBase> > m_menuItems;
};
QT_END_NAMESPACE