From 2a79f125197e4e900793b7aea584b87113e0e9e9 Mon Sep 17 00:00:00 2001 From: Luciano Montanaro Date: Wed, 20 Nov 2013 22:51:18 +0100 Subject: [PATCH] Fix Qt4 compilation --- application/view.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/application/view.cpp b/application/view.cpp index 1236dcc..e4b1622 100644 --- a/application/view.cpp +++ b/application/view.cpp @@ -22,9 +22,9 @@ Boston, MA 02110-1301, USA. #include "view.h" #include "settings.h" #include "dataprovider.h" -#include "stationlistmodel.h" -#include "stationlistproxymodel.h" #include "stationschedulemodel.h" +#include "stationlistproxymodel.h" +#include "stationlistmodel.h" #include #include @@ -65,6 +65,11 @@ static QString trueFilePath(const QString &path) #endif } +Q_DECLARE_METATYPE(QList< QPersistentModelIndex >) +#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) +Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint) +#endif + #if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) View::View(QWindow *parent) : QQuickView(parent), @@ -82,11 +87,15 @@ View::View(QWidget *parent) : stationListProxyModel->setSourceModel(stationListModel); /* Types to be made accessible to QML */ - qRegisterMetaType("QModelIndex"); - qmlRegisterType("net.cirulla.quandoparte", 1, 0, "Settings"); - qmlRegisterType( +#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) + qRegisterMetaType< QModelIndex >(); + qRegisterMetaType< QList< QPersistentModelIndex > >(); + qRegisterMetaType< QAbstractItemModel::LayoutChangeHint>(); +#endif + qmlRegisterType< Settings >("net.cirulla.quandoparte", 1, 0, "Settings"); + qmlRegisterType< StationListProxyModel >( "net.cirulla.quandoparte", 1, 0, "StationListProxyModel"); - qmlRegisterType( + qmlRegisterType< StationScheduleModel >( "net.cirulla.quandoparte", 1, 0, "StationScheduleModel"); #if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) -- 1.7.9.5