aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-06-07 12:06:14 +0200
committerLiang Qi <liang.qi@qt.io>2017-06-07 12:06:15 +0200
commit55490690f81eba168b06a90e4a66cefc20b38252 (patch)
tree9c6b6b9234aa767af1c69cac4d4cf896f292be20 /src
parent5624e82d068ebab254239121810fc097af7fcb40 (diff)
parentd8f84e5769632544dfac5138348481330c4da4cd (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Diffstat (limited to 'src')
-rw-r--r--src/imports/builtins/builtins.qmltypes3
-rw-r--r--src/imports/qtquick2/plugins.qmltypes2
-rw-r--r--src/imports/settings/qqmlsettings.cpp18
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp5
-rw-r--r--src/qml/compiler/qqmlpropertyvalidator_p.h4
-rw-r--r--src/qml/configure.json9
-rw-r--r--src/qml/jsruntime/qv4alloca_p.h2
-rw-r--r--src/qml/jsruntime/qv4string_p.h4
-rw-r--r--src/qml/qtqmlglobal.h16
-rw-r--r--src/qml/qtqmlglobal_p.h4
-rw-r--r--src/quick/configure.json41
-rw-r--r--src/quick/items/qquickevents_p_p.h7
-rw-r--r--src/quick/items/qquickitem.cpp91
-rw-r--r--src/quick/items/qquickview.cpp1
-rw-r--r--src/quick/items/qquickwindow.cpp8
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp8
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp77
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h6
-rw-r--r--src/quickwidgets/qquickwidget.cpp5
19 files changed, 186 insertions, 125 deletions
diff --git a/src/imports/builtins/builtins.qmltypes b/src/imports/builtins/builtins.qmltypes
index ac95a8837b..c2f8f5b521 100644
--- a/src/imports/builtins/builtins.qmltypes
+++ b/src/imports/builtins/builtins.qmltypes
@@ -426,7 +426,8 @@ Module {
"WA_X11DoNotAcceptFocus": 126,
"WA_MacNoShadow": 127,
"WA_AlwaysStackOnTop": 128,
- "WA_AttributeCount": 129
+ "WA_TabletTracking": 129,
+ "WA_AttributeCount": 130
}
}
Enum {
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes
index a9534b5ccc..834b4bfac2 100644
--- a/src/imports/qtquick2/plugins.qmltypes
+++ b/src/imports/qtquick2/plugins.qmltypes
@@ -1414,7 +1414,7 @@ Module {
Property { name: "source"; type: "QObject"; isPointer: true }
Property { name: "target"; type: "QObject"; isReadonly: true; isPointer: true }
Property { name: "hotSpot"; type: "QPointF" }
- Property { name: "imageSource"; revision: 8; type: "QUrl" }
+ Property { name: "imageSource"; type: "QUrl" }
Property { name: "keys"; type: "QStringList" }
Property { name: "mimeData"; type: "QVariantMap" }
Property { name: "supportedActions"; type: "Qt::DropActions" }
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index cd6fcbc718..df67c04654 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -41,6 +41,7 @@
#include <qcoreevent.h>
#include <qsettings.h>
#include <qpointer.h>
+#include <qjsvalue.h>
#include <qdebug.h>
#include <qhash.h>
@@ -241,6 +242,7 @@ public:
void store();
void _q_propertyChanged();
+ QVariant readProperty(const QMetaProperty &property) const;
QQmlSettings *q_ptr;
int timerId;
@@ -295,7 +297,7 @@ void QQmlSettingsPrivate::load()
for (int i = offset; i < count; ++i) {
QMetaProperty property = mo->property(i);
- const QVariant previousValue = property.read(q);
+ const QVariant previousValue = readProperty(property);
const QVariant currentValue = instance()->value(property.name(), previousValue);
if (!currentValue.isNull() && (!previousValue.isValid()
@@ -340,9 +342,10 @@ void QQmlSettingsPrivate::_q_propertyChanged()
const int count = mo->propertyCount();
for (int i = offset; i < count; ++i) {
const QMetaProperty &property = mo->property(i);
- changedProperties.insert(property.name(), property.read(q));
+ const QVariant value = readProperty(property);
+ changedProperties.insert(property.name(), value);
#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: cache" << property.name() << ":" << property.read(q);
+ qDebug() << "QQmlSettings: cache" << property.name() << ":" << value;
#endif
}
if (timerId != 0)
@@ -350,6 +353,15 @@ void QQmlSettingsPrivate::_q_propertyChanged()
timerId = q->startTimer(settingsWriteDelay);
}
+QVariant QQmlSettingsPrivate::readProperty(const QMetaProperty &property) const
+{
+ Q_Q(const QQmlSettings);
+ QVariant var = property.read(q);
+ if (var.userType() == qMetaTypeId<QJSValue>())
+ var = var.value<QJSValue>().toVariant();
+ return var;
+}
+
QQmlSettings::QQmlSettings(QObject *parent)
: QObject(parent), d_ptr(new QQmlSettingsPrivate)
{
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index de04116a6b..f766f0e4c8 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -1961,7 +1961,7 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
// with the correct QML context.
// Look for IDs first.
- for (const IdMapping &mapping : qAsConst(_idObjects))
+ for (const IdMapping &mapping : qAsConst(_idObjects)) {
if (name == mapping.name) {
if (_function->isQmlBinding)
_function->idObjectDependencies.insert(mapping.idIndex);
@@ -1979,8 +1979,9 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
result->isReadOnly = true; // don't allow use as lvalue
return result;
}
+ }
- {
+ if (name.at(0).isUpper()) {
QQmlTypeNameCache::Result r = imports->query(name);
if (r.isValid()) {
if (r.scriptIndex != -1) {
diff --git a/src/qml/compiler/qqmlpropertyvalidator_p.h b/src/qml/compiler/qqmlpropertyvalidator_p.h
index d0bd314461..e37b8141f4 100644
--- a/src/qml/compiler/qqmlpropertyvalidator_p.h
+++ b/src/qml/compiler/qqmlpropertyvalidator_p.h
@@ -69,8 +69,8 @@ private:
bool canCoerce(int to, QQmlPropertyCache *fromMo) const;
- QVector<QQmlCompileError> recordError(const QV4::CompiledData::Location &location, const QString &description) const Q_REQUIRED_RESULT;
- QVector<QQmlCompileError> recordError(const QQmlCompileError &error) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QVector<QQmlCompileError> recordError(const QV4::CompiledData::Location &location, const QString &description) const;
+ Q_REQUIRED_RESULT QVector<QQmlCompileError> recordError(const QQmlCompileError &error) const;
QString stringAt(int index) const { return qmlUnit->stringAt(index); }
QQmlEnginePrivate *enginePrivate;
diff --git a/src/qml/configure.json b/src/qml/configure.json
index 2c4887365f..257bedecbc 100644
--- a/src/qml/configure.json
+++ b/src/qml/configure.json
@@ -15,17 +15,20 @@
"features": {
"qml-interpreter": {
"label": "QML interpreter",
- "purpose": "Support for the QML interpreter",
+ "purpose": "Provides the QML interpreter.",
+ "section": "QML",
"output": [ "privateFeature" ]
},
"qml-network": {
"label": "QML network support",
- "purpose": "Provides network transparency for QML",
+ "purpose": "Provides network transparency.",
+ "section": "QML",
"output": [ "publicFeature" ]
},
"qml-profiler": {
"label": "Command line QML Profiler",
- "purpose": "The QML Profiler retrieves QML tracing data from an application.",
+ "purpose": "Supports retrieving QML tracing data from an application.",
+ "section": "QML",
"condition": [
"features.commandlineparser",
"features.localserver",
diff --git a/src/qml/jsruntime/qv4alloca_p.h b/src/qml/jsruntime/qv4alloca_p.h
index c21878fa42..1e9f83a90e 100644
--- a/src/qml/jsruntime/qv4alloca_p.h
+++ b/src/qml/jsruntime/qv4alloca_p.h
@@ -58,7 +58,7 @@
#elif QT_CONFIG(alloca_malloc_h)
# include <malloc.h>
// This does not matter unless compiling in strict standard mode.
-# ifdef Q_OS_WIN
+# ifdef Q_CC_MSVC
# define alloca _alloca
# endif
#else
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index df0394d4cb..2f34dd6139 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -175,10 +175,6 @@ struct Q_QML_PRIVATE_EXPORT String : public Managed {
}
uint toUInt(bool *ok) const;
- Q_DECL_DEPRECATED void makeIdentifier(ExecutionEngine *) {
- makeIdentifier();
- }
-
void makeIdentifier() const {
if (d()->identifier)
return;
diff --git a/src/qml/qtqmlglobal.h b/src/qml/qtqmlglobal.h
index 6704e55b52..387c28a945 100644
--- a/src/qml/qtqmlglobal.h
+++ b/src/qml/qtqmlglobal.h
@@ -40,18 +40,20 @@
#ifndef QTQMLGLOBAL_H
#define QTQMLGLOBAL_H
+#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+# define QT_QML_BOOTSTRAPPED
+#endif
+
#include <QtCore/qglobal.h>
-#include <QtQml/qtqml-config.h>
-#if QT_CONFIG(qml_network)
-#include <QtNetwork/qtnetworkglobal.h>
+#ifndef QT_QML_BOOTSTRAPPED
+# include <QtQml/qtqml-config.h>
+# if QT_CONFIG(qml_network)
+# include <QtNetwork/qtnetworkglobal.h>
+# endif
#endif
QT_BEGIN_NAMESPACE
-#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
-# define QT_QML_BOOTSTRAPPED
-#endif
-
#if !defined(QT_QML_BOOTSTRAPPED) && !defined(QT_STATIC)
# if defined(QT_BUILD_QML_LIB)
# define Q_QML_EXPORT Q_DECL_EXPORT
diff --git a/src/qml/qtqmlglobal_p.h b/src/qml/qtqmlglobal_p.h
index 3314e73d19..4c0ba338d8 100644
--- a/src/qml/qtqmlglobal_p.h
+++ b/src/qml/qtqmlglobal_p.h
@@ -52,8 +52,10 @@
//
#include <QtCore/private/qglobal_p.h>
-#include <QtQml/private/qtqml-config_p.h>
#include <QtQml/qtqmlglobal.h>
+#ifndef QT_QML_BOOTSTRAPPED
+# include <QtQml/private/qtqml-config_p.h>
+#endif
#define Q_QML_PRIVATE_EXPORT Q_QML_EXPORT
diff --git a/src/quick/configure.json b/src/quick/configure.json
index 047fa8c948..65ad5b810b 100644
--- a/src/quick/configure.json
+++ b/src/quick/configure.json
@@ -34,7 +34,8 @@
"features": {
"d3d12": {
"label": "Direct3D 12",
- "purpose": "Provides a Direct3D 12 backend for the Qt Quick Scenegraph",
+ "purpose": "Provides a Direct3D 12 backend for the scenegraph.",
+ "section": "Qt Quick",
"condition": "tests.d3d12",
"output": [
"publicFeature"
@@ -42,7 +43,8 @@
},
"quick-animatedimage": {
"label": "AnimatedImage item",
- "purpose": "Provides the Qt Quick AnimatedImage Item",
+ "purpose": "Provides the AnimatedImage item.",
+ "section": "Qt Quick",
"condition": "features.movie",
"output": [
"privateFeature"
@@ -50,29 +52,33 @@
},
"quick-canvas": {
"label": "Canvas item",
- "purpose": "Provides the Qt Quick Canvas Item",
+ "purpose": "Provides the Canvas item.",
+ "section": "Qt Quick",
"condition": "features.quick-path",
"output": [
"privateFeature"
]
},
"quick-designer": {
- "label": "Support for Quick Designer",
- "purpose": "Provides support for the Qt Quick Designer in Qt Creator",
+ "label": "Support for Qt Quick Designer",
+ "purpose": "Provides support for the Qt Quick Designer in Qt Creator.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-flipable": {
"label": "Flipable item",
- "purpose": "Provides the Qt Quick Flipable Item",
+ "purpose": "Provides the Flipable item.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-gridview": {
"label": "GridView item",
- "purpose": "Provides the Qt Quick GridView item",
+ "purpose": "Provides the GridView item.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
@@ -93,14 +99,16 @@
},
"quick-listview": {
"label": "ListView item",
- "purpose": "Provides the Qt Quick ListView item",
+ "purpose": "Provides the ListView item.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-particles": {
"label": "Particle support",
- "purpose": "Provides a particle system for Qt Quick",
+ "purpose": "Provides a particle system.",
+ "section": "Qt Quick",
"condition": "features.quick-shadereffect && features.quick-sprite && features.opengl",
"output": [
"privateFeature"
@@ -108,14 +116,16 @@
},
"quick-path": {
"label": "Path support",
- "purpose": "Provides Path elements in Qt Quick",
+ "purpose": "Provides Path elements.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-pathview": {
"label": "PathView item",
- "purpose": "Provides the Qt Quick PathView item",
+ "purpose": "Provides the PathView item.",
+ "section": "Qt Quick",
"condition": "features.quick-path",
"output": [
"privateFeature"
@@ -123,21 +133,24 @@
},
"quick-positioners": {
"label": "Positioner items",
- "purpose": "Provides Positioner items in Qt Quick",
+ "purpose": "Provides Positioner items.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-shadereffect": {
"label": "ShaderEffect item",
- "purpose": "Provides Shader effects in Qt Quick",
+ "purpose": "Provides Shader effects.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-sprite": {
"label": "Sprite item",
- "purpose": "Provides the Qt Quick Sprite Item",
+ "purpose": "Provides the Sprite item.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 323ecfa4ff..3735d68a85 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -501,7 +501,6 @@ public:
: m_deviceType(devType), m_pointerType(pType), m_capabilities(caps)
, m_maximumTouchPoints(maxPoints), m_buttonCount(buttonCount), m_name(name)
, m_uniqueId(QPointingDeviceUniqueId::fromNumericId(uniqueId))
- , m_event(nullptr)
{
}
@@ -514,8 +513,6 @@ public:
QString name() const { return m_name; }
QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; }
- QQuickPointerEvent *pointerEvent() const { return m_event; } // deprecated
-
static QQuickPointerDevice *touchDevice(QTouchDevice *d);
static QList<QQuickPointerDevice *> touchDevices();
static QQuickPointerDevice *genericMouseDevice();
@@ -530,10 +527,6 @@ private:
QString m_name;
QPointingDeviceUniqueId m_uniqueId;
- // the event instance used last time within the context of one window
- QQuickPointerEvent *m_event; // deprecated
- friend class QQuickWindowPrivate; // not needed after removing the above
-
Q_DISABLE_COPY(QQuickPointerDevice)
};
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 4e52109582..a8a862bb2f 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -146,8 +146,8 @@ QQuickTransform::QQuickTransform(QQuickTransformPrivate &dd, QObject *parent)
QQuickTransform::~QQuickTransform()
{
Q_D(QQuickTransform);
- for (QQuickItem *item : qAsConst(d->items)) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ for (int ii = 0; ii < d->items.count(); ++ii) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->items.at(ii));
p->transforms.removeOne(this);
p->dirty(QQuickItemPrivate::Transform);
}
@@ -156,8 +156,8 @@ QQuickTransform::~QQuickTransform()
void QQuickTransform::update()
{
Q_D(QQuickTransform);
- for (QQuickItem *item : qAsConst(d->items)) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ for (int ii = 0; ii < d->items.count(); ++ii) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->items.at(ii));
p->dirty(QQuickItemPrivate::Transform);
}
}
@@ -169,7 +169,9 @@ QQuickContents::QQuickContents(QQuickItem *item)
QQuickContents::~QQuickContents()
{
- for (QQuickItem *child : m_item->childItems()) {
+ QList<QQuickItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QQuickItem *child = children.at(i);
QQuickItemPrivate::get(child)->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
}
}
@@ -192,8 +194,9 @@ bool QQuickContents::calcHeight(QQuickItem *changed)
} else {
qreal top = std::numeric_limits<qreal>::max();
qreal bottom = -std::numeric_limits<qreal>::max();
- const QList<QQuickItem*> children = m_item->childItems();
- for (QQuickItem *child : qAsConst(children)) {
+ QList<QQuickItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QQuickItem *child = children.at(i);
qreal y = child->y();
if (y + child->height() > bottom)
bottom = y + child->height();
@@ -226,8 +229,9 @@ bool QQuickContents::calcWidth(QQuickItem *changed)
} else {
qreal left = std::numeric_limits<qreal>::max();
qreal right = -std::numeric_limits<qreal>::max();
- const QList<QQuickItem*> children = m_item->childItems();
- for (QQuickItem *child : qAsConst(children)) {
+ QList<QQuickItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QQuickItem *child = children.at(i);
qreal x = child->x();
if (x + child->width() > right)
right = x + child->width();
@@ -246,7 +250,9 @@ void QQuickContents::complete()
{
QQuickItemPrivate::get(m_item)->addItemChangeListener(this, QQuickItemPrivate::Children);
- for (QQuickItem *child : m_item->childItems()) {
+ QList<QQuickItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QQuickItem *child = children.at(i);
QQuickItemPrivate::get(child)->addItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
//###what about changes to visibility?
}
@@ -1347,7 +1353,8 @@ void QQuickKeysAttached::componentComplete()
#if QT_CONFIG(im)
Q_D(QQuickKeysAttached);
if (d->item) {
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *targetItem = d->targets.at(ii);
if (targetItem && (targetItem->flags() & QQuickItem::ItemAcceptsInputMethod)) {
d->item->setFlag(QQuickItem::ItemAcceptsInputMethod);
break;
@@ -1369,10 +1376,11 @@ void QQuickKeysAttached::keyPressed(QKeyEvent *event, bool post)
// first process forwards
if (d->item && d->item->window()) {
d->inPress = true;
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
- if (targetItem && targetItem->isVisible()) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *i = d->targets.at(ii);
+ if (i && i->isVisible()) {
event->accept();
- QCoreApplication::sendEvent(targetItem, event);
+ QCoreApplication::sendEvent(i, event);
if (event->isAccepted()) {
d->inPress = false;
return;
@@ -1412,10 +1420,11 @@ void QQuickKeysAttached::keyReleased(QKeyEvent *event, bool post)
if (d->item && d->item->window()) {
d->inRelease = true;
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
- if (targetItem && targetItem->isVisible()) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *i = d->targets.at(ii);
+ if (i && i->isVisible()) {
event->accept();
- QCoreApplication::sendEvent(targetItem, event);
+ QCoreApplication::sendEvent(i, event);
if (event->isAccepted()) {
d->inRelease = false;
return;
@@ -1439,7 +1448,8 @@ void QQuickKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool post)
Q_D(QQuickKeysAttached);
if (post == m_processPost && d->item && !d->inIM && d->item->window()) {
d->inIM = true;
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *targetItem = d->targets.at(ii);
if (targetItem && targetItem->isVisible() && (targetItem->flags() & QQuickItem::ItemAcceptsInputMethod)) {
QCoreApplication::sendEvent(targetItem, event);
if (event->isAccepted()) {
@@ -1458,12 +1468,13 @@ QVariant QQuickKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const
{
Q_D(const QQuickKeysAttached);
if (d->item) {
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
- if (targetItem && targetItem->isVisible() && (targetItem->flags() & QQuickItem::ItemAcceptsInputMethod) && targetItem == d->imeItem) {
- //### how robust is targetItem == d->imeItem check?
- QVariant v = targetItem->inputMethodQuery(query);
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *i = d->targets.at(ii);
+ if (i && i->isVisible() && (i->flags() & QQuickItem::ItemAcceptsInputMethod) && i == d->imeItem) {
+ //### how robust is i == d->imeItem check?
+ QVariant v = i->inputMethodQuery(query);
if (v.userType() == QVariant::RectF)
- v = d->item->mapRectFromItem(targetItem, v.toRectF()); //### cost?
+ v = d->item->mapRectFromItem(i, v.toRectF()); //### cost?
return v;
}
}
@@ -1637,9 +1648,11 @@ void QQuickItemPrivate::setImplicitLayoutMirror(bool mirror, bool inherit)
if (isMirrorImplicit)
setLayoutMirror(inherit ? inheritedLayoutMirror : false);
- for (QQuickItem *child : qAsConst(childItems)) {
- QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
- childPrivate->setImplicitLayoutMirror(inheritedLayoutMirror, inheritMirrorFromParent);
+ for (int i = 0; i < childItems.count(); ++i) {
+ if (QQuickItem *child = qmlobject_cast<QQuickItem *>(childItems.at(i))) {
+ QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
+ childPrivate->setImplicitLayoutMirror(inheritedLayoutMirror, inheritMirrorFromParent);
+ }
}
}
@@ -2395,7 +2408,8 @@ QQuickItem::~QQuickItem()
remove themselves from our list of transforms when that list has already
been destroyed after ~QQuickItem() has run.
*/
- for (QQuickTransform *t : qAsConst(d->transforms)) {
+ for (int ii = 0; ii < d->transforms.count(); ++ii) {
+ QQuickTransform *t = d->transforms.at(ii);
QQuickTransformPrivate *tp = QQuickTransformPrivate::get(t);
tp->items.removeOne(this);
}
@@ -2886,8 +2900,8 @@ QList<QQuickItem *> QQuickItemPrivate::paintOrderChildItems() const
// If none of the items have set Z then the paint order list is the same as
// the childItems list. This is by far the most common case.
bool haveZ = false;
- for (QQuickItem *childItem : qAsConst(childItems)) {
- if (QQuickItemPrivate::get(childItem)->z() != 0.) {
+ for (int i = 0; i < childItems.count(); ++i) {
+ if (QQuickItemPrivate::get(childItems.at(i))->z() != 0.) {
haveZ = true;
break;
}
@@ -2988,7 +3002,8 @@ void QQuickItemPrivate::refWindow(QQuickWindow *c)
if (!parentItem)
QQuickWindowPrivate::get(window)->parentlessItems.insert(q);
- for (QQuickItem *child : qAsConst(childItems)) {
+ for (int ii = 0; ii < childItems.count(); ++ii) {
+ QQuickItem *child = childItems.at(ii);
QQuickItemPrivate::get(child)->refWindow(c);
}
@@ -3040,7 +3055,8 @@ void QQuickItemPrivate::derefWindow()
paintNode = 0;
- for (QQuickItem *child : qAsConst(childItems)) {
+ for (int ii = 0; ii < childItems.count(); ++ii) {
+ QQuickItem *child = childItems.at(ii);
QQuickItemPrivate::get(child)->derefWindow();
}
@@ -3485,7 +3501,8 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
QQuickItemPrivate *p = QQuickItemPrivate::get(that);
- for (QQuickTransform *t : qAsConst(p->transforms)) {
+ for (int ii = 0; ii < p->transforms.count(); ++ii) {
+ QQuickTransform *t = p->transforms.at(ii);
QQuickTransformPrivate *tp = QQuickTransformPrivate::get(t);
tp->items.removeOne(that);
}
@@ -5850,9 +5867,8 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
}
bool childVisibilityChanged = false;
- for (QQuickItem *childItem : qAsConst(childItems)) {
- childVisibilityChanged |= QQuickItemPrivate::get(childItem)->setEffectiveVisibleRecur(newEffectiveVisible);
- }
+ for (int ii = 0; ii < childItems.count(); ++ii)
+ childVisibilityChanged |= QQuickItemPrivate::get(childItems.at(ii))->setEffectiveVisibleRecur(newEffectiveVisible);
itemChange(QQuickItem::ItemVisibleHasChanged, effectiveVisible);
#if QT_CONFIG(accessibility)
@@ -5901,8 +5917,8 @@ void QQuickItemPrivate::setEffectiveEnableRecur(QQuickItem *scope, bool newEffec
}
}
- for (QQuickItem *childItem : qAsConst(childItems)) {
- QQuickItemPrivate::get(childItem)->setEffectiveEnableRecur(
+ for (int ii = 0; ii < childItems.count(); ++ii) {
+ QQuickItemPrivate::get(childItems.at(ii))->setEffectiveEnableRecur(
(flags & QQuickItem::ItemIsFocusScope) && scope ? q : scope, newEffectiveEnable);
}
@@ -6343,6 +6359,7 @@ void QQuickItem::setFlags(Flags flags)
\qmlproperty real QtQuick::Item::height
Defines the item's position and size.
+ The default value is \c 0.
The (x,y) position is relative to the \l parent.
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index 8313b53a7d..fca1805fc9 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -496,6 +496,7 @@ void QQuickViewPrivate::setRootObject(QObject *obj)
if (QQuickItem *sgItem = qobject_cast<QQuickItem *>(obj)) {
root = sgItem;
sgItem->setParentItem(q->QQuickWindow::contentItem());
+ QQml_setParent_noEvent(sgItem, q->QQuickWindow::contentItem());
} else if (qobject_cast<QWindow *>(obj)) {
qWarning() << "QQuickView does not support using windows as a root item." << endl
<< endl
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index ea096bbe2e..2cb518d691 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -526,6 +526,7 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
Q_Q(QQuickWindow);
contentItem = new QQuickRootItem;
+ QQml_setParent_noEvent(contentItem, c);
QQmlEngine::setObjectOwnership(contentItem, QQmlEngine::CppOwnership);
QQuickItemPrivate *contentItemPrivate = QQuickItemPrivate::get(contentItem);
contentItemPrivate->window = q;
@@ -2117,10 +2118,8 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevic
{
// the list of devices should be very small so a linear search should be ok
for (QQuickPointerEvent *e: pointerEventInstances) {
- if (e->device() == device) {
- device->m_event = e;
+ if (e->device() == device)
return e;
- }
}
QQuickPointerEvent *ev = nullptr;
@@ -2138,7 +2137,6 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevic
break;
}
pointerEventInstances << ev;
- device->m_event = ev;
return ev;
}
@@ -3874,7 +3872,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const
QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateTextureOptions options) const
{
Q_D(const QQuickWindow);
- if (!isSceneGraphInitialized() || image.isNull()) // check both for d->context and d->context->isValid()
+ if (!isSceneGraphInitialized()) // check both for d->context and d->context->isValid()
return 0;
uint flags = 0;
if (options & TextureCanUseAtlas) flags |= QSGRenderContext::CreateTexture_Atlas;
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
index 2ff180ea99..02cf8209d1 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
@@ -165,12 +165,12 @@ QRegion QSGAbstractSoftwareRenderer::optimizeRenderList()
// Keep up with obscured regions
if (node->isOpaque()) {
- m_obscuredRegion += QRegion(node->boundingRect());
+ m_obscuredRegion += node->boundingRectMin();
}
if (node->isDirty()) {
// Don't paint things outside of the rendering area
- if (!m_background->rect().toRect().contains(node->boundingRect(), /*proper*/ true)) {
+ if (!m_background->rect().toRect().contains(node->boundingRectMax(), /*proper*/ true)) {
// Some part(s) of node is(are) outside of the rendering area
QRegion renderArea(m_background->rect().toRect());
QRegion outsideRegions = node->dirtyRegion().subtracted(renderArea);
@@ -181,7 +181,7 @@ QRegion QSGAbstractSoftwareRenderer::optimizeRenderList()
// Get the dirty region's to pass to the next nodes
if (node->isOpaque()) {
// if isOpaque, subtract node's dirty rect from m_dirtyRegion
- m_dirtyRegion -= node->dirtyRegion();
+ m_dirtyRegion -= node->boundingRectMin();
} else {
// if isAlpha, add node's dirty rect to m_dirtyRegion
m_dirtyRegion += node->dirtyRegion();
@@ -264,7 +264,7 @@ void QSGAbstractSoftwareRenderer::nodeRemoved(QSGNode *node)
// Need to mark this region dirty in the other nodes
QRegion dirtyRegion = renderable->previousDirtyRegion(true);
if (dirtyRegion.isEmpty())
- dirtyRegion = renderable->boundingRect();
+ dirtyRegion = renderable->boundingRectMax();
m_dirtyRegion += dirtyRegion;
m_nodes.remove(node);
delete renderable;
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
index 52984a4310..0f4a0ac8f5 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
@@ -54,10 +54,28 @@
#include <private/qsgrendernode_p.h>
#include <private/qsgtexture_p.h>
+#include <qmath.h>
+
Q_LOGGING_CATEGORY(lcRenderable, "qt.scenegraph.softwarecontext.renderable")
QT_BEGIN_NAMESPACE
+// Largest subrectangle with integer coordinates
+inline QRect toRectMin(const QRectF & r)
+{
+ int x1 = qCeil(r.left());
+ int x2 = qFloor(r.right());
+ int y1 = qCeil(r.top());
+ int y2 = qFloor(r.bottom());
+ return QRect(x1, y1, x2 - x1, y2 - y1);
+}
+
+// Smallest superrectangle with integer coordinates
+inline QRect toRectMax(const QRectF & r)
+{
+ return r.toAlignedRect();
+}
+
QSGSoftwareRenderableNode::QSGSoftwareRenderableNode(NodeType type, QSGNode *node)
: m_nodeType(type)
, m_isOpaque(true)
@@ -117,7 +135,7 @@ void QSGSoftwareRenderableNode::update()
// Update the Node properties
m_isDirty = true;
- QRect boundingRect;
+ QRectF boundingRect;
switch (m_nodeType) {
case QSGSoftwareRenderableNode::SimpleRect:
@@ -126,7 +144,7 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.simpleRectNode->rect().toRect();
+ boundingRect = m_handle.simpleRectNode->rect();
break;
case QSGSoftwareRenderableNode::SimpleTexture:
if (!m_handle.simpleTextureNode->texture()->hasAlphaChannel() && !m_transform.isRotating())
@@ -134,7 +152,7 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.simpleTextureNode->rect().toRect();
+ boundingRect = m_handle.simpleTextureNode->rect();
break;
case QSGSoftwareRenderableNode::Image:
// There isn't a way to tell, so assume it's not
@@ -148,7 +166,7 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = QRect(0, 0, m_handle.painterNode->size().width(), m_handle.painterNode->size().height());
+ boundingRect = QRectF(0, 0, m_handle.painterNode->size().width(), m_handle.painterNode->size().height());
break;
case QSGSoftwareRenderableNode::Rectangle:
if (m_handle.rectangleNode->isOpaque() && !m_transform.isRotating())
@@ -156,19 +174,19 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.rectangleNode->rect().toRect();
+ boundingRect = m_handle.rectangleNode->rect();
break;
case QSGSoftwareRenderableNode::Glyph:
// Always has alpha
m_isOpaque = false;
- boundingRect = m_handle.glpyhNode->boundingRect().toAlignedRect();
+ boundingRect = m_handle.glpyhNode->boundingRect();
break;
case QSGSoftwareRenderableNode::NinePatch:
// Difficult to tell, assume non-opaque
m_isOpaque = false;
- boundingRect = m_handle.ninePatchNode->bounds().toRect();
+ boundingRect = m_handle.ninePatchNode->bounds();
break;
case QSGSoftwareRenderableNode::SimpleRectangle:
if (m_handle.simpleRectangleNode->color().alpha() == 255 && !m_transform.isRotating())
@@ -176,7 +194,7 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.simpleRectangleNode->rect().toRect();
+ boundingRect = m_handle.simpleRectangleNode->rect();
break;
case QSGSoftwareRenderableNode::SimpleImage:
if (!m_handle.simpleImageNode->texture()->hasAlphaChannel() && !m_transform.isRotating())
@@ -184,12 +202,12 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.simpleImageNode->rect().toRect();
+ boundingRect = m_handle.simpleImageNode->rect();
break;
#if QT_CONFIG(quick_sprite)
case QSGSoftwareRenderableNode::SpriteNode:
m_isOpaque = m_handle.spriteNode->isOpaque();
- boundingRect = m_handle.spriteNode->rect().toRect();
+ boundingRect = m_handle.spriteNode->rect();
break;
#endif
case QSGSoftwareRenderableNode::RenderNode:
@@ -198,27 +216,32 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.renderNode->rect().toRect();
+ boundingRect = m_handle.renderNode->rect();
break;
default:
break;
}
- m_boundingRect = m_transform.mapRect(boundingRect);
+ const QRectF transformedRect = m_transform.mapRect(boundingRect);
+ m_boundingRectMin = toRectMin(transformedRect);
+ m_boundingRectMax = toRectMax(transformedRect);
if (m_hasClipRegion && m_clipRegion.rectCount() <= 1) {
// If there is a clipRegion, and it is empty, the item wont be rendered
- if (m_clipRegion.isEmpty())
- m_boundingRect = QRect();
- else
- m_boundingRect = m_boundingRect.intersected(m_clipRegion.rects().first());
+ if (m_clipRegion.isEmpty()) {
+ m_boundingRectMin = QRect();
+ m_boundingRectMax = QRect();
+ } else {
+ m_boundingRectMin = m_boundingRectMin.intersected(m_clipRegion.rects().first());
+ m_boundingRectMax = m_boundingRectMax.intersected(m_clipRegion.rects().first());
+ }
}
// Overrides
if (m_opacity < 1.0f)
m_isOpaque = false;
- m_dirtyRegion = QRegion(m_boundingRect);
+ m_dirtyRegion = QRegion(m_boundingRectMax);
}
struct RenderNodeState : public QSGRenderNode::RenderState
@@ -258,7 +281,7 @@ QRegion QSGSoftwareRenderableNode::renderNode(QPainter *painter, bool forceOpaqu
rs.cr = m_clipRegion;
const QRect br = m_handle.renderNode->flags().testFlag(QSGRenderNode::BoundedRectRendering)
- ? m_boundingRect :
+ ? m_boundingRectMax :
QRect(0, 0, painter->device()->width(), painter->device()->height());
painter->save();
@@ -335,19 +358,13 @@ QRegion QSGSoftwareRenderableNode::renderNode(QPainter *painter, bool forceOpaqu
painter->restore();
QRegion areaToBeFlushed = m_dirtyRegion;
- m_previousDirtyRegion = QRegion(m_boundingRect);
+ m_previousDirtyRegion = QRegion(m_boundingRectMax);
m_isDirty = false;
m_dirtyRegion = QRegion();
return areaToBeFlushed;
}
-QRect QSGSoftwareRenderableNode::boundingRect() const
-{
- // This returns the bounding area of a renderable node in world coordinates
- return m_boundingRect;
-}
-
bool QSGSoftwareRenderableNode::isDirtyRegionEmpty() const
{
return m_dirtyRegion.isEmpty();
@@ -392,12 +409,12 @@ void QSGSoftwareRenderableNode::markMaterialDirty()
void QSGSoftwareRenderableNode::addDirtyRegion(const QRegion &dirtyRegion, bool forceDirty)
{
- // Check if the dirty region applys to this node
+ // Check if the dirty region applies to this node
QRegion prev = m_dirtyRegion;
- if (dirtyRegion.intersects(boundingRect())) {
+ if (dirtyRegion.intersects(m_boundingRectMax)) {
if (forceDirty)
m_isDirty = true;
- m_dirtyRegion += dirtyRegion.intersected(boundingRect());
+ m_dirtyRegion += dirtyRegion.intersected(m_boundingRectMax);
}
qCDebug(lcRenderable) << "addDirtyRegion: " << dirtyRegion << "old dirtyRegion: " << prev << "new dirtyRegion: " << m_dirtyRegion;
}
@@ -407,7 +424,7 @@ void QSGSoftwareRenderableNode::subtractDirtyRegion(const QRegion &dirtyRegion)
QRegion prev = m_dirtyRegion;
if (m_isDirty) {
// Check if this rect concerns us
- if (dirtyRegion.intersects(QRegion(boundingRect()))) {
+ if (dirtyRegion.intersects(m_boundingRectMax)) {
m_dirtyRegion -= dirtyRegion;
if (m_dirtyRegion.isEmpty())
m_isDirty = false;
@@ -423,7 +440,7 @@ QRegion QSGSoftwareRenderableNode::previousDirtyRegion(bool wasRemoved) const
if (wasRemoved)
return m_previousDirtyRegion;
- return m_previousDirtyRegion.subtracted(QRegion(m_boundingRect));
+ return m_previousDirtyRegion.subtracted(QRegion(m_boundingRectMax));
}
QRegion QSGSoftwareRenderableNode::dirtyRegion() const
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h
index 473578c185..8fc87db179 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h
@@ -98,7 +98,8 @@ public:
void update();
QRegion renderNode(QPainter *painter, bool forceOpaquePainting = false);
- QRect boundingRect() const;
+ QRect boundingRectMin() const { return m_boundingRectMin; }
+ QRect boundingRectMax() const { return m_boundingRectMax; }
NodeType type() const { return m_nodeType; }
bool isOpaque() const { return m_isOpaque; }
bool isDirty() const { return m_isDirty; }
@@ -149,7 +150,8 @@ private:
bool m_hasClipRegion;
float m_opacity;
- QRect m_boundingRect;
+ QRect m_boundingRectMin;
+ QRect m_boundingRectMax;
};
QT_END_NAMESPACE
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 4d021cb680..2e8623f508 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1440,6 +1440,9 @@ bool QQuickWidget::event(QEvent *e)
d->offscreenWindow->setWindowState(resolveWindowState(windowState()));
break;
+ case QEvent::ShortcutOverride:
+ return QCoreApplication::sendEvent(d->offscreenWindow, e);
+
default:
break;
}
@@ -1596,10 +1599,10 @@ QQuickWindow *QQuickWidget::quickWindow() const
void QQuickWidget::paintEvent(QPaintEvent *event)
{
- Q_UNUSED(event)
Q_D(QQuickWidget);
if (d->useSoftwareRenderer) {
QPainter painter(this);
+ d->updateRegion = d->updateRegion.united(event->region());
if (d->updateRegion.isNull()) {
//Paint everything
painter.drawImage(rect(), d->softwareImage);