1192 lines
46 KiB
Diff
1192 lines
46 KiB
Diff
diff --git a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
|
|
index b5c5f6a2b0..1a3d3cdf97 100644
|
|
--- a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
|
|
+++ b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
|
|
@@ -112,10 +112,7 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable,
|
|
if (result == MAP_FAILED)
|
|
CRASH();
|
|
|
|
- while (madvise(result, bytes, MADV_DONTNEED)) {
|
|
- if (errno != EAGAIN)
|
|
- CRASH();
|
|
- }
|
|
+ while (madvise(result, bytes, MADV_DONTNEED) == -1 && errno == EAGAIN) { }
|
|
|
|
if (fd != -1)
|
|
close(fd);
|
|
@@ -248,8 +245,10 @@ void OSAllocator::decommit(void* address, size_t bytes)
|
|
mmap(address, bytes, PROT_NONE, MAP_FIXED | MAP_LAZY | MAP_PRIVATE | MAP_ANON, -1, 0);
|
|
#elif OS(LINUX)
|
|
while (madvise(address, bytes, MADV_DONTNEED)) {
|
|
- if (errno != EAGAIN)
|
|
- CRASH();
|
|
+ if (errno != EAGAIN) {
|
|
+ memset(address, 0, bytes); // We rely on madvise to zero-out the memory
|
|
+ break;
|
|
+ }
|
|
}
|
|
if (mprotect(address, bytes, PROT_NONE))
|
|
CRASH();
|
|
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
|
|
index cf8a53cf9f..223e64271e 100644
|
|
--- a/src/qml/jsruntime/qv4function.cpp
|
|
+++ b/src/qml/jsruntime/qv4function.cpp
|
|
@@ -136,7 +136,7 @@ void Function::updateInternalClass(ExecutionEngine *engine, const QList<QByteArr
|
|
if (duplicate == -1) {
|
|
parameterNames.append(QString::fromUtf8(param));
|
|
} else {
|
|
- const QString &dup = parameterNames[duplicate];
|
|
+ const QString dup = parameterNames[duplicate];
|
|
parameterNames.append(dup);
|
|
parameterNames[duplicate] =
|
|
QString(0xfffe) + QString::number(duplicate) + dup;
|
|
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
|
|
index c44fb8608e..69dac27c9a 100644
|
|
--- a/src/qml/qml/qqmldata_p.h
|
|
+++ b/src/qml/qml/qqmldata_p.h
|
|
@@ -185,7 +185,7 @@ public:
|
|
private:
|
|
void layout(QQmlNotifierEndpoint*);
|
|
};
|
|
- QAtomicPointer<NotifyList> notifyList;
|
|
+ QAtomicPointer<NotifyList> notifyList = nullptr;
|
|
|
|
inline QQmlNotifierEndpoint *notify(int index) const;
|
|
void addNotify(int index, QQmlNotifierEndpoint *);
|
|
@@ -201,12 +201,12 @@ public:
|
|
QQmlContextData *outerContext = nullptr;
|
|
QQmlContextDataRef ownContext;
|
|
|
|
- QQmlAbstractBinding *bindings;
|
|
- QQmlBoundSignal *signalHandlers;
|
|
+ QQmlAbstractBinding *bindings = nullptr;
|
|
+ QQmlBoundSignal *signalHandlers = nullptr;
|
|
|
|
// Linked list for QQmlContext::contextObjects
|
|
- QQmlData *nextContextObject;
|
|
- QQmlData**prevContextObject;
|
|
+ QQmlData *nextContextObject = nullptr;
|
|
+ QQmlData**prevContextObject = nullptr;
|
|
|
|
inline bool hasBindingBit(int) const;
|
|
inline void setBindingBit(QObject *obj, int);
|
|
@@ -216,10 +216,10 @@ public:
|
|
inline void setPendingBindingBit(QObject *obj, int);
|
|
inline void clearPendingBindingBit(int);
|
|
|
|
- quint16 lineNumber;
|
|
- quint16 columnNumber;
|
|
+ quint16 lineNumber = 0;
|
|
+ quint16 columnNumber = 0;
|
|
|
|
- quint32 jsEngineId; // id of the engine that created the jsWrapper
|
|
+ quint32 jsEngineId = 0; // id of the engine that created the jsWrapper
|
|
|
|
struct DeferredData {
|
|
DeferredData();
|
|
@@ -240,7 +240,7 @@ public:
|
|
|
|
QQmlPropertyCache *propertyCache;
|
|
|
|
- QQmlGuardImpl *guards;
|
|
+ QQmlGuardImpl *guards = 0;
|
|
|
|
static QQmlData *get(const QObject *object, bool create = false) {
|
|
QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
|
|
@@ -289,7 +289,7 @@ public:
|
|
|
|
private:
|
|
// For attachedProperties
|
|
- mutable QQmlDataExtended *extendedData;
|
|
+ mutable QQmlDataExtended *extendedData = nullptr;
|
|
|
|
Q_NEVER_INLINE static QQmlData *createQQmlData(QObjectPrivate *priv);
|
|
Q_NEVER_INLINE static QQmlPropertyCache *createPropertyCache(QJSEngine *engine, QObject *object);
|
|
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
|
|
index 2325c4c1e0..069e369319 100644
|
|
--- a/src/qml/qml/qqmlengine.cpp
|
|
+++ b/src/qml/qml/qqmlengine.cpp
|
|
@@ -725,11 +725,8 @@ void QQmlPrivate::qdeclarativeelement_destructor(QObject *o)
|
|
QQmlData::QQmlData()
|
|
: ownedByQml1(false), ownMemory(true), indestructible(true), explicitIndestructibleSet(false),
|
|
hasTaintedV4Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
|
|
- hasInterceptorMetaObject(false), hasVMEMetaObject(false), parentFrozen(false),
|
|
- bindingBitsArraySize(InlineBindingArraySize), notifyList(nullptr),
|
|
- bindings(nullptr), signalHandlers(nullptr), nextContextObject(nullptr), prevContextObject(nullptr),
|
|
- lineNumber(0), columnNumber(0), jsEngineId(0),
|
|
- propertyCache(nullptr), guards(nullptr), extendedData(nullptr)
|
|
+ hasInterceptorMetaObject(false), hasVMEMetaObject(false), parentFrozen(false), dummy(0),
|
|
+ bindingBitsArraySize(InlineBindingArraySize), propertyCache(nullptr)
|
|
{
|
|
memset(bindingBitsValue, 0, sizeof(bindingBitsValue));
|
|
init();
|
|
@@ -1591,17 +1588,22 @@ void qmlExecuteDeferred(QObject *object)
|
|
{
|
|
QQmlData *data = QQmlData::get(object);
|
|
|
|
- if (data && !data->deferredData.isEmpty() && !data->wasDeleted(object)) {
|
|
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine);
|
|
+ if (!data
|
|
+ || !data->context
|
|
+ || !data->context->engine
|
|
+ || data->deferredData.isEmpty()
|
|
+ || data->wasDeleted(object)) {
|
|
+ return;
|
|
+ }
|
|
|
|
- QQmlComponentPrivate::DeferredState state;
|
|
- QQmlComponentPrivate::beginDeferred(ep, object, &state);
|
|
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine);
|
|
+ QQmlComponentPrivate::DeferredState state;
|
|
+ QQmlComponentPrivate::beginDeferred(ep, object, &state);
|
|
|
|
- // Release the reference for the deferral action (we still have one from construction)
|
|
- data->releaseDeferredData();
|
|
+ // Release the reference for the deferral action (we still have one from construction)
|
|
+ data->releaseDeferredData();
|
|
|
|
- QQmlComponentPrivate::completeDeferred(ep, &state);
|
|
- }
|
|
+ QQmlComponentPrivate::completeDeferred(ep, &state);
|
|
}
|
|
|
|
QQmlContext *qmlContext(const QObject *obj)
|
|
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
|
|
index e7263d1850..289f11d006 100644
|
|
--- a/src/qml/qml/qqmlimport.cpp
|
|
+++ b/src/qml/qml/qqmlimport.cpp
|
|
@@ -2119,9 +2119,12 @@ void QQmlImportDatabase::addImportPath(const QString& path)
|
|
cPath.replace(Backslash, Slash);
|
|
}
|
|
|
|
- if (!cPath.isEmpty()
|
|
- && !fileImportPath.contains(cPath))
|
|
- fileImportPath.prepend(cPath);
|
|
+ if (!cPath.isEmpty()) {
|
|
+ if (fileImportPath.contains(cPath))
|
|
+ fileImportPath.move(fileImportPath.indexOf(cPath), 0);
|
|
+ else
|
|
+ fileImportPath.prepend(cPath);
|
|
+ }
|
|
}
|
|
|
|
/*!
|
|
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
|
|
index 4fd2092fd3..0d59d197dc 100644
|
|
--- a/src/qml/qml/qqmlvmemetaobject.cpp
|
|
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
|
|
@@ -254,7 +254,7 @@ void QQmlVMEMetaObjectEndpoint::tryConnect()
|
|
if (!pd)
|
|
return;
|
|
|
|
- if (pd->notifyIndex() != -1)
|
|
+ if (pd->notifyIndex() != -1 && ctxt->engine)
|
|
connect(target, pd->notifyIndex(), ctxt->engine);
|
|
}
|
|
|
|
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp
|
|
index 3b57edfc5d..5b7e767ae2 100644
|
|
--- a/src/qmlmodels/qqmldelegatemodel.cpp
|
|
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
|
|
@@ -389,6 +389,12 @@ void QQmlDelegateModelPrivate::connectToAbstractItemModel()
|
|
q, QQmlDelegateModel, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
|
|
qmlobject_connect(aim, QAbstractItemModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
|
|
q, QQmlDelegateModel, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)));
|
|
+ qmlobject_connect(aim, QAbstractItemModel, SIGNAL(columnsInserted(QModelIndex,int,int)),
|
|
+ q, QQmlDelegateModel, SLOT(_q_columnsInserted(QModelIndex,int,int)));
|
|
+ qmlobject_connect(aim, QAbstractItemModel, SIGNAL(columnsRemoved(QModelIndex,int,int)),
|
|
+ q, QQmlDelegateModel, SLOT(_q_columnsRemoved(QModelIndex,int,int)));
|
|
+ qmlobject_connect(aim, QAbstractItemModel, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
|
|
+ q, QQmlDelegateModel, SLOT(_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)));
|
|
qmlobject_connect(aim, QAbstractItemModel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
|
|
q, QQmlDelegateModel, SLOT(_q_dataChanged(QModelIndex,QModelIndex,QVector<int>)));
|
|
qmlobject_connect(aim, QAbstractItemModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
|
|
@@ -413,6 +419,12 @@ void QQmlDelegateModelPrivate::disconnectFromAbstractItemModel()
|
|
q, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)));
|
|
QObject::disconnect(aim, SIGNAL(rowsRemoved(QModelIndex,int,int)),
|
|
q, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
|
|
+ QObject::disconnect(aim, SIGNAL(columnsInserted(QModelIndex,int,int)), q,
|
|
+ SLOT(_q_columnsInserted(QModelIndex,int,int)));
|
|
+ QObject::disconnect(aim, SIGNAL(columnsRemoved(QModelIndex,int,int)), q,
|
|
+ SLOT(_q_columnsRemoved(QModelIndex,int,int)));
|
|
+ QObject::disconnect(aim, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)), q,
|
|
+ SLOT(_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)));
|
|
QObject::disconnect(aim, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
|
|
q, SLOT(_q_dataChanged(QModelIndex,QModelIndex,QVector<int>)));
|
|
QObject::disconnect(aim, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
|
|
@@ -1979,6 +1991,38 @@ void QQmlDelegateModel::_q_rowsMoved(
|
|
}
|
|
}
|
|
|
|
+void QQmlDelegateModel::_q_columnsInserted(const QModelIndex &parent, int begin, int end)
|
|
+{
|
|
+ Q_D(QQmlDelegateModel);
|
|
+ Q_UNUSED(end);
|
|
+ if (parent == d->m_adaptorModel.rootIndex && begin == 0) {
|
|
+ // mark all items as changed
|
|
+ _q_itemsChanged(0, d->m_count, QVector<int>());
|
|
+ }
|
|
+}
|
|
+
|
|
+void QQmlDelegateModel::_q_columnsRemoved(const QModelIndex &parent, int begin, int end)
|
|
+{
|
|
+ Q_D(QQmlDelegateModel);
|
|
+ Q_UNUSED(end);
|
|
+ if (parent == d->m_adaptorModel.rootIndex && begin == 0) {
|
|
+ // mark all items as changed
|
|
+ _q_itemsChanged(0, d->m_count, QVector<int>());
|
|
+ }
|
|
+}
|
|
+
|
|
+void QQmlDelegateModel::_q_columnsMoved(const QModelIndex &parent, int start, int end,
|
|
+ const QModelIndex &destination, int column)
|
|
+{
|
|
+ Q_D(QQmlDelegateModel);
|
|
+ Q_UNUSED(end);
|
|
+ if ((parent == d->m_adaptorModel.rootIndex && start == 0)
|
|
+ || (destination == d->m_adaptorModel.rootIndex && column == 0)) {
|
|
+ // mark all items as changed
|
|
+ _q_itemsChanged(0, d->m_count, QVector<int>());
|
|
+ }
|
|
+}
|
|
+
|
|
void QQmlDelegateModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end, const QVector<int> &roles)
|
|
{
|
|
Q_D(QQmlDelegateModel);
|
|
diff --git a/src/qmlmodels/qqmldelegatemodel_p.h b/src/qmlmodels/qqmldelegatemodel_p.h
|
|
index 8aab4badca..d140bfbaaf 100644
|
|
--- a/src/qmlmodels/qqmldelegatemodel_p.h
|
|
+++ b/src/qmlmodels/qqmldelegatemodel_p.h
|
|
@@ -152,6 +152,9 @@ private Q_SLOTS:
|
|
void _q_itemsMoved(int from, int to, int count);
|
|
void _q_modelReset();
|
|
void _q_rowsInserted(const QModelIndex &,int,int);
|
|
+ void _q_columnsInserted(const QModelIndex &, int, int);
|
|
+ void _q_columnsRemoved(const QModelIndex &, int, int);
|
|
+ void _q_columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int);
|
|
void _q_rowsAboutToBeRemoved(const QModelIndex &parent, int begin, int end);
|
|
void _q_rowsRemoved(const QModelIndex &,int,int);
|
|
void _q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int);
|
|
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
|
|
index 36b65f906c..99e6eff7c3 100644
|
|
--- a/src/quick/accessible/qaccessiblequickitem.cpp
|
|
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
|
|
@@ -46,6 +46,7 @@
|
|
#include "QtQuick/private/qquicktextinput_p.h"
|
|
#include "QtQuick/private/qquickaccessibleattached_p.h"
|
|
#include "QtQuick/qquicktextdocument.h"
|
|
+#include "QtQuick/qquickrendercontrol.h"
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
#if QT_CONFIG(accessibility)
|
|
@@ -57,7 +58,19 @@ QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item)
|
|
|
|
QWindow *QAccessibleQuickItem::window() const
|
|
{
|
|
- return item()->window();
|
|
+ QQuickWindow *window = item()->window();
|
|
+
|
|
+ // For QQuickWidget the above window will be the offscreen QQuickWindow,
|
|
+ // which is not a part of the accessibility tree. Detect this case and
|
|
+ // return the window for the QQuickWidget instead.
|
|
+ if (window && !window->handle()) {
|
|
+ if (QQuickRenderControl *renderControl = QQuickWindowPrivate::get(window)->renderControl) {
|
|
+ if (QWindow *renderWindow = renderControl->renderWindow(nullptr))
|
|
+ return renderWindow;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return window;
|
|
}
|
|
|
|
int QAccessibleQuickItem::childCount() const
|
|
@@ -113,19 +126,15 @@ QAccessibleInterface *QAccessibleQuickItem::childAt(int x, int y) const
|
|
QAccessibleInterface *QAccessibleQuickItem::parent() const
|
|
{
|
|
QQuickItem *parent = item()->parentItem();
|
|
- QQuickWindow *window = item()->window();
|
|
- QQuickItem *ci = window ? window->contentItem() : nullptr;
|
|
+ QQuickWindow *itemWindow = item()->window();
|
|
+ QQuickItem *ci = itemWindow ? itemWindow->contentItem() : nullptr;
|
|
while (parent && !QQuickItemPrivate::get(parent)->isAccessible && parent != ci)
|
|
parent = parent->parentItem();
|
|
|
|
if (parent) {
|
|
if (parent == ci) {
|
|
- // Jump out to the scene widget if the parent is the root item.
|
|
- // There are two root items, QQuickWindow::rootItem and
|
|
- // QQuickView::declarativeRoot. The former is the true root item,
|
|
- // but is not a part of the accessibility tree. Check if we hit
|
|
- // it here and return an interface for the scene instead.
|
|
- return QAccessible::queryAccessibleInterface(window);
|
|
+ // Jump out to the window if the parent is the root item
|
|
+ return QAccessible::queryAccessibleInterface(window());
|
|
} else {
|
|
while (parent && !parent->d_func()->isAccessible)
|
|
parent = parent->parentItem();
|
|
@@ -193,7 +202,7 @@ QAccessible::State QAccessibleQuickItem::state() const
|
|
QRect viewRect_ = viewRect();
|
|
QRect itemRect = rect();
|
|
|
|
- if (viewRect_.isNull() || itemRect.isNull() || !item()->window() || !item()->window()->isVisible() ||!item()->isVisible() || qFuzzyIsNull(item()->opacity()))
|
|
+ if (viewRect_.isNull() || itemRect.isNull() || !window() || !window()->isVisible() ||!item()->isVisible() || qFuzzyIsNull(item()->opacity()))
|
|
state.invisible = true;
|
|
if (!viewRect_.intersects(itemRect))
|
|
state.offscreen = true;
|
|
@@ -206,6 +215,10 @@ QAccessible::State QAccessibleQuickItem::state() const
|
|
if (role() == QAccessible::EditableText)
|
|
if (auto ti = qobject_cast<QQuickTextInput *>(item()))
|
|
state.passwordEdit = ti->echoMode() != QQuickTextInput::Normal;
|
|
+ if (!item()->isEnabled()) {
|
|
+ state.focusable = false;
|
|
+ state.disabled = true;
|
|
+ }
|
|
return state;
|
|
}
|
|
|
|
diff --git a/src/quick/accessible/qaccessiblequickview_p.h b/src/quick/accessible/qaccessiblequickview_p.h
|
|
index 39ffcaf39c..8baa01330c 100644
|
|
--- a/src/quick/accessible/qaccessiblequickview_p.h
|
|
+++ b/src/quick/accessible/qaccessiblequickview_p.h
|
|
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
|
|
|
|
#if QT_CONFIG(accessibility)
|
|
|
|
-class QAccessibleQuickWindow : public QAccessibleObject
|
|
+class Q_QUICK_EXPORT QAccessibleQuickWindow : public QAccessibleObject
|
|
{
|
|
public:
|
|
QAccessibleQuickWindow(QQuickWindow *object);
|
|
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
|
|
index 8321fcfeed..383078b3b9 100644
|
|
--- a/src/quick/items/qquickdrag.cpp
|
|
+++ b/src/quick/items/qquickdrag.cpp
|
|
@@ -481,7 +481,9 @@ void QQuickDragAttached::setKeys(const QStringList &keys)
|
|
\qmlattachedproperty stringlist QtQuick::Drag::mimeData
|
|
\since 5.2
|
|
|
|
- This property holds a map of mimeData that is used during startDrag.
|
|
+ This property holds a map from mime type to data that is used during startDrag.
|
|
+ The mime data needs to be a \c string, or an \c ArrayBuffer with the data encoded
|
|
+ according to the mime type.
|
|
*/
|
|
|
|
QVariantMap QQuickDragAttached::mimeData() const
|
|
@@ -766,8 +768,12 @@ Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedAct
|
|
QDrag *drag = new QDrag(source ? source : q);
|
|
QMimeData *mimeData = new QMimeData();
|
|
|
|
- for (auto it = externalMimeData.cbegin(), end = externalMimeData.cend(); it != end; ++it)
|
|
- mimeData->setData(it.key(), it.value().toString().toUtf8());
|
|
+ for (auto it = externalMimeData.cbegin(), end = externalMimeData.cend(); it != end; ++it) {
|
|
+ if (static_cast<QMetaType::Type>(it.value().type()) == QMetaType::QByteArray)
|
|
+ mimeData->setData(it.key(), it.value().toByteArray());
|
|
+ else
|
|
+ mimeData->setData(it.key(), it.value().toString().toUtf8());
|
|
+ }
|
|
|
|
drag->setMimeData(mimeData);
|
|
if (pixmapLoader.isReady()) {
|
|
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
|
|
index c655b4c327..8b139cb539 100644
|
|
--- a/src/quick/items/qquickitem.cpp
|
|
+++ b/src/quick/items/qquickitem.cpp
|
|
@@ -2328,6 +2328,7 @@ QQuickItem::QQuickItem(QQuickItemPrivate &dd, QQuickItem *parent)
|
|
QQuickItem::~QQuickItem()
|
|
{
|
|
Q_D(QQuickItem);
|
|
+ d->inDestructor = true;
|
|
|
|
if (d->windowRefCount > 1)
|
|
d->windowRefCount = 1; // Make sure window is set to null in next call to derefWindow().
|
|
@@ -2695,9 +2696,8 @@ void QQuickItem::setParentItem(QQuickItem *parentItem)
|
|
|
|
const bool wasVisible = isVisible();
|
|
op->removeChild(this);
|
|
- if (wasVisible) {
|
|
+ if (wasVisible && !op->inDestructor)
|
|
emit oldParentItem->visibleChildrenChanged();
|
|
- }
|
|
} else if (d->window) {
|
|
QQuickWindowPrivate::get(d->window)->parentlessItems.remove(this);
|
|
}
|
|
@@ -2774,8 +2774,9 @@ void QQuickItem::setParentItem(QQuickItem *parentItem)
|
|
|
|
d->itemChange(ItemParentHasChanged, d->parentItem);
|
|
|
|
- emit parentChanged(d->parentItem);
|
|
- if (isVisible() && d->parentItem)
|
|
+ if (!d->inDestructor)
|
|
+ emit parentChanged(d->parentItem);
|
|
+ if (isVisible() && d->parentItem && !QQuickItemPrivate::get(d->parentItem)->inDestructor)
|
|
emit d->parentItem->visibleChildrenChanged();
|
|
}
|
|
|
|
@@ -2971,7 +2972,8 @@ void QQuickItemPrivate::removeChild(QQuickItem *child)
|
|
|
|
itemChange(QQuickItem::ItemChildRemovedChange, child);
|
|
|
|
- emit q->childrenChanged();
|
|
+ if (!inDestructor)
|
|
+ emit q->childrenChanged();
|
|
}
|
|
|
|
void QQuickItemPrivate::refWindow(QQuickWindow *c)
|
|
@@ -3200,6 +3202,7 @@ QQuickItemPrivate::QQuickItemPrivate()
|
|
, touchEnabled(false)
|
|
#endif
|
|
, hasCursorHandler(false)
|
|
+ , inDestructor(false)
|
|
, dirtyAttributes(0)
|
|
, nextDirtyItem(nullptr)
|
|
, prevDirtyItem(nullptr)
|
|
@@ -5126,6 +5129,13 @@ void QQuickItem::componentComplete()
|
|
d->addToDirtyList();
|
|
QQuickWindowPrivate::get(d->window)->dirtyItem(this);
|
|
}
|
|
+
|
|
+#if QT_CONFIG(accessibility)
|
|
+ if (d->isAccessible && d->effectiveVisible) {
|
|
+ QAccessibleEvent ev(this, QAccessible::ObjectShow);
|
|
+ QAccessible::updateAccessibility(&ev);
|
|
+ }
|
|
+#endif
|
|
}
|
|
|
|
QQuickStateGroup *QQuickItemPrivate::_states()
|
|
@@ -6112,9 +6122,11 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
|
|
QAccessible::updateAccessibility(&ev);
|
|
}
|
|
#endif
|
|
- emit q->visibleChanged();
|
|
- if (childVisibilityChanged)
|
|
- emit q->visibleChildrenChanged();
|
|
+ if (!inDestructor) {
|
|
+ emit q->visibleChanged();
|
|
+ if (childVisibilityChanged)
|
|
+ emit q->visibleChildrenChanged();
|
|
+ }
|
|
|
|
return true; // effective visibility DID change
|
|
}
|
|
@@ -6163,6 +6175,15 @@ void QQuickItemPrivate::setEffectiveEnableRecur(QQuickItem *scope, bool newEffec
|
|
}
|
|
|
|
itemChange(QQuickItem::ItemEnabledHasChanged, effectiveEnable);
|
|
+#if QT_CONFIG(accessibility)
|
|
+ if (isAccessible) {
|
|
+ QAccessible::State changedState;
|
|
+ changedState.disabled = true;
|
|
+ changedState.focusable = true;
|
|
+ QAccessibleStateChangeEvent ev(q, changedState);
|
|
+ QAccessible::updateAccessibility(&ev);
|
|
+ }
|
|
+#endif
|
|
emit q->enabledChanged();
|
|
}
|
|
|
|
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
|
|
index d48b551064..6f329bd119 100644
|
|
--- a/src/quick/items/qquickitem_p.h
|
|
+++ b/src/quick/items/qquickitem_p.h
|
|
@@ -472,6 +472,7 @@ public:
|
|
bool replayingPressEvent:1;
|
|
bool touchEnabled:1;
|
|
bool hasCursorHandler:1;
|
|
+ quint32 inDestructor:1; // has entered ~QQuickItem
|
|
|
|
enum DirtyType {
|
|
TransformOrigin = 0x00000001,
|
|
diff --git a/src/quick/items/qquickmousearea_p_p.h b/src/quick/items/qquickmousearea_p_p.h
|
|
index fba383e268..0d63618622 100644
|
|
--- a/src/quick/items/qquickmousearea_p_p.h
|
|
+++ b/src/quick/items/qquickmousearea_p_p.h
|
|
@@ -61,7 +61,6 @@ QT_BEGIN_NAMESPACE
|
|
|
|
class QQuickMouseEvent;
|
|
class QQuickMouseArea;
|
|
-class QQuickPointerMask;
|
|
class QQuickMouseAreaPrivate : public QQuickItemPrivate
|
|
{
|
|
Q_DECLARE_PUBLIC(QQuickMouseArea)
|
|
@@ -100,7 +99,6 @@ public:
|
|
#if QT_CONFIG(quick_draganddrop)
|
|
QQuickDrag *drag;
|
|
#endif
|
|
- QPointer<QQuickPointerMask> mask;
|
|
QPointF startScene;
|
|
QPointF targetStartPos;
|
|
QPointF lastPos;
|
|
diff --git a/src/quickwidgets/qaccessiblequickwidget.cpp b/src/quickwidgets/qaccessiblequickwidget.cpp
|
|
new file mode 100644
|
|
index 0000000000..8a1c901880
|
|
--- /dev/null
|
|
+++ b/src/quickwidgets/qaccessiblequickwidget.cpp
|
|
@@ -0,0 +1,110 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2021 The Qt Company Ltd.
|
|
+** Contact: https://www.qt.io/licensing/
|
|
+**
|
|
+** This file is part of the QtQuick module of the Qt Toolkit.
|
|
+**
|
|
+** $QT_BEGIN_LICENSE:LGPL$
|
|
+** Commercial License Usage
|
|
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
+** accordance with the commercial license agreement provided with the
|
|
+** Software or, alternatively, in accordance with the terms contained in
|
|
+** a written agreement between you and The Qt Company. For licensing terms
|
|
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
+** information use the contact form at https://www.qt.io/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 3 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 3 requirements
|
|
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
+**
|
|
+** GNU General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU
|
|
+** General Public License version 2.0 or (at your option) the GNU General
|
|
+** Public license version 3 or any later version approved by the KDE Free
|
|
+** Qt Foundation. The licenses are as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
+** included in the packaging of this file. Please review the following
|
|
+** information to ensure the GNU General Public License requirements will
|
|
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
+** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
+**
|
|
+** $QT_END_LICENSE$
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "qaccessiblequickwidget_p.h"
|
|
+
|
|
+#include "qquickwidget_p.h"
|
|
+
|
|
+QT_BEGIN_NAMESPACE
|
|
+
|
|
+#if QT_CONFIG(accessibility)
|
|
+
|
|
+QAccessibleQuickWidget::QAccessibleQuickWidget(QQuickWidget* widget)
|
|
+: QAccessibleWidget(widget)
|
|
+, m_accessibleWindow(QQuickWidgetPrivate::get(widget)->offscreenWindow)
|
|
+{
|
|
+ // NOTE: m_accessibleWindow is a QAccessibleQuickWindow, and not a
|
|
+ // QAccessibleQuickWidgetOffscreenWindow (defined below). This means
|
|
+ // it will return the Quick item child interfaces, which is what's needed here
|
|
+ // (unlike QAccessibleQuickWidgetOffscreenWindow, which will report 0 children).
|
|
+}
|
|
+
|
|
+QAccessibleInterface *QAccessibleQuickWidget::child(int index) const
|
|
+{
|
|
+ return m_accessibleWindow.child(index);
|
|
+}
|
|
+
|
|
+int QAccessibleQuickWidget::childCount() const
|
|
+{
|
|
+ return m_accessibleWindow.childCount();
|
|
+}
|
|
+
|
|
+int QAccessibleQuickWidget::indexOfChild(const QAccessibleInterface *iface) const
|
|
+{
|
|
+ return m_accessibleWindow.indexOfChild(iface);
|
|
+}
|
|
+
|
|
+QAccessibleInterface *QAccessibleQuickWidget::childAt(int x, int y) const
|
|
+{
|
|
+ return m_accessibleWindow.childAt(x, y);
|
|
+}
|
|
+
|
|
+QAccessibleQuickWidgetOffscreenWindow::QAccessibleQuickWidgetOffscreenWindow(QQuickWindow *window)
|
|
+:QAccessibleQuickWindow(window)
|
|
+{
|
|
+
|
|
+}
|
|
+
|
|
+QAccessibleInterface *QAccessibleQuickWidgetOffscreenWindow::child(int index) const
|
|
+{
|
|
+ Q_UNUSED(index);
|
|
+ return nullptr;
|
|
+}
|
|
+
|
|
+int QAccessibleQuickWidgetOffscreenWindow::childCount() const
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+int QAccessibleQuickWidgetOffscreenWindow::indexOfChild(const QAccessibleInterface *iface) const
|
|
+{
|
|
+ Q_UNUSED(iface);
|
|
+ return -1;
|
|
+}
|
|
+
|
|
+QAccessibleInterface *QAccessibleQuickWidgetOffscreenWindow::QAccessibleQuickWidgetOffscreenWindow::childAt(int x, int y) const
|
|
+{
|
|
+ Q_UNUSED(x);
|
|
+ Q_UNUSED(y);
|
|
+ return nullptr;
|
|
+}
|
|
+
|
|
+#endif // accessibility
|
|
+
|
|
+QT_END_NAMESPACE
|
|
diff --git a/src/quickwidgets/qaccessiblequickwidget_p.h b/src/quickwidgets/qaccessiblequickwidget_p.h
|
|
new file mode 100644
|
|
index 0000000000..7c2ab930e0
|
|
--- /dev/null
|
|
+++ b/src/quickwidgets/qaccessiblequickwidget_p.h
|
|
@@ -0,0 +1,95 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2021 The Qt Company Ltd.
|
|
+** Contact: https://www.qt.io/licensing/
|
|
+**
|
|
+** This file is part of the QtQuick module of the Qt Toolkit.
|
|
+**
|
|
+** $QT_BEGIN_LICENSE:LGPL$
|
|
+** Commercial License Usage
|
|
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
+** accordance with the commercial license agreement provided with the
|
|
+** Software or, alternatively, in accordance with the terms contained in
|
|
+** a written agreement between you and The Qt Company. For licensing terms
|
|
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
+** information use the contact form at https://www.qt.io/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 3 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 3 requirements
|
|
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
+**
|
|
+** GNU General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU
|
|
+** General Public License version 2.0 or (at your option) the GNU General
|
|
+** Public license version 3 or any later version approved by the KDE Free
|
|
+** Qt Foundation. The licenses are as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
+** included in the packaging of this file. Please review the following
|
|
+** information to ensure the GNU General Public License requirements will
|
|
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
+** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
+**
|
|
+** $QT_END_LICENSE$
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef QACCESSIBLEQUICKWIDGET_H
|
|
+#define QACCESSIBLEQUICKWIDGET_H
|
|
+
|
|
+//
|
|
+// W A R N I N G
|
|
+// -------------
|
|
+//
|
|
+// This file is not part of the Qt API. It exists purely as an
|
|
+// implementation detail. This header file may change from version to
|
|
+// version without notice, or even be removed.
|
|
+//
|
|
+// We mean it.
|
|
+//
|
|
+
|
|
+#include "qquickwidget.h"
|
|
+#include <QtWidgets/qaccessiblewidget.h>
|
|
+
|
|
+#include <private/qaccessiblequickview_p.h>
|
|
+
|
|
+QT_BEGIN_NAMESPACE
|
|
+
|
|
+#if QT_CONFIG(accessibility)
|
|
+
|
|
+// These classes implement the QQuickWiget accessibility switcharoo,
|
|
+// where the child items of the QQuickWidgetOffscreenWindow are reported
|
|
+// as child accessible interfaces of the QAccessibleQuickWidget.
|
|
+class QAccessibleQuickWidget: public QAccessibleWidget
|
|
+{
|
|
+public:
|
|
+ QAccessibleQuickWidget(QQuickWidget* widget);
|
|
+
|
|
+ QAccessibleInterface *child(int index) const override;
|
|
+ int childCount() const override;
|
|
+ int indexOfChild(const QAccessibleInterface *iface) const override;
|
|
+ QAccessibleInterface *childAt(int x, int y) const override;
|
|
+
|
|
+private:
|
|
+ QAccessibleQuickWindow m_accessibleWindow;
|
|
+ Q_DISABLE_COPY(QAccessibleQuickWidget)
|
|
+};
|
|
+
|
|
+class QAccessibleQuickWidgetOffscreenWindow: public QAccessibleQuickWindow
|
|
+{
|
|
+public:
|
|
+ QAccessibleQuickWidgetOffscreenWindow(QQuickWindow *window);
|
|
+ QAccessibleInterface *child(int index) const override;
|
|
+ int childCount() const override;
|
|
+ int indexOfChild(const QAccessibleInterface *iface) const override;
|
|
+ QAccessibleInterface *childAt(int x, int y) const override;
|
|
+};
|
|
+
|
|
+#endif // accessibility
|
|
+
|
|
+QT_END_NAMESPACE
|
|
+
|
|
+#endif
|
|
diff --git a/src/quickwidgets/qaccessiblequickwidgetfactory.cpp b/src/quickwidgets/qaccessiblequickwidgetfactory.cpp
|
|
new file mode 100644
|
|
index 0000000000..7ba88a1769
|
|
--- /dev/null
|
|
+++ b/src/quickwidgets/qaccessiblequickwidgetfactory.cpp
|
|
@@ -0,0 +1,60 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2021 The Qt Company Ltd.
|
|
+** Contact: https://www.qt.io/licensing/
|
|
+**
|
|
+** This file is part of the QtQuick module of the Qt Toolkit.
|
|
+**
|
|
+** $QT_BEGIN_LICENSE:LGPL$
|
|
+** Commercial License Usage
|
|
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
+** accordance with the commercial license agreement provided with the
|
|
+** Software or, alternatively, in accordance with the terms contained in
|
|
+** a written agreement between you and The Qt Company. For licensing terms
|
|
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
+** information use the contact form at https://www.qt.io/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 3 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 3 requirements
|
|
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
+**
|
|
+** GNU General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU
|
|
+** General Public License version 2.0 or (at your option) the GNU General
|
|
+** Public license version 3 or any later version approved by the KDE Free
|
|
+** Qt Foundation. The licenses are as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
+** included in the packaging of this file. Please review the following
|
|
+** information to ensure the GNU General Public License requirements will
|
|
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
+** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
+**
|
|
+** $QT_END_LICENSE$
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "qaccessiblequickwidgetfactory_p.h"
|
|
+#include "qaccessiblequickwidget_p.h"
|
|
+
|
|
+QT_BEGIN_NAMESPACE
|
|
+
|
|
+#if QT_CONFIG(accessibility)
|
|
+
|
|
+QAccessibleInterface *qAccessibleQuickWidgetFactory(const QString &classname, QObject *object)
|
|
+{
|
|
+ if (classname == QLatin1String("QQuickWidget")) {
|
|
+ return new QAccessibleQuickWidget(qobject_cast<QQuickWidget *>(object));
|
|
+ } else if (classname == QLatin1String("QQuickWidgetOffscreenWindow")) {
|
|
+ return new QAccessibleQuickWidgetOffscreenWindow(qobject_cast<QQuickWindow *>(object));
|
|
+ }
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+#endif // accessibility
|
|
+
|
|
+QT_END_NAMESPACE
|
|
+
|
|
diff --git a/src/quickwidgets/qaccessiblequickwidgetfactory_p.h b/src/quickwidgets/qaccessiblequickwidgetfactory_p.h
|
|
new file mode 100644
|
|
index 0000000000..8c63b09f81
|
|
--- /dev/null
|
|
+++ b/src/quickwidgets/qaccessiblequickwidgetfactory_p.h
|
|
@@ -0,0 +1,66 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2021 The Qt Company Ltd.
|
|
+** Contact: https://www.qt.io/licensing/
|
|
+**
|
|
+** This file is part of the QtQuick module of the Qt Toolkit.
|
|
+**
|
|
+** $QT_BEGIN_LICENSE:LGPL$
|
|
+** Commercial License Usage
|
|
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
+** accordance with the commercial license agreement provided with the
|
|
+** Software or, alternatively, in accordance with the terms contained in
|
|
+** a written agreement between you and The Qt Company. For licensing terms
|
|
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
+** information use the contact form at https://www.qt.io/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 3 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 3 requirements
|
|
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
+**
|
|
+** GNU General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU
|
|
+** General Public License version 2.0 or (at your option) the GNU General
|
|
+** Public license version 3 or any later version approved by the KDE Free
|
|
+** Qt Foundation. The licenses are as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
+** included in the packaging of this file. Please review the following
|
|
+** information to ensure the GNU General Public License requirements will
|
|
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
+** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
+**
|
|
+** $QT_END_LICENSE$
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include <QtGui/qaccessible.h>
|
|
+
|
|
+#ifndef QACCESSIBLEQUICKWIDGETFACTORY_H
|
|
+#define QACCESSIBLEQUICKWIDGETFACTORY_H
|
|
+
|
|
+//
|
|
+// W A R N I N G
|
|
+// -------------
|
|
+//
|
|
+// This file is not part of the Qt API. It exists purely as an
|
|
+// implementation detail. This header file may change from version to
|
|
+// version without notice, or even be removed.
|
|
+//
|
|
+// We mean it.
|
|
+//
|
|
+
|
|
+QT_BEGIN_NAMESPACE
|
|
+
|
|
+#if QT_CONFIG(accessibility)
|
|
+
|
|
+QAccessibleInterface *qAccessibleQuickWidgetFactory(const QString &classname, QObject *object);
|
|
+
|
|
+#endif
|
|
+
|
|
+QT_END_NAMESPACE
|
|
+
|
|
+#endif
|
|
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
|
|
index cf021d9a7c..b0117683f7 100644
|
|
--- a/src/quickwidgets/qquickwidget.cpp
|
|
+++ b/src/quickwidgets/qquickwidget.cpp
|
|
@@ -39,6 +39,7 @@
|
|
|
|
#include "qquickwidget.h"
|
|
#include "qquickwidget_p.h"
|
|
+#include "qaccessiblequickwidgetfactory_p.h"
|
|
|
|
#include "private/qquickwindow_p.h"
|
|
#include "private/qquickitem_p.h"
|
|
@@ -75,9 +76,16 @@
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
+QQuickWidgetOffscreenWindow::QQuickWidgetOffscreenWindow(QQuickWindowPrivate &dd, QQuickRenderControl *control)
|
|
+:QQuickWindow(dd, control)
|
|
+{
|
|
+ setTitle(QString::fromLatin1("Offscreen"));
|
|
+ setObjectName(QString::fromLatin1("QQuickOffScreenWindow"));
|
|
+}
|
|
+
|
|
// override setVisble to prevent accidental offscreen window being created
|
|
// by base class.
|
|
-class QQuickOffcreenWindowPrivate: public QQuickWindowPrivate {
|
|
+class QQuickWidgetOffscreenWindowPrivate: public QQuickWindowPrivate {
|
|
public:
|
|
void setVisible(bool visible) override {
|
|
Q_Q(QWindow);
|
|
@@ -105,9 +113,8 @@ void QQuickWidgetPrivate::init(QQmlEngine* e)
|
|
Q_Q(QQuickWidget);
|
|
|
|
renderControl = new QQuickWidgetRenderControl(q);
|
|
- offscreenWindow = new QQuickWindow(*new QQuickOffcreenWindowPrivate(),renderControl);
|
|
- offscreenWindow->setTitle(QString::fromLatin1("Offscreen"));
|
|
- offscreenWindow->setObjectName(QString::fromLatin1("QQuickOffScreenWindow"));
|
|
+ offscreenWindow = new QQuickWidgetOffscreenWindow(*new QQuickWidgetOffscreenWindowPrivate(), renderControl);
|
|
+ offscreenWindow->setScreen(q->screen());
|
|
// Do not call create() on offscreenWindow.
|
|
|
|
// Check if the Software Adaptation is being used
|
|
@@ -138,6 +145,10 @@ void QQuickWidgetPrivate::init(QQmlEngine* e)
|
|
QWidget::connect(offscreenWindow, &QQuickWindow::focusObjectChanged, q, &QQuickWidget::propagateFocusObjectChanged);
|
|
QObject::connect(renderControl, SIGNAL(renderRequested()), q, SLOT(triggerUpdate()));
|
|
QObject::connect(renderControl, SIGNAL(sceneChanged()), q, SLOT(triggerUpdate()));
|
|
+
|
|
+#if QT_CONFIG(accessibility)
|
|
+ QAccessible::installFactory(&qAccessibleQuickWidgetFactory);
|
|
+#endif
|
|
}
|
|
|
|
void QQuickWidgetPrivate::ensureEngine() const
|
|
@@ -901,9 +912,7 @@ void QQuickWidgetPrivate::createContext()
|
|
|
|
context = new QOpenGLContext;
|
|
context->setFormat(offscreenWindow->requestedFormat());
|
|
- const QWindow *win = q->window()->windowHandle();
|
|
- if (win && win->screen())
|
|
- context->setScreen(win->screen());
|
|
+ context->setScreen(q->screen());
|
|
QOpenGLContext *shareContext = qt_gl_global_share_context();
|
|
if (!shareContext)
|
|
shareContext = QWidgetPrivate::get(q->window())->shareContext();
|
|
@@ -1527,19 +1536,16 @@ bool QQuickWidget::event(QEvent *e)
|
|
d->handleWindowChange();
|
|
break;
|
|
|
|
- case QEvent::ScreenChangeInternal:
|
|
- if (QWindow *window = this->window()->windowHandle()) {
|
|
- QScreen *newScreen = window->screen();
|
|
-
|
|
- if (d->offscreenWindow)
|
|
- d->offscreenWindow->setScreen(newScreen);
|
|
- if (d->offscreenSurface)
|
|
- d->offscreenSurface->setScreen(newScreen);
|
|
+ case QEvent::ScreenChangeInternal: {
|
|
+ QScreen *newScreen = screen();
|
|
+ if (d->offscreenWindow)
|
|
+ d->offscreenWindow->setScreen(newScreen);
|
|
+ if (d->offscreenSurface)
|
|
+ d->offscreenSurface->setScreen(newScreen);
|
|
#if QT_CONFIG(opengl)
|
|
- if (d->context)
|
|
- d->context->setScreen(newScreen);
|
|
+ if (d->context)
|
|
+ d->context->setScreen(newScreen);
|
|
#endif
|
|
- }
|
|
|
|
if (d->useSoftwareRenderer
|
|
#if QT_CONFIG(opengl)
|
|
@@ -1552,7 +1558,7 @@ bool QQuickWidget::event(QEvent *e)
|
|
d->render(true);
|
|
}
|
|
break;
|
|
-
|
|
+ }
|
|
case QEvent::Show:
|
|
case QEvent::Move:
|
|
d->updatePosition();
|
|
diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h
|
|
index 881f7f9220..1a946bcc71 100644
|
|
--- a/src/quickwidgets/qquickwidget_p.h
|
|
+++ b/src/quickwidgets/qquickwidget_p.h
|
|
@@ -148,6 +148,14 @@ public:
|
|
bool forceFullUpdate;
|
|
};
|
|
|
|
+class QQuickWidgetOffscreenWindow: public QQuickWindow
|
|
+{
|
|
+ Q_OBJECT
|
|
+
|
|
+public:
|
|
+ QQuickWidgetOffscreenWindow(QQuickWindowPrivate &dd, QQuickRenderControl *control);
|
|
+};
|
|
+
|
|
QT_END_NAMESPACE
|
|
|
|
#endif // QQuickWidget_P_H
|
|
diff --git a/src/quickwidgets/quickwidgets.pro b/src/quickwidgets/quickwidgets.pro
|
|
index 2438e577ae..85d156b8a3 100644
|
|
--- a/src/quickwidgets/quickwidgets.pro
|
|
+++ b/src/quickwidgets/quickwidgets.pro
|
|
@@ -7,9 +7,13 @@ DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES QT_NO_FO
|
|
HEADERS += \
|
|
qquickwidget.h \
|
|
qquickwidget_p.h \
|
|
- qtquickwidgetsglobal.h
|
|
+ qtquickwidgetsglobal.h \
|
|
+ qaccessiblequickwidget_p.h \
|
|
+ qaccessiblequickwidgetfactory_p.h
|
|
|
|
SOURCES += \
|
|
- qquickwidget.cpp
|
|
+ qquickwidget.cpp \
|
|
+ qaccessiblequickwidget.cpp \
|
|
+ qaccessiblequickwidgetfactory.cpp
|
|
|
|
load(qt_module)
|
|
diff --git a/tests/auto/qml/qqmldelegatemodel/data/redrawUponColumnChange.qml b/tests/auto/qml/qqmldelegatemodel/data/redrawUponColumnChange.qml
|
|
new file mode 100644
|
|
index 0000000000..206133bb39
|
|
--- /dev/null
|
|
+++ b/tests/auto/qml/qqmldelegatemodel/data/redrawUponColumnChange.qml
|
|
@@ -0,0 +1,11 @@
|
|
+import QtQuick 2.8
|
|
+
|
|
+ListView {
|
|
+ id: root
|
|
+ width: 200
|
|
+ height: 200
|
|
+
|
|
+ delegate: Text {
|
|
+ text: display
|
|
+ }
|
|
+}
|
|
diff --git a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp
|
|
index f0afdb16ca..e5daf2d28b 100644
|
|
--- a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp
|
|
+++ b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp
|
|
@@ -27,6 +27,8 @@
|
|
****************************************************************************/
|
|
|
|
#include <QtTest/qtest.h>
|
|
+#include <QtCore/QConcatenateTablesProxyModel>
|
|
+#include <QtGui/QStandardItemModel>
|
|
#include <QtQml/qqmlcomponent.h>
|
|
#include <QtQmlModels/private/qqmldelegatemodel_p.h>
|
|
#include <QtQuick/qquickview.h>
|
|
@@ -48,6 +50,8 @@ private slots:
|
|
void qtbug_86017();
|
|
void contextAccessedByHandler();
|
|
void deleteRace();
|
|
+ void redrawUponColumnChange();
|
|
+ void deleteRace();
|
|
};
|
|
|
|
class AbstractItemModel : public QAbstractItemModel
|
|
@@ -187,6 +191,41 @@ void tst_QQmlDelegateModel::deleteRace()
|
|
QTRY_COMPARE(o->property("count").toInt(), 0);
|
|
}
|
|
|
|
+void tst_QQmlDelegateModel::redrawUponColumnChange()
|
|
+{
|
|
+ QStandardItemModel m1;
|
|
+ m1.appendRow({
|
|
+ new QStandardItem("Banana"),
|
|
+ new QStandardItem("Coconut"),
|
|
+ });
|
|
+
|
|
+ QQuickView view(testFileUrl("redrawUponColumnChange.qml"));
|
|
+ QCOMPARE(view.status(), QQuickView::Ready);
|
|
+ view.show();
|
|
+ QQuickItem *root = view.rootObject();
|
|
+ root->setProperty("model", QVariant::fromValue<QObject *>(&m1));
|
|
+
|
|
+ QObject *item = root->property("currentItem").value<QObject *>();
|
|
+ QVERIFY(item);
|
|
+ QCOMPARE(item->property("text").toString(), "Banana");
|
|
+
|
|
+ QVERIFY(root);
|
|
+ m1.removeColumn(0);
|
|
+
|
|
+ QCOMPARE(item->property("text").toString(), "Coconut");
|
|
+}
|
|
+
|
|
+void tst_QQmlDelegateModel::deleteRace()
|
|
+{
|
|
+ QQmlEngine engine;
|
|
+ QQmlComponent c(&engine, testFileUrl("deleteRace.qml"));
|
|
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
|
|
+ QScopedPointer<QObject> o(c.create());
|
|
+ QVERIFY(!o.isNull());
|
|
+ QTRY_COMPARE(o->property("count").toInt(), 2);
|
|
+ QTRY_COMPARE(o->property("count").toInt(), 0);
|
|
+}
|
|
+
|
|
QTEST_MAIN(tst_QQmlDelegateModel)
|
|
|
|
#include "tst_qqmldelegatemodel.moc"
|
|
diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
|
|
index 9c865b3f73..1f788f7a7f 100644
|
|
--- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
|
|
+++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
|
|
@@ -154,6 +154,11 @@ void tst_QQmlImport::importPathOrder()
|
|
engine.addImportPath(QT_QMLTEST_DATADIR);
|
|
expectedImportPaths.prepend(QT_QMLTEST_DATADIR);
|
|
QCOMPARE(expectedImportPaths, engine.importPathList());
|
|
+
|
|
+ // Add qml2Imports again to make it the first of the list
|
|
+ engine.addImportPath(qml2Imports);
|
|
+ expectedImportPaths.move(expectedImportPaths.indexOf(qml2Imports), 0);
|
|
+ QCOMPARE(expectedImportPaths, engine.importPathList());
|
|
}
|
|
|
|
Q_DECLARE_METATYPE(QQmlImports::ImportVersion)
|
|
diff --git a/tests/manual/quickcontrols2/swipedelegate/CloseOnCompletedWorks.qml b/tests/manual/quickcontrols2/swipedelegate/CloseOnCompletedWorks.qml
|
|
new file mode 100644
|
|
index 0000000000..38dfde41c3
|
|
--- /dev/null
|
|
+++ b/tests/manual/quickcontrols2/swipedelegate/CloseOnCompletedWorks.qml
|
|
@@ -0,0 +1,74 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2022 The Qt Company Ltd.
|
|
+** Contact: https://www.qt.io/licensing/
|
|
+**
|
|
+** This file is part of the test suite of the Qt Toolkit.
|
|
+**
|
|
+** $QT_BEGIN_LICENSE:BSD$
|
|
+** Commercial License Usage
|
|
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
+** accordance with the commercial license agreement provided with the
|
|
+** Software or, alternatively, in accordance with the terms contained in
|
|
+** a written agreement between you and The Qt Company. For licensing terms
|
|
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
+** information use the contact form at https://www.qt.io/contact-us.
|
|
+**
|
|
+** BSD License Usage
|
|
+** Alternatively, you may use this file under the terms of the BSD license
|
|
+** as follows:
|
|
+**
|
|
+** "Redistribution and use in source and binary forms, with or without
|
|
+** modification, are permitted provided that the following conditions are
|
|
+** met:
|
|
+** * Redistributions of source code must retain the above copyright
|
|
+** notice, this list of conditions and the following disclaimer.
|
|
+** * Redistributions in binary form must reproduce the above copyright
|
|
+** notice, this list of conditions and the following disclaimer in
|
|
+** the documentation and/or other materials provided with the
|
|
+** distribution.
|
|
+** * Neither the name of The Qt Company Ltd nor the names of its
|
|
+** contributors may be used to endorse or promote products derived
|
|
+** from this software without specific prior written permission.
|
|
+**
|
|
+**
|
|
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
|
+**
|
|
+** $QT_END_LICENSE$
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+import QtQuick 2
|
|
+import QtQuick.Controls 2
|
|
+ApplicationWindow {
|
|
+ visible: true
|
|
+ width: 640
|
|
+ height: 480
|
|
+
|
|
+ ListView {
|
|
+ anchors.fill: parent
|
|
+ model: 2
|
|
+
|
|
+ delegate: SwipeDelegate {
|
|
+ text: "Swipe me left (should not crash)"
|
|
+
|
|
+ swipe.right: Label {
|
|
+ text: "Release (should not crash)"
|
|
+ }
|
|
+
|
|
+ swipe.onCompleted: {
|
|
+ swipe.close()
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+}
|