aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2013-01-14 10:01:57 -0300
committerRenato Araujo Oliveira Filho <renato.filho@canonical.com>2013-01-14 10:01:57 -0300
commit00bd7d43ec3b7af1e5d4534fa74e1cf6e004bd56 (patch)
tree5678eb9b299cd80606552ae339315c8416309119 /libqmenumodel
parent6a56cd82d5cfee618ec0485688d30ecbcfcde174 (diff)
downloadqmenumodel-00bd7d43ec3b7af1e5d4534fa74e1cf6e004bd56.tar.gz
qmenumodel-00bd7d43ec3b7af1e5d4534fa74e1cf6e004bd56.tar.bz2
qmenumodel-00bd7d43ec3b7af1e5d4534fa74e1cf6e004bd56.zip
Used 'invokeMethod' to call slot, to make the code simple.
Diffstat (limited to 'libqmenumodel')
-rw-r--r--libqmenumodel/src/menunode.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/libqmenumodel/src/menunode.cpp b/libqmenumodel/src/menunode.cpp
index 3d8c5fd..69b0169 100644
--- a/libqmenumodel/src/menunode.cpp
+++ b/libqmenumodel/src/menunode.cpp
@@ -242,19 +242,15 @@ void MenuNode::onItemsChanged(GMenuModel *model, gint position, gint removed, gi
self->m_currentOpAdded = added;
self->m_currentOpRemoved = removed;
- if (self->m_listener) {
- const QMetaObject *mobj = self->m_listener->metaObject();
- int slotIndex = mobj->indexOfSlot(QMetaObject::normalizedSignature("onItemsChanged(MenuNode*, int, int, int)"));
- if (slotIndex > -1) {
- QMetaMethod slot = mobj->method(slotIndex);
- slot.invoke(self->m_listener,
- Q_ARG(MenuNode*, self),
- Q_ARG(int, position),
- Q_ARG(int, removed),
- Q_ARG(int, added));
- } else {
- qWarning() << "Slot 'onItemsChanged(MenuNode*, int, int, int)' not found in" << self->m_listener;
- }
+ const QMetaObject *mobj = self->m_listener->metaObject();
+ if (!mobj->invokeMethod(self->m_listener,
+ "onItemsChanged(MenuNode*, int, int, int)",
+ Q_ARG(MenuNode*, self),
+ Q_ARG(int, position),
+ Q_ARG(int, removed),
+ Q_ARG(int, added)))
+ {
+ qWarning() << "Slot 'onItemsChanged(MenuNode*, int, int, int)' not found in" << self->m_listener;
}
self->commitOperation();
}