aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels/qqmlmodelsmodule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmlmodels/qqmlmodelsmodule.cpp')
-rw-r--r--src/qmlmodels/qqmlmodelsmodule.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/qmlmodels/qqmlmodelsmodule.cpp b/src/qmlmodels/qqmlmodelsmodule.cpp
index 989fec9b7d..2db5dd834f 100644
--- a/src/qmlmodels/qqmlmodelsmodule.cpp
+++ b/src/qmlmodels/qqmlmodelsmodule.cpp
@@ -39,19 +39,26 @@
#include "qqmlmodelsmodule_p.h"
#include <private/qtqmlmodelsglobal_p.h>
+
+#if QT_CONFIG(itemmodel)
#include <QtCore/qitemselectionmodel.h>
+#endif
#if QT_CONFIG(qml_list_model)
#include <private/qqmllistmodel_p.h>
#endif
#if QT_CONFIG(qml_delegate_model)
#include <private/qqmldelegatemodel_p.h>
#include <private/qqmldelegatecomponent_p.h>
+#include <private/qquickpackage_p.h>
#endif
+#if QT_CONFIG(qml_object_model)
#include <private/qqmlobjectmodel_p.h>
+#include <private/qqmlinstantiator_p.h>
+#endif
+#if QT_CONFIG(qml_table_model)
#include <private/qqmltablemodel_p.h>
#include <private/qqmltablemodelcolumn_p.h>
-#include <private/qqmlinstantiator_p.h>
-#include <private/qquickpackage_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -60,8 +67,10 @@ QT_BEGIN_NAMESPACE
void QQmlModelsModule::registerQmlTypes()
{
// Don't add anything here. These are only for backwards compatibility.
+#if QT_CONFIG(qml_object_model)
qmlRegisterType<QQmlInstantiator>("QtQml", 2, 1, "Instantiator"); // Only available in >= 2.1
qmlRegisterType<QQmlInstanceModel>();
+#endif
}
void QQmlModelsModule::registerQuickTypes()
@@ -70,18 +79,20 @@ void QQmlModelsModule::registerQuickTypes()
const char uri[] = "QtQuick";
+#if QT_CONFIG(qml_object_model)
qmlRegisterType<QQmlInstantiator>(uri, 2, 1, "Instantiator");
qmlRegisterType<QQmlInstanceModel>();
+ qmlRegisterType<QQmlObjectModel>(uri, 2, 0, "VisualItemModel");
+#endif
#if QT_CONFIG(qml_list_model)
qmlRegisterType<QQmlListElement>(uri, 2, 0, "ListElement");
qmlRegisterCustomType<QQmlListModel>(uri, 2, 0, "ListModel", new QQmlListModelParser);
#endif
- qmlRegisterType<QQuickPackage>(uri, 2, 0, "Package");
#if QT_CONFIG(qml_delegate_model)
qmlRegisterType<QQmlDelegateModel>(uri, 2, 0, "VisualDataModel");
qmlRegisterType<QQmlDelegateModelGroup>(uri, 2, 0, "VisualDataGroup");
+ qmlRegisterType<QQuickPackage>(uri, 2, 0, "Package");
#endif
- qmlRegisterType<QQmlObjectModel>(uri, 2, 0, "VisualItemModel");
}
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@@ -97,15 +108,17 @@ void QQmlModelsModule::defineModule()
#if QT_CONFIG(qml_delegate_model)
qmlRegisterType<QQmlDelegateModel>(uri, 2, 1, "DelegateModel");
qmlRegisterType<QQmlDelegateModelGroup>(uri, 2, 1, "DelegateModelGroup");
+ qmlRegisterType<QQuickPackage>(uri, 2, 14, "Package");
#endif
+#if QT_CONFIG(qml_object_model)
qmlRegisterType<QQmlObjectModel>(uri, 2, 1, "ObjectModel");
qmlRegisterType<QQmlObjectModel,3>(uri, 2, 3, "ObjectModel");
-
- qmlRegisterType<QItemSelectionModel>(uri, 2, 2, "ItemSelectionModel");
-
- qmlRegisterType<QQuickPackage>(uri, 2, 14, "Package");
qmlRegisterType<QQmlInstantiator>(uri, 2, 14, "Instantiator");
qmlRegisterType<QQmlInstanceModel>();
+#endif
+#if QT_CONFIG(itemmodel)
+ qmlRegisterType<QItemSelectionModel>(uri, 2, 2, "ItemSelectionModel");
+#endif
}
void QQmlModelsModule::defineLabsModule()
@@ -117,8 +130,10 @@ void QQmlModelsModule::defineLabsModule()
qmlRegisterType<QQmlDelegateChooser>(uri, 1, 0, "DelegateChooser");
qmlRegisterType<QQmlDelegateChoice>(uri, 1, 0, "DelegateChoice");
#endif
+#if QT_CONFIG(qml_table_model)
qmlRegisterType<QQmlTableModel>(uri, 1, 0, "TableModel");
qmlRegisterType<QQmlTableModelColumn>(uri, 1, 0, "TableModelColumn");
+#endif
}
QT_END_NAMESPACE