aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp8
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h4
-rw-r--r--src/quicktemplates2/qquickaction.cpp17
-rw-r--r--src/quicktemplates2/qquickaction_p_p.h6
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp86
-rw-r--r--src/quicktemplates2/qquickdeferredexecute.cpp10
-rw-r--r--src/quicktemplates2/qquickpopup.cpp2
-rw-r--r--src/quicktemplates2/qquickpopupitem.cpp4
-rw-r--r--src/quicktemplates2/qquickstackelement.cpp6
9 files changed, 55 insertions, 88 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index 2099f2db..bb07d13e 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -44,7 +44,9 @@
#include <QtGui/qstylehints.h>
#include <QtGui/qguiapplication.h>
-#include <QtGui/private/qshortcutmap_p.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/private/qshortcutmap_p.h>
+#endif
#include <QtGui/private/qguiapplication_p.h>
#include <QtQuick/private/qquickevents_p_p.h>
#include <QtQml/qqmllist.h>
@@ -1015,8 +1017,8 @@ void QQuickAbstractButton::componentComplete()
bool QQuickAbstractButton::event(QEvent *event)
{
- Q_D(QQuickAbstractButton);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAbstractButton);
if (event->type() == QEvent::Shortcut) {
QShortcutEvent *se = static_cast<QShortcutEvent *>(event);
if (se->shortcutId() == d->shortcutId) {
@@ -1101,9 +1103,9 @@ void QQuickAbstractButton::timerEvent(QTimerEvent *event)
void QQuickAbstractButton::itemChange(ItemChange change, const ItemChangeData &value)
{
- Q_D(QQuickAbstractButton);
QQuickControl::itemChange(change, value);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAbstractButton);
if (change == ItemVisibleHasChanged) {
if (value.boolValue)
d->grabShortcut();
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
index 7394f115..8ad479e2 100644
--- a/src/quicktemplates2/qquickabstractbutton_p_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -50,7 +50,9 @@
#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
QT_BEGIN_NAMESPACE
diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp
index 9120db37..559c5fc3 100644
--- a/src/quicktemplates2/qquickaction.cpp
+++ b/src/quicktemplates2/qquickaction.cpp
@@ -40,7 +40,9 @@
#include "qquickshortcutcontext_p_p.h"
#include <QtGui/qevent.h>
-#include <QtGui/private/qshortcutmap_p.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/private/qshortcutmap_p.h>
+#endif
#include <QtGui/private/qguiapplication_p.h>
#include <QtQuick/private/qquickitem_p.h>
@@ -261,6 +263,8 @@ void QQuickActionPrivate::unregisterItem(QQuickItem *item)
delete entry;
updateDefaultShortcutEntry();
+#else
+ Q_UNUSED(item);
#endif
}
@@ -277,6 +281,8 @@ void QQuickActionPrivate::itemVisibilityChanged(QQuickItem *item)
entry->ungrab();
updateDefaultShortcutEntry();
+#else
+ Q_UNUSED(item);
#endif
}
@@ -332,8 +338,8 @@ void QQuickActionPrivate::updateDefaultShortcutEntry()
QQuickAction::QQuickAction(QObject *parent)
: QObject(*(new QQuickActionPrivate), parent)
{
- Q_D(QQuickAction);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAction);
d->defaultShortcutEntry = new QQuickActionPrivate::ShortcutEntry(this);
#endif
}
@@ -554,8 +560,8 @@ void QQuickActionPrivate::trigger(QObject* source, bool doToggle)
bool QQuickAction::event(QEvent *event)
{
- Q_D(QQuickAction);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAction);
if (event->type() == QEvent::Shortcut)
return d->handleShortcutEvent(this, static_cast<QShortcutEvent *>(event));
#endif
@@ -564,10 +570,13 @@ bool QQuickAction::event(QEvent *event)
bool QQuickAction::eventFilter(QObject *object, QEvent *event)
{
- Q_D(QQuickAction);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAction);
if (event->type() == QEvent::Shortcut)
return d->handleShortcutEvent(object, static_cast<QShortcutEvent *>(event));
+#else
+ Q_UNUSED(object);
+ Q_UNUSED(event);
#endif
return false;
}
diff --git a/src/quicktemplates2/qquickaction_p_p.h b/src/quicktemplates2/qquickaction_p_p.h
index 7c70bab1..252b0075 100644
--- a/src/quicktemplates2/qquickaction_p_p.h
+++ b/src/quicktemplates2/qquickaction_p_p.h
@@ -51,7 +51,9 @@
#include <QtCore/private/qobject_p.h>
#include <QtCore/qvariant.h>
#include <QtCore/qstring.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#include <QtQuick/private/qquickitemchangelistener_p.h>
QT_BEGIN_NAMESPACE
@@ -119,8 +121,8 @@ public:
bool checkable = false;
QString text;
QQuickIcon icon;
- QKeySequence keySequence;
#if QT_CONFIG(shortcut)
+ QKeySequence keySequence;
QVariant vshortcut;
ShortcutEntry *defaultShortcutEntry = nullptr;
QVector<ShortcutEntry *> shortcutEntries;
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 21eecfe1..6b03bbf2 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -232,13 +232,9 @@ public:
void updateEditText();
void updateCurrentText();
void updateCurrentValue();
- void updateCurrentText(bool hasDelegateModelObject);
- void updateCurrentValue(bool hasDelegateModelObject);
void updateCurrentTextAndValue();
bool isValidIndex(int index) const;
- QString fastTextAt(int index) const;
- QVariant fastValueAt(int index) const;
void acceptInput();
QString tryComplete(const QString &inputText);
@@ -441,34 +437,10 @@ void QQuickComboBoxPrivate::updateEditText()
q->setEditText(text);
}
-// We have these two rather than just using default arguments
-// because QObjectPrivate::connect() doesn't accept lambdas.
void QQuickComboBoxPrivate::updateCurrentText()
{
- updateCurrentText(false);
-}
-
-void QQuickComboBoxPrivate::updateCurrentValue()
-{
- updateCurrentValue(false);
-}
-
-void QQuickComboBoxPrivate::updateCurrentText(bool hasDelegateModelObject)
-{
Q_Q(QQuickComboBox);
- QString text;
- // If a delegate model object was passed in, it means the calling code
- // has decided to reuse it for several function calls to speed things up.
- // So, use the faster (private) version in that case.
- // For other cases, we use the version that creates the delegate model object
- // itself in order to have neater, more convenient calling code.
- if (isValidIndex(currentIndex)) {
- if (hasDelegateModelObject)
- text = fastTextAt(currentIndex);
- else
- text = q->textAt(currentIndex);
- }
-
+ const QString text = q->textAt(currentIndex);
if (currentText != text) {
currentText = text;
if (!hasDisplayText)
@@ -483,19 +455,10 @@ void QQuickComboBoxPrivate::updateCurrentText(bool hasDelegateModelObject)
q->setEditText(currentText);
}
-void QQuickComboBoxPrivate::updateCurrentValue(bool hasDelegateModelObject)
+void QQuickComboBoxPrivate::updateCurrentValue()
{
Q_Q(QQuickComboBox);
- QVariant value;
- // If a delegate model object was passed in, it means the calling code
- // has decided to reuse it for several function calls to speed things up.
- // So, use the faster (private) version in that case.
- if (isValidIndex(currentIndex)) {
- if (hasDelegateModelObject)
- value = fastValueAt(currentIndex);
- else
- value = q->valueAt(currentIndex);
- }
+ const QVariant value = q->valueAt(currentIndex);
if (currentValue == value)
return;
@@ -505,15 +468,8 @@ void QQuickComboBoxPrivate::updateCurrentValue(bool hasDelegateModelObject)
void QQuickComboBoxPrivate::updateCurrentTextAndValue()
{
- QObject *object = nullptr;
- // For performance reasons, we reuse the same delegate model object: QTBUG-76029.
- if (isValidIndex(currentIndex))
- object = delegateModel->object(currentIndex);
- const bool hasDelegateModelObject = object != nullptr;
- updateCurrentText(hasDelegateModelObject);
- updateCurrentValue(hasDelegateModelObject);
- if (object)
- delegateModel->release(object);
+ updateCurrentText();
+ updateCurrentValue();
}
bool QQuickComboBoxPrivate::isValidIndex(int index) const
@@ -521,20 +477,6 @@ bool QQuickComboBoxPrivate::isValidIndex(int index) const
return delegateModel && index >= 0 && index < delegateModel->count();
}
-// For performance reasons (QTBUG-76029), both this and valueAt assume that
-// the index is valid and delegateModel->object(index) has been called.
-QString QQuickComboBoxPrivate::fastTextAt(int index) const
-{
- const QString effectiveTextRole = textRole.isEmpty() ? QStringLiteral("modelData") : textRole;
- return delegateModel->stringValue(index, effectiveTextRole);
-}
-
-QVariant QQuickComboBoxPrivate::fastValueAt(int index) const
-{
- const QString effectiveValueRole = valueRole.isEmpty() ? QStringLiteral("modelData") : valueRole;
- return delegateModel->variantValue(index, effectiveValueRole);
-}
-
void QQuickComboBoxPrivate::acceptInput()
{
Q_Q(QQuickComboBox);
@@ -1583,13 +1525,8 @@ QVariant QQuickComboBox::valueAt(int index) const
if (!d->isValidIndex(index))
return QVariant();
- QObject *object = d->delegateModel->object(index);
- QVariant value;
- if (object) {
- value = d->fastValueAt(index);
- d->delegateModel->release(object);
- }
- return value;
+ const QString effectiveValueRole = d->valueRole.isEmpty() ? QStringLiteral("modelData") : d->valueRole;
+ return d->delegateModel->variantValue(index, effectiveValueRole);
}
/*!
@@ -1626,13 +1563,8 @@ QString QQuickComboBox::textAt(int index) const
if (!d->isValidIndex(index))
return QString();
- QObject *object = d->delegateModel->object(index);
- QString text;
- if (object) {
- text = d->fastTextAt(index);
- d->delegateModel->release(object);
- }
- return text;
+ const QString effectiveTextRole = d->textRole.isEmpty() ? QStringLiteral("modelData") : d->textRole;
+ return d->delegateModel->stringValue(index, effectiveTextRole);
}
/*!
diff --git a/src/quicktemplates2/qquickdeferredexecute.cpp b/src/quicktemplates2/qquickdeferredexecute.cpp
index 800dcedb..d56131e4 100644
--- a/src/quicktemplates2/qquickdeferredexecute.cpp
+++ b/src/quicktemplates2/qquickdeferredexecute.cpp
@@ -92,11 +92,21 @@ static bool beginDeferred(QQmlEnginePrivate *enginePriv, const QQmlProperty &pro
typedef QMultiHash<int, const QV4::CompiledData::Binding *> QV4PropertyBindingHash;
auto it = std::reverse_iterator<QV4PropertyBindingHash::iterator>(range.second);
auto last = std::reverse_iterator<QV4PropertyBindingHash::iterator>(range.first);
+#if Q_QML_PRIVATE_API_VERSION < 7
while (it != last) {
if (!state->creator->populateDeferredBinding(property, deferData, *it))
state->errors << state->creator->errors;
++it;
}
+#else
+ state->creator->beginPopulateDeferred(deferData->context);
+ while (it != last) {
+ state->creator->populateDeferredBinding(property, deferData->deferredIdx, *it);
+ ++it;
+ }
+ state->creator->finalizePopulateDeferred();
+ state->errors << state->creator->errors;
+#endif
deferredState->constructionStates += state;
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index f272c5cf..d83bb8aa 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -1836,6 +1836,8 @@ void QQuickPopup::setModal(bool modal)
d->toggleOverlay();
emit modalChanged();
+ QQuickItemPrivate::get(d->popupItem)->isTabFence = modal;
+
if (!d->hasDim) {
setDim(modal);
d->hasDim = false;
diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp
index 16d8c4f6..28ddde66 100644
--- a/src/quicktemplates2/qquickpopupitem.cpp
+++ b/src/quicktemplates2/qquickpopupitem.cpp
@@ -42,7 +42,9 @@
#include "qquickpopup_p_p.h"
#include "qquickdeferredexecute_p_p.h"
-#include <QtGui/private/qshortcutmap_p.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/private/qshortcutmap_p.h>
+#endif
#include <QtGui/private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quicktemplates2/qquickstackelement.cpp b/src/quicktemplates2/qquickstackelement.cpp
index 7ae5c495..4c14022a 100644
--- a/src/quicktemplates2/qquickstackelement.cpp
+++ b/src/quicktemplates2/qquickstackelement.cpp
@@ -44,6 +44,7 @@
#include <QtQml/private/qv4qobjectwrapper_p.h>
#include <QtQml/private/qqmlcomponent_p.h>
#include <QtQml/private/qqmlengine_p.h>
+#include <QtQml/private/qqmlapiversion_p.h>
QT_BEGIN_NAMESPACE
@@ -210,7 +211,12 @@ void QQuickStackElement::initialize()
QV4::ScopedValue ipv(scope, properties.value());
QV4::Scoped<QV4::QmlContext> qmlContext(scope, qmlCallingContext.value());
QV4::ScopedValue qmlObject(scope, QV4::QObjectWrapper::wrap(v4, item));
+#if Q_QML_PRIVATE_API_VERSION >= 6
+ RequiredProperties requiredPropertiesCurrentlyNotSupported;
+ QQmlComponentPrivate::setInitialProperties(v4, qmlContext, qmlObject, ipv, requiredPropertiesCurrentlyNotSupported, item);
+#else
QQmlComponentPrivate::setInitialProperties(v4, qmlContext, qmlObject, ipv);
+#endif
properties.clear();
}