aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-04-11 11:12:18 +0200
committerLiang Qi <liang.qi@qt.io>2017-04-11 11:12:18 +0200
commit3480c2e0565eeb938fb6fb8ba1dad640fb0a0d12 (patch)
tree47c6963467a3c20326adfebd3cc0c15063ef04ba /src
parent90e7521313fc9e89d492d65f9ad0dca3c38e7225 (diff)
parentd438be92dd7068fef94ce98e1ec039fe0ef4f3b3 (diff)
Merge remote-tracking branch 'origin/5.8' into 5.9
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/masm/masm-defs.pri7
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h11
-rw-r--r--src/qml/parser/qqmljsglobal_p.h16
-rw-r--r--src/qml/qml/qqmldata_p.h8
-rw-r--r--src/qml/qml/qqmlengine.cpp30
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp4
-rw-r--r--src/qml/qml/qqmlproperty.cpp2
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp11
-rw-r--r--src/quick/items/qquickevents.cpp17
-rw-r--r--src/quick/items/qquickrendercontrol.cpp3
-rw-r--r--src/quick/items/qquickwindow.cpp1
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp1
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp1
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp1
-rw-r--r--src/quickwidgets/qquickwidget.cpp4
15 files changed, 67 insertions, 50 deletions
diff --git a/src/3rdparty/masm/masm-defs.pri b/src/3rdparty/masm/masm-defs.pri
index fa0d3d3c55..c0c5f3d114 100644
--- a/src/3rdparty/masm/masm-defs.pri
+++ b/src/3rdparty/masm/masm-defs.pri
@@ -40,3 +40,10 @@ INCLUDEPATH += $$PWD/disassembler/udis86
INCLUDEPATH += $$_OUT_PWD
CONFIG(release, debug|release): DEFINES += NDEBUG
+
+!intel_icc:!clang:gcc {
+ greaterThan(QT_GCC_MAJOR_VERSION, 6) { # GCC 7
+ QMAKE_CXXFLAGS_WARN_ON += -Wno-expansion-to-defined
+ QMAKE_CXXFLAGS += -Wno-expansion-to-defined
+ }
+}
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index b09e06cec5..6494c20bd2 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -209,13 +209,10 @@ inline ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *obje
if (Q_UNLIKELY(QQmlData::wasDeleted(object)))
return QV4::Encode::null();
- QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
- if (Q_LIKELY(priv->declarativeData)) {
- auto ddata = static_cast<QQmlData *>(priv->declarativeData);
- if (Q_LIKELY(ddata->jsEngineId == engine->m_engineId && !ddata->jsWrapper.isUndefined())) {
- // We own the JS object
- return ddata->jsWrapper.value();
- }
+ auto ddata = QQmlData::get(object);
+ if (Q_LIKELY(ddata && ddata->jsEngineId == engine->m_engineId && !ddata->jsWrapper.isUndefined())) {
+ // We own the JS object
+ return ddata->jsWrapper.value();
}
return wrap_slowPath(engine, object);
diff --git a/src/qml/parser/qqmljsglobal_p.h b/src/qml/parser/qqmljsglobal_p.h
index 933c8f5202..0e195994b4 100644
--- a/src/qml/parser/qqmljsglobal_p.h
+++ b/src/qml/parser/qqmljsglobal_p.h
@@ -67,13 +67,17 @@
#else // !QT_CREATOR
# define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
# define QT_QML_END_NAMESPACE QT_END_NAMESPACE
-# if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
- // QmlDevTools is a static library
-# define QML_PARSER_EXPORT
-# elif defined(QT_BUILD_QML_LIB)
-# define QML_PARSER_EXPORT Q_DECL_EXPORT
+# ifndef QT_STATIC
+# if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+ // QmlDevTools is a static library
+# define QML_PARSER_EXPORT
+# elif defined(QT_BUILD_QML_LIB)
+# define QML_PARSER_EXPORT Q_DECL_EXPORT
+# else
+# define QML_PARSER_EXPORT Q_DECL_IMPORT
+# endif
# else
-# define QML_PARSER_EXPORT Q_DECL_IMPORT
+# define QML_PARSER_EXPORT
# endif
#endif // QT_CREATOR
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index e271598c2d..2083326cd5 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -201,7 +201,9 @@ public:
static QQmlData *get(const QObject *object, bool create = false) {
QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
- if (priv->wasDeleted) {
+ // If QObjectData::isDeletingChildren is set then access to QObjectPrivate::declarativeData has
+ // to be avoided because QObjectPrivate::currentChildBeingDeleted is in use.
+ if (priv->isDeletingChildren || priv->wasDeleted) {
Q_ASSERT(!create);
return 0;
} else if (priv->declarativeData) {
@@ -269,8 +271,8 @@ bool QQmlData::wasDeleted(QObject *object)
if (!priv || priv->wasDeleted)
return true;
- return priv->declarativeData &&
- static_cast<QQmlData *>(priv->declarativeData)->isQueuedForDeletion;
+ QQmlData *ddata = QQmlData::get(object);
+ return ddata && ddata->isQueuedForDeletion;
}
QQmlNotifierEndpoint *QQmlData::notify(int index)
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 0521daae81..25a301f59f 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -713,9 +713,7 @@ QQmlEnginePrivate::~QQmlEnginePrivate()
void QQmlPrivate::qdeclarativeelement_destructor(QObject *o)
{
- QObjectPrivate *p = QObjectPrivate::get(o);
- if (p->declarativeData) {
- QQmlData *d = static_cast<QQmlData*>(p->declarativeData);
+ if (QQmlData *d = QQmlData::get(o)) {
if (d->ownContext && d->context) {
d->context->destroy();
d->context = 0;
@@ -885,13 +883,10 @@ void QQmlData::markAsDeleted(QObject *o)
void QQmlData::setQueuedForDeletion(QObject *object)
{
if (object) {
- if (QObjectPrivate *priv = QObjectPrivate::get(object)) {
- if (!priv->wasDeleted && priv->declarativeData) {
- QQmlData *ddata = QQmlData::get(object, false);
- if (ddata->ownContext && ddata->context)
- ddata->context->emitDestruction();
- ddata->isQueuedForDeletion = true;
- }
+ if (QQmlData *ddata = QQmlData::get(object)) {
+ if (ddata->ownContext && ddata->context)
+ ddata->context->emitDestruction();
+ ddata->isQueuedForDeletion = true;
}
}
}
@@ -1340,17 +1335,11 @@ QQmlContext *QQmlEngine::contextForObject(const QObject *object)
if(!object)
return 0;
- QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
-
- QQmlData *data =
- static_cast<QQmlData *>(priv->declarativeData);
-
- if (!data)
- return 0;
- else if (data->outerContext)
+ QQmlData *data = QQmlData::get(object);
+ if (data && data->outerContext)
return data->outerContext->asQQmlContext();
- else
- return 0;
+
+ return 0;
}
/*!
@@ -1885,6 +1874,7 @@ void QQmlData::setPendingBindingBit(QObject *obj, int coreIndex)
QQmlData *QQmlData::createQQmlData(QObjectPrivate *priv)
{
Q_ASSERT(priv);
+ Q_ASSERT(!priv->isDeletingChildren);
priv->declarativeData = new QQmlData;
return static_cast<QQmlData *>(priv->declarativeData);
}
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 85fbd86dc4..2cbcfbbfb6 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -1075,7 +1075,9 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
{
QQmlData *ddata = new (ddataMemory) QQmlData;
ddata->ownMemory = false;
- QObjectPrivate::get(instance)->declarativeData = ddata;
+ QObjectPrivate* p = QObjectPrivate::get(instance);
+ Q_ASSERT(!p->isDeletingChildren);
+ p->declarativeData = ddata;
}
const int parserStatusCast = type->parserStatusCast();
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index ca522c29af..9b5f7b0a06 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1627,7 +1627,7 @@ QMetaMethod QQmlPropertyPrivate::findSignalByName(const QMetaObject *mo, const Q
*/
static inline void flush_vme_signal(const QObject *object, int index, bool indexInSignalRange)
{
- QQmlData *data = static_cast<QQmlData *>(QObjectPrivate::get(const_cast<QObject *>(object))->declarativeData);
+ QQmlData *data = QQmlData::get(object);
if (data && data->propertyCache) {
QQmlPropertyData *property = indexInSignalRange ? data->propertyCache->signal(index)
: data->propertyCache->method(index);
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 34bc266cb5..f26e5f6cdb 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1964,9 +1964,8 @@ void QQmlDelegateModelItem::destroyObject()
Q_ASSERT(object);
Q_ASSERT(contextData);
- QObjectPrivate *p = QObjectPrivate::get(object);
- Q_ASSERT(p->declarativeData);
- QQmlData *data = static_cast<QQmlData*>(p->declarativeData);
+ QQmlData *data = QQmlData::get(object);
+ Q_ASSERT(data);
if (data->ownContext && data->context)
data->context->clearContext();
object->deleteLater();
@@ -1983,10 +1982,8 @@ void QQmlDelegateModelItem::destroyObject()
QQmlDelegateModelItem *QQmlDelegateModelItem::dataForObject(QObject *object)
{
- QObjectPrivate *p = QObjectPrivate::get(object);
- QQmlContextData *context = p->declarativeData
- ? static_cast<QQmlData *>(p->declarativeData)->context
- : 0;
+ QQmlData *d = QQmlData::get(object);
+ QQmlContextData *context = d ? d->context : 0;
for (context = context ? context->parent : 0; context; context = context->parent) {
if (QQmlDelegateModelItem *cacheItem = qobject_cast<QQmlDelegateModelItem *>(
context->contextObject)) {
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index f1f82f9e0e..ac0505da82 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -846,9 +846,24 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i
auto p = m_touchPoints.at(i);
if (p->isAccepted())
continue;
+ // include points where item is the grabber
bool isGrabber = p->grabber() == item;
+ // include newly pressed points inside the bounds
bool isPressInside = p->state() == QQuickEventPoint::Pressed && item->contains(item->mapFromScene(p->scenePos()));
- if (!(isGrabber || isPressInside || isFiltering))
+
+ // filtering: (childMouseEventFilter) include points that are grabbed by children of the target item
+ bool grabberIsChild = false;
+ auto parent = p->grabber();
+ while (isFiltering && parent) {
+ if (parent == item) {
+ grabberIsChild = true;
+ break;
+ }
+ parent = parent->parentItem();
+ }
+ bool filterRelevant = isFiltering && grabberIsChild;
+
+ if (!(isGrabber || isPressInside || filterRelevant))
continue;
const QTouchEvent::TouchPoint *tp = touchPointById(p->pointId());
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index 03d96aea1f..e2a20f9e7e 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -385,6 +385,9 @@ QImage QQuickRenderControl::grab()
cd->syncSceneGraph();
render();
grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false);
+ if (QQuickRenderControl::renderWindowFor(d->window)) {
+ grabContent.setDevicePixelRatio(d->window->effectiveDevicePixelRatio());
+ }
#endif
} else if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::Software) {
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 924de3645b..d4195c7a05 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -3521,6 +3521,7 @@ QImage QQuickWindow::grabWindow()
bool alpha = format().alphaBufferSize() > 0 && color().alpha() < 255;
QImage image = qt_gl_read_framebuffer(size() * effectiveDevicePixelRatio(), alpha, alpha);
+ image.setDevicePixelRatio(effectiveDevicePixelRatio());
d->cleanupNodesOnShutdown();
d->context->invalidate();
context.doneCurrent();
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 48288bfc62..fccc6bf16c 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -423,6 +423,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (data.grabOnly) {
bool alpha = window->format().alphaBufferSize() > 0 && window->color().alpha() != 255;
grabContent = qt_gl_read_framebuffer(window->size() * window->effectiveDevicePixelRatio(), alpha, alpha);
+ grabContent.setDevicePixelRatio(window->effectiveDevicePixelRatio());
data.grabOnly = false;
}
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 5fa74027c1..6b45c0ad04 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -432,6 +432,7 @@ bool QSGRenderThread::event(QEvent *e)
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- grabbing result";
bool alpha = ce->window->format().alphaBufferSize() > 0 && ce->window->color().alpha() != 255;
*ce->image = qt_gl_read_framebuffer(windowSize * ce->window->effectiveDevicePixelRatio(), alpha, alpha);
+ ce->image->setDevicePixelRatio(ce->window->effectiveDevicePixelRatio());
}
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- waking gui to handle result";
waitCondition.wakeOne();
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index e944ddbc4f..eff6763a16 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -325,6 +325,7 @@ QImage QSGWindowsRenderLoop::grab(QQuickWindow *window)
bool alpha = window->format().alphaBufferSize() > 0 && window->color().alpha() != 255;
QImage image = qt_gl_read_framebuffer(window->size() * window->effectiveDevicePixelRatio(), alpha, alpha);
+ image.setDevicePixelRatio(window->effectiveDevicePixelRatio());
return image;
}
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index be5837723a..a2ea0f7af2 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -76,10 +76,6 @@
QT_BEGIN_NAMESPACE
-#if QT_CONFIG(opengl)
-extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
-#endif
-
class QQuickWidgetRenderControl : public QQuickRenderControl
{
public: