aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel
diff options
context:
space:
mode:
authorAlberto Mardegan <alberto.mardegan@canonical.com>2013-06-06 12:27:08 +0000
committerTarmac <>2013-06-06 12:27:08 +0000
commit2c5855ca07be8957e31d19f0866280d12902b6b6 (patch)
treeefd39ec072b094f38e220e9dfdc24257135e2f73 /libqmenumodel
parent885710fa1a01644cdc736074a06aef0616f06abe (diff)
parent8157af28188959d105f13657886517ea90fcb37e (diff)
downloadqmenumodel-2c5855ca07be8957e31d19f0866280d12902b6b6.tar.gz
qmenumodel-2c5855ca07be8957e31d19f0866280d12902b6b6.tar.bz2
qmenumodel-2c5855ca07be8957e31d19f0866280d12902b6b6.zip
Use invalid index as root index
When emitting the rowsInserted signal for top-level items, use an invalid QModelIndex as parent. Approved by Renato Araujo Oliveira Filho, PS Jenkins bot.
Diffstat (limited to 'libqmenumodel')
-rw-r--r--libqmenumodel/src/qmenumodel.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libqmenumodel/src/qmenumodel.cpp b/libqmenumodel/src/qmenumodel.cpp
index 5faeb43..9bc9e02 100644
--- a/libqmenumodel/src/qmenumodel.cpp
+++ b/libqmenumodel/src/qmenumodel.cpp
@@ -252,6 +252,9 @@ void QMenuModel::onItemsChanged(MenuNode *node,
/*! \internal */
QModelIndex QMenuModel::indexFromNode(MenuNode *node) const
{
+ if (node == m_root) {
+ return QModelIndex();
+ }
return createIndex(node->position(), 0, node);
}