[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:04:30 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=da7beb1
The following commit has been merged in the master branch:
commit da7beb1696a06d37fa35838660434685df26c181
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Fri Apr 1 15:55:53 2011 +0100
Add AccountsModelItem* and ContactModelItem* as QMetaTypes, this allows for fewer casts when storing and retreiving from QVariant.
---
models/accounts-model-item.cpp | 4 +---
models/accounts-model-item.h | 4 ++++
models/contact-model-item.cpp | 6 ++----
models/contact-model-item.h | 7 ++++++-
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/models/accounts-model-item.cpp b/models/accounts-model-item.cpp
index 536e513..4217942 100644
--- a/models/accounts-model-item.cpp
+++ b/models/accounts-model-item.cpp
@@ -137,9 +137,7 @@ QVariant AccountsModelItem::data(int role) const
{
switch (role) {
case AccountsModel::ItemRole:
- return QVariant::fromValue(
- const_cast<QObject *>(
- static_cast<const QObject *>(this)));
+ return QVariant::fromValue((AccountsModelItem*)this);
case AccountsModel::IdRole:
return mPriv->mAccount->uniqueIdentifier();
case AccountsModel::AvatarRole:
diff --git a/models/accounts-model-item.h b/models/accounts-model-item.h
index 2168775..65e1c82 100644
--- a/models/accounts-model-item.h
+++ b/models/accounts-model-item.h
@@ -27,6 +27,8 @@
#include <TelepathyQt4/Contact>
#include <TelepathyQt4/Types>
+#include <QtCore/QVariant> //needed for declare metatype
+
#include "tree-node.h"
class AccountsModelItem : public TreeNode
@@ -72,4 +74,6 @@ private:
Private *mPriv;
};
+Q_DECLARE_METATYPE(AccountsModelItem*);
+
#endif // TELEPATHY_ACCOUNTS_MODEL_ITEM_H
diff --git a/models/contact-model-item.cpp b/models/contact-model-item.cpp
index b24abe3..e77b8ed 100644
--- a/models/contact-model-item.cpp
+++ b/models/contact-model-item.cpp
@@ -85,9 +85,7 @@ QVariant ContactModelItem::data(int role) const
{
switch (role) {
case AccountsModel::ItemRole:
- return QVariant::fromValue(
- const_cast<QObject *>(
- static_cast<const QObject *>(this)));
+ return QVariant::fromValue((ContactModelItem*)this);
case AccountsModel::IdRole:
return mPriv->mContact->id();
case Qt::DisplayRole:
@@ -173,4 +171,4 @@ void ContactModelItem::onChanged()
Tp::ContactPtr ContactModelItem::contact() const
{
return mPriv->mContact;
-}
\ No newline at end of file
+}
diff --git a/models/contact-model-item.h b/models/contact-model-item.h
index 2bf3f51..eceb054 100644
--- a/models/contact-model-item.h
+++ b/models/contact-model-item.h
@@ -25,6 +25,8 @@
#include <TelepathyQt4/Types>
+#include <QtCore/QVariant> //needed for declare metatype
+
#include "tree-node.h"
class ContactModelItem : public TreeNode
@@ -50,4 +52,7 @@ private:
Private *mPriv;
};
-#endif // TELEPATHY_CONTACT_MODEL_ITEM_H
\ No newline at end of file
+Q_DECLARE_METATYPE(ContactModelItem*);
+
+
+#endif // TELEPATHY_CONTACT_MODEL_ITEM_H
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list