aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel/src
diff options
context:
space:
mode:
Diffstat (limited to 'libqmenumodel/src')
-rw-r--r--libqmenumodel/src/qmenumodel.cpp17
-rw-r--r--libqmenumodel/src/qmenumodel.h2
2 files changed, 12 insertions, 7 deletions
diff --git a/libqmenumodel/src/qmenumodel.cpp b/libqmenumodel/src/qmenumodel.cpp
index b18cc45..51b6863 100644
--- a/libqmenumodel/src/qmenumodel.cpp
+++ b/libqmenumodel/src/qmenumodel.cpp
@@ -185,11 +185,17 @@ QVariant QMenuModel::data(const QModelIndex &index, int role) const
attribute = getStringAttribute(index, G_MENU_ATTRIBUTE_LABEL);
break;
case LinkSection:
- attribute = getLink(index, G_MENU_LINK_SECTION);
+ {
+ QMenuModel *self = const_cast<QMenuModel*>(this);
+ attribute = self->getLink(index, G_MENU_LINK_SECTION);
break;
+ }
case LinkSubMenu:
- attribute = getLink(index, G_MENU_LINK_SUBMENU);
+ {
+ QMenuModel *self = const_cast<QMenuModel*>(this);
+ attribute = self->getLink(index, G_MENU_LINK_SUBMENU);
break;
+ }
case Extra:
attribute = getExtraProperties(index);
break;
@@ -235,7 +241,7 @@ QVariant QMenuModel::getStringAttribute(const QModelIndex &index,
/*! \internal */
QVariant QMenuModel::getLink(const QModelIndex &index,
- const QString &linkName) const
+ const QString &linkName)
{
GMenuModel *link;
@@ -254,9 +260,8 @@ QVariant QMenuModel::getLink(const QModelIndex &index,
}
if (result == 0) {
- QMenuModel *self = const_cast<QMenuModel*>(this);
- result = new QMenuModel(link, self);
- self->m_cache << new CacheData(result, index.row());
+ result = new QMenuModel(link, this);
+ m_cache << new CacheData(result, index.row());
}
g_object_unref(link);
diff --git a/libqmenumodel/src/qmenumodel.h b/libqmenumodel/src/qmenumodel.h
index de49368..e0f69f2 100644
--- a/libqmenumodel/src/qmenumodel.h
+++ b/libqmenumodel/src/qmenumodel.h
@@ -71,7 +71,7 @@ private:
guint m_signalChangedId;
QVariant getStringAttribute(const QModelIndex &index, const QString &attribute) const;
- QVariant getLink(const QModelIndex &index, const QString &linkName) const;
+ QVariant getLink(const QModelIndex &index, const QString &linkName);
QVariant getExtraProperties(const QModelIndex &index) const;
QString parseExtraPropertyName(const QString &name) const;
void clearModel();