aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel
diff options
context:
space:
mode:
authorAlberto Mardegan <alberto.mardegan@canonical.com>2013-05-20 14:20:58 +0300
committerAlberto Mardegan <alberto.mardegan@canonical.com>2013-05-20 14:20:58 +0300
commitc5bcb297490b44429997c9658d0afb12900cef42 (patch)
tree6b92627e7bf79736ad0bc2cae4677550405138c1 /libqmenumodel
parent885710fa1a01644cdc736074a06aef0616f06abe (diff)
downloadqmenumodel-c5bcb297490b44429997c9658d0afb12900cef42.tar.gz
qmenumodel-c5bcb297490b44429997c9658d0afb12900cef42.tar.bz2
qmenumodel-c5bcb297490b44429997c9658d0afb12900cef42.zip
Use invalid index as root index
When emitting the rowsInserted signal for top-level items, use an invalid QModelIndex as parent.
Diffstat (limited to 'libqmenumodel')
-rw-r--r--libqmenumodel/src/qmenumodel.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libqmenumodel/src/qmenumodel.cpp b/libqmenumodel/src/qmenumodel.cpp
index 5faeb43..ed2fd47 100644
--- a/libqmenumodel/src/qmenumodel.cpp
+++ b/libqmenumodel/src/qmenumodel.cpp
@@ -252,6 +252,7 @@ void QMenuModel::onItemsChanged(MenuNode *node,
/*! \internal */
QModelIndex QMenuModel::indexFromNode(MenuNode *node) const
{
+ if (node == m_root) return QModelIndex();
return createIndex(node->position(), 0, node);
}