From 45d16933c39ac30fdf88955649919647d036df6e Mon Sep 17 00:00:00 2001 From: oKcerG Date: Wed, 7 Sep 2016 23:25:13 +0200 Subject: [PATCH] Fix qmlRegisterType crash This fixes #7 --- qqmlsortfilterproxymodel.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/qqmlsortfilterproxymodel.cpp b/qqmlsortfilterproxymodel.cpp index 4a59adc..14fef51 100644 --- a/qqmlsortfilterproxymodel.cpp +++ b/qqmlsortfilterproxymodel.cpp @@ -247,11 +247,9 @@ QVariantMap QQmlSortFilterProxyModel::modelDataMap(const QModelIndex& modelIndex return map; } -struct QQmlSortFilterProxyModelRegisterHelper { - QQmlSortFilterProxyModelRegisterHelper() { - qmlRegisterType(); - qmlRegisterType("SortFilterProxyModel", 0, 1, "SortFilterProxyModel"); - } -}; +void registerQQmlSortFilterProxyModelTypes() { + qmlRegisterType(); + qmlRegisterType("SortFilterProxyModel", 0, 1, "SortFilterProxyModel"); +} -static QQmlSortFilterProxyModelRegisterHelper registerHelper; +Q_COREAPP_STARTUP_FUNCTION(registerQQmlSortFilterProxyModelTypes)