diff --git a/declarativeimports/core/corebindingsplugin.cpp b/declarativeimports/core/corebindingsplugin.cpp index f08d8b36d..92d0befba 100644 --- a/declarativeimports/core/corebindingsplugin.cpp +++ b/declarativeimports/core/corebindingsplugin.cpp @@ -84,6 +84,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri) qRegisterMetaType("Service"); qmlRegisterInterface("ServiceJob"); qRegisterMetaType("ServiceJob"); + qmlRegisterType(); /*qmlRegisterInterface("DataSource"); qRegisterMetaType("DataSource");*/ diff --git a/declarativeimports/core/datamodel.cpp b/declarativeimports/core/datamodel.cpp index b0c18a6fc..c1ed999fc 100644 --- a/declarativeimports/core/datamodel.cpp +++ b/declarativeimports/core/datamodel.cpp @@ -65,21 +65,12 @@ int SortFilterModel::roleNameToId(const QString &name) return m_roleIds.value(name); } -void SortFilterModel::setModel(QObject *source) +void SortFilterModel::setModel(QAbstractItemModel* model) { - if (source == sourceModel()) { + if (model == sourceModel()) { return; } - QAbstractItemModel *model = 0; - if (source) { - model = qobject_cast(source); - if (!model) { - kWarning() << "Error: QAbstractItemModel type expected"; - return; - } - } - if (sourceModel()) { disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(syncRoleNames())); } diff --git a/declarativeimports/core/datamodel.h b/declarativeimports/core/datamodel.h index 803a3e4c4..0943b6827 100644 --- a/declarativeimports/core/datamodel.h +++ b/declarativeimports/core/datamodel.h @@ -41,7 +41,7 @@ class SortFilterModel : public QSortFilterProxyModel /** * The source model of this sorting proxy model. It has to inherit QAbstractItemModel (ListModel is not supported) */ - Q_PROPERTY(QObject *sourceModel READ sourceModel WRITE setModel NOTIFY sourceModelChanged) + Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel WRITE setModel NOTIFY sourceModelChanged) /** * The regular expression for the filter, only items with their filterRole matching filterRegExp will be displayed @@ -74,8 +74,7 @@ public: SortFilterModel(QObject* parent=0); ~SortFilterModel(); - //FIXME: find a way to make QML understnd QAbstractItemModel - void setModel(QObject *source); + void setModel(QAbstractItemModel *source); void setFilterRegExp(const QString &exp); QString filterRegExp() const;