aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmlconnections.cpp7
-rw-r--r--src/qml/types/qqmldelegatemodel_p.h2
-rw-r--r--src/qml/types/qqmldelegatemodel_p_p.h2
-rw-r--r--src/qml/types/qqmlinstantiator.cpp27
-rw-r--r--src/qml/types/qqmlinstantiator_p_p.h4
-rw-r--r--src/qml/types/qqmlmodelsmodule.cpp4
-rw-r--r--src/qml/types/types.pri12
7 files changed, 43 insertions, 15 deletions
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index d1a7aa9b6f..2ae3df6ebb 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -289,13 +289,6 @@ void QQmlConnections::connectSignals()
signal->setEnabled(d->enabled);
auto f = d->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex];
-
- // If the function is marked as having a nested function, then the user wrote:
- // onSomeSignal: function() { /*....*/ }
- // So take that nested function:
- if (auto closure = f->nestedFunction())
- f = closure;
-
QQmlBoundSignalExpression *expression =
ctxtdata ? new QQmlBoundSignalExpression(target, signalIndex, ctxtdata, this, f)
: nullptr;
diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h
index 439d5c9d37..707aaeaa4b 100644
--- a/src/qml/types/qqmldelegatemodel_p.h
+++ b/src/qml/types/qqmldelegatemodel_p.h
@@ -62,6 +62,8 @@
#include <private/qv8engine_p.h>
#include <private/qqmlglobal_p.h>
+QT_REQUIRE_CONFIG(qml_delegate_model);
+
QT_BEGIN_NAMESPACE
class QQmlChangeSet;
diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h
index 9f1c9d31a4..42481be34f 100644
--- a/src/qml/types/qqmldelegatemodel_p_p.h
+++ b/src/qml/types/qqmldelegatemodel_p_p.h
@@ -60,6 +60,8 @@
// We mean it.
//
+QT_REQUIRE_CONFIG(qml_delegate_model);
+
QT_BEGIN_NAMESPACE
typedef QQmlListCompositor Compositor;
diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp
index 213bef7879..030758fa3b 100644
--- a/src/qml/types/qqmlinstantiator.cpp
+++ b/src/qml/types/qqmlinstantiator.cpp
@@ -44,7 +44,9 @@
#include <QtQml/QQmlInfo>
#include <QtQml/QQmlError>
#include <QtQml/private/qqmlobjectmodel_p.h>
+#if QT_CONFIG(qml_delegate_model)
#include <QtQml/private/qqmldelegatemodel_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -53,7 +55,9 @@ QQmlInstantiatorPrivate::QQmlInstantiatorPrivate()
, effectiveReset(false)
, active(true)
, async(false)
+#if QT_CONFIG(qml_delegate_model)
, ownModel(false)
+#endif
, requestedIndex(-1)
, model(QVariant(1))
, instanceModel(nullptr)
@@ -198,6 +202,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
q->countChanged();
}
+#if QT_CONFIG(qml_delegate_model)
void QQmlInstantiatorPrivate::makeModel()
{
Q_Q(QQmlInstantiator);
@@ -209,6 +214,7 @@ void QQmlInstantiatorPrivate::makeModel()
if (componentComplete)
delegateModel->componentComplete();
}
+#endif
/*!
@@ -349,6 +355,7 @@ void QQmlInstantiator::setDelegate(QQmlComponent* c)
d->delegate = c;
emit delegateChanged();
+#if QT_CONFIG(qml_delegate_model)
if (!d->ownModel)
return;
@@ -356,6 +363,7 @@ void QQmlInstantiator::setDelegate(QQmlComponent* c)
dModel->setDelegate(c);
if (d->componentComplete)
d->regenerate();
+#endif
}
/*!
@@ -398,12 +406,15 @@ void QQmlInstantiator::setModel(const QVariant &v)
QObject *object = qvariant_cast<QObject*>(v);
QQmlInstanceModel *vim = nullptr;
if (object && (vim = qobject_cast<QQmlInstanceModel *>(object))) {
+#if QT_CONFIG(qml_delegate_model)
if (d->ownModel) {
delete d->instanceModel;
prevModel = nullptr;
d->ownModel = false;
}
+#endif
d->instanceModel = vim;
+#if QT_CONFIG(qml_delegate_model)
} else if (v != QVariant(0)){
if (!d->ownModel)
d->makeModel();
@@ -413,6 +424,7 @@ void QQmlInstantiator::setModel(const QVariant &v)
dataModel->setModel(v);
d->effectiveReset = false;
}
+#endif
}
if (d->instanceModel != prevModel) {
@@ -423,10 +435,12 @@ void QQmlInstantiator::setModel(const QVariant &v)
//disconnect(prevModel, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*)));
}
- connect(d->instanceModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)),
- this, SLOT(_q_modelUpdated(QQmlChangeSet,bool)));
- connect(d->instanceModel, SIGNAL(createdItem(int,QObject*)), this, SLOT(_q_createdItem(int,QObject*)));
- //connect(d->instanceModel, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*)));
+ if (d->instanceModel) {
+ connect(d->instanceModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)),
+ this, SLOT(_q_modelUpdated(QQmlChangeSet,bool)));
+ connect(d->instanceModel, SIGNAL(createdItem(int,QObject*)), this, SLOT(_q_createdItem(int,QObject*)));
+ //connect(d->instanceModel, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*)));
+ }
}
d->regenerate();
@@ -476,10 +490,13 @@ void QQmlInstantiator::componentComplete()
{
Q_D(QQmlInstantiator);
d->componentComplete = true;
+#if QT_CONFIG(qml_delegate_model)
if (d->ownModel) {
static_cast<QQmlDelegateModel*>(d->instanceModel)->componentComplete();
d->regenerate();
- } else {
+ } else
+#endif
+ {
QVariant realModel = d->model;
d->model = QVariant(0);
setModel(realModel); //If realModel == d->model this won't do anything, but that's fine since the model's 0
diff --git a/src/qml/types/qqmlinstantiator_p_p.h b/src/qml/types/qqmlinstantiator_p_p.h
index 9edaecf7a8..a5a4d1a32d 100644
--- a/src/qml/types/qqmlinstantiator_p_p.h
+++ b/src/qml/types/qqmlinstantiator_p_p.h
@@ -69,7 +69,9 @@ public:
void clear();
void regenerate();
+#if QT_CONFIG(qml_delegate_model)
void makeModel();
+#endif
void _q_createdItem(int, QObject *);
void _q_modelUpdated(const QQmlChangeSet &, bool);
QObject *modelObject(int index, bool async);
@@ -78,7 +80,9 @@ public:
bool effectiveReset:1;
bool active:1;
bool async:1;
+#if QT_CONFIG(qml_delegate_model)
bool ownModel:1;
+#endif
int requestedIndex;
QVariant model;
QQmlInstanceModel *instanceModel;
diff --git a/src/qml/types/qqmlmodelsmodule.cpp b/src/qml/types/qqmlmodelsmodule.cpp
index 872d7c059f..d9756704d1 100644
--- a/src/qml/types/qqmlmodelsmodule.cpp
+++ b/src/qml/types/qqmlmodelsmodule.cpp
@@ -42,7 +42,9 @@
#if QT_CONFIG(qml_list_model)
#include <private/qqmllistmodel_p.h>
#endif
+#if QT_CONFIG(qml_delegate_model)
#include <private/qqmldelegatemodel_p.h>
+#endif
#include <private/qqmlobjectmodel_p.h>
QT_BEGIN_NAMESPACE
@@ -55,9 +57,11 @@ void QQmlModelsModule::defineModule()
qmlRegisterType<QQmlListElement>(uri, 2, 1, "ListElement");
qmlRegisterCustomType<QQmlListModel>(uri, 2, 1, "ListModel", new QQmlListModelParser);
#endif
+#if QT_CONFIG(qml_delegate_model)
qmlRegisterType<QQmlDelegateModel>(uri, 2, 1, "DelegateModel");
qmlRegisterType<QQmlDelegateModel,12>(uri, 2, 9, "DelegateModel");
qmlRegisterType<QQmlDelegateModelGroup>(uri, 2, 1, "DelegateModelGroup");
+#endif
qmlRegisterType<QQmlObjectModel>(uri, 2, 1, "ObjectModel");
qmlRegisterType<QQmlObjectModel,3>(uri, 2, 3, "ObjectModel");
diff --git a/src/qml/types/types.pri b/src/qml/types/types.pri
index 25b231f954..5d75759281 100644
--- a/src/qml/types/types.pri
+++ b/src/qml/types/types.pri
@@ -1,7 +1,6 @@
SOURCES += \
$$PWD/qqmlbind.cpp \
$$PWD/qqmlconnections.cpp \
- $$PWD/qqmldelegatemodel.cpp \
$$PWD/qqmlmodelsmodule.cpp \
$$PWD/qqmlmodelindexvaluetype.cpp \
$$PWD/qqmlobjectmodel.cpp \
@@ -12,8 +11,6 @@ SOURCES += \
HEADERS += \
$$PWD/qqmlbind_p.h \
$$PWD/qqmlconnections_p.h \
- $$PWD/qqmldelegatemodel_p.h \
- $$PWD/qqmldelegatemodel_p_p.h \
$$PWD/qqmlmodelsmodule_p.h \
$$PWD/qqmlmodelindexvaluetype_p.h \
$$PWD/qqmlobjectmodel_p.h \
@@ -33,6 +30,15 @@ qtConfig(qml-list-model) {
$$PWD/qqmllistmodelworkeragent_p.h
}
+qtConfig(qml-delegate-model) {
+ SOURCES += \
+ $$PWD/qqmldelegatemodel.cpp
+
+ HEADERS += \
+ $$PWD/qqmldelegatemodel_p.h \
+ $$PWD/qqmldelegatemodel_p_p.h
+}
+
qtConfig(qml-animation) {
SOURCES += \
$$PWD/qqmltimer.cpp