aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-08-21 14:26:09 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-08-21 14:30:29 +0200
commitcc1b216c52d42964c9ac816302414cc6ec376dfe (patch)
tree4e282f89572881e963ca4aaf1f1dae44ec2d334a /src/quick/items
parent0fadb710e5639dac9f17d6655eb9edeaadbcbc33 (diff)
parent0af61d773fc7263573afc6b7a973451783bf7424 (diff)
Merge branch 'origin/5.4' into dev
This merges 0af61d773fc7263573afc6b7a973451783bf7424 since there is a circular dependency introduced with a111b1b108f2d3344cb2b2b677e738fd9dd68945 in qtquickcontrols. Change-Id: Ia4fcad8df69326fba3f6b5927151e9d98206e872
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp2
-rw-r--r--src/quick/items/items.pri6
-rw-r--r--src/quick/items/qquickframebufferobject.cpp11
-rw-r--r--src/quick/items/qquickimagebase.cpp4
-rw-r--r--src/quick/items/qquickimagebase_p.h2
-rw-r--r--src/quick/items/qquickitem.cpp8
-rw-r--r--src/quick/items/qquickitem.h2
-rw-r--r--src/quick/items/qquickitemsmodule.cpp2
-rw-r--r--src/quick/items/qquickopenglinfo.cpp200
-rw-r--r--src/quick/items/qquickopenglinfo_p.h122
-rw-r--r--src/quick/items/qquickpathview.cpp17
-rw-r--r--src/quick/items/qquickpathview_p_p.h1
-rw-r--r--src/quick/items/qquickshadereffect.cpp2
-rw-r--r--src/quick/items/qquickshadereffectnode.cpp11
-rw-r--r--src/quick/items/qquickshadereffectnode_p.h1
-rw-r--r--src/quick/items/qquicktextinput.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp77
-rw-r--r--src/quick/items/qquickwindow.h3
-rw-r--r--src/quick/items/qquickwindow_p.h3
19 files changed, 383 insertions, 93 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 57c7bd4a00..b153fc25b2 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -2416,7 +2416,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(QV4::CallContext *c
Adds a quadratic bezier curve between the current point and the endpoint (\c x, \c y) with the control point specified by (\c cpx, \c cpy).
- See \l{http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto}{W3C 2d context standard for for quadraticCurveTo}
+ See \l{http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto}{W3C 2d context standard for quadraticCurveTo}
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(QV4::CallContext *ctx)
{
diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri
index 87e2212dd3..0b98782566 100644
--- a/src/quick/items/items.pri
+++ b/src/quick/items/items.pri
@@ -78,7 +78,8 @@ HEADERS += \
$$PWD/qquickframebufferobject.h \
$$PWD/qquickitemgrabresult.h \
$$PWD/qquickrendercontrol.h \
- $$PWD/qquickrendercontrol_p.h
+ $$PWD/qquickrendercontrol_p.h \
+ $$PWD/qquickopenglinfo_p.h
SOURCES += \
$$PWD/qquickevents.cpp \
@@ -133,7 +134,8 @@ SOURCES += \
$$PWD/qquickwindowattached.cpp \
$$PWD/qquickframebufferobject.cpp \
$$PWD/qquickitemgrabresult.cpp \
- $$PWD/qquickrendercontrol.cpp
+ $$PWD/qquickrendercontrol.cpp \
+ $$PWD/qquickopenglinfo.cpp
SOURCES += \
$$PWD/qquickshadereffect.cpp \
diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp
index 0a8ad36476..fea6aadc23 100644
--- a/src/quick/items/qquickframebufferobject.cpp
+++ b/src/quick/items/qquickframebufferobject.cpp
@@ -235,8 +235,12 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode
n->renderer->synchronize(this);
+ QSize minFboSize = d->sceneGraphContext()->minimumFBOSize();
+ QSize desiredFboSize(qMax<int>(minFboSize.width(), width()),
+ qMax<int>(minFboSize.height(), height()));
+
if (n->fbo && (d->followsItemSize || n->invalidatePending)) {
- if (n->fbo->width() != width() || n->fbo->height() != height()) {
+ if (n->fbo->size() != desiredFboSize) {
delete n->fbo;
n->fbo = 0;
delete n->msDisplayFbo;
@@ -245,10 +249,7 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode
}
if (!n->fbo) {
- QSize minFboSize = d->sceneGraphContext()->minimumFBOSize();
- QSize fboSize(qMax<int>(minFboSize.width(), width()),
- qMax<int>(minFboSize.height(), height()));
- n->fbo = n->renderer->createFramebufferObject(fboSize);
+ n->fbo = n->renderer->createFramebufferObject(desiredFboSize);
GLuint displayTexture = n->fbo->texture();
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index bf67cbef26..738430dc89 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -292,10 +292,10 @@ void QQuickImageBase::handleWindowChanged(QQuickWindow* window)
connect(window, SIGNAL(screenChanged(QScreen*)), this, SLOT(handleScreenChanged(QScreen*)));
}
-void QQuickImageBase::handleScreenChanged(QScreen*)
+void QQuickImageBase::handleScreenChanged(QScreen* screen)
{
// Screen DPI might have changed, reload images on screen change.
- if (isComponentComplete())
+ if (screen && isComponentComplete())
load();
}
diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h
index f0d144a423..14a8560658 100644
--- a/src/quick/items/qquickimagebase_p.h
+++ b/src/quick/items/qquickimagebase_p.h
@@ -107,7 +107,7 @@ private Q_SLOTS:
virtual void requestFinished();
void requestProgress(qint64,qint64);
void handleWindowChanged(QQuickWindow *window);
- void handleScreenChanged(QScreen *);
+ void handleScreenChanged(QScreen *screen);
private:
Q_DISABLE_COPY(QQuickImageBase)
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index d1d9a7cd71..9a8243ead5 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2563,12 +2563,6 @@ void QQuickItem::stackAfter(const QQuickItem *sibling)
*/
/*!
- \qmlproperty Window QtQuick::Item::window
- \since 5.4
- This property holds the window in which the item is rendered.
- */
-
-/*!
Returns the window in which this item is rendered.
The item does not have a window until it has been assigned into a scene. The
@@ -5908,7 +5902,7 @@ void QQuickItem::setFlags(Flags flags)
/*!
\fn void QQuickItem::sceneGraphInitialized()
- This signal is emitted when the scene graph is is initialized for
+ This signal is emitted when the scene graph is initialized for
items that have the ItemHasContents flag set.
When the scene graph is using a dedicated render thread, this
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index 072e1aed75..67a34cc4fa 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -147,8 +147,6 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus
Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged)
Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged)
- Q_PROPERTY(QQuickWindow *window READ window NOTIFY windowChanged REVISION 2)
-
Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickItemLayer *layer READ layer DESIGNABLE false CONSTANT FINAL)
Q_ENUMS(TransformOrigin)
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index d8671390af..b325158165 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -83,6 +83,7 @@
#include "qquickdrag_p.h"
#include "qquickdroparea_p.h"
#include "qquickmultipointtoucharea_p.h"
+#include "qquickopenglinfo_p.h"
#include <private/qqmlmetatype_p.h>
#include <QtQuick/private/qquickaccessibleattached_p.h>
@@ -273,6 +274,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickListView, 2>(uri, 2, 4, "ListView");
qmlRegisterType<QQuickMouseArea, 1>(uri, 2, 4, "MouseArea");
qmlRegisterType<QQuickShaderEffect, 1>(uri, 2, 4, "ShaderEffect");
+ qmlRegisterUncreatableType<QQuickOpenGLInfo>(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties"));
}
static void initResources()
diff --git a/src/quick/items/qquickopenglinfo.cpp b/src/quick/items/qquickopenglinfo.cpp
new file mode 100644
index 0000000000..dbaa92abe1
--- /dev/null
+++ b/src/quick/items/qquickopenglinfo.cpp
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Ltd.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickopenglinfo_p.h"
+#include "qopenglcontext.h"
+#include "qquickwindow.h"
+#include "qquickitem.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype OpenGLInfo
+ \instantiates QQuickOpenGLInfo
+ \inqmlmodule QtQuick
+ \ingroup qtquick-effects
+ \since 5.4
+ \brief Provides information about the used OpenGL version
+
+ The OpenGLInfo attached type provides information about the OpenGL
+ version being used to render the surface of the attachee item.
+
+ If the attachee item is not currently associated with any graphical
+ surface, the properties are set to the values of the default surface
+ format. When it becomes associated with a surface, all properties
+ will update.
+
+ \sa ShaderEffect
+ */
+QQuickOpenGLInfo::QQuickOpenGLInfo(QQuickItem *item)
+ : QObject(item)
+ , m_window(0)
+ , m_majorVersion(2)
+ , m_minorVersion(0)
+ , m_profile(NoProfile)
+ , m_renderableType(Unspecified)
+{
+ connect(item, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(setWindow(QQuickWindow*)));
+ setWindow(item->window());
+}
+
+/*!
+ \qmlproperty int QtQuick::OpenGLInfo::majorVersion
+
+ This property holds the major OpenGL version.
+
+ The default version is \c 2.0.
+
+ \sa minorVersion, profile
+ */
+int QQuickOpenGLInfo::majorVersion() const
+{
+ return m_majorVersion;
+}
+
+/*!
+ \qmlproperty int QtQuick::OpenGLInfo::minorVersion
+
+ This property holds the minor OpenGL version.
+
+ The default version is \c 2.0.
+
+ \sa majorVersion, profile
+ */
+int QQuickOpenGLInfo::minorVersion() const
+{
+ return m_minorVersion;
+}
+
+/*!
+ \qmlproperty enumeration QtQuick::OpenGLInfo::profile
+
+ This property holds the configured OpenGL context profile.
+
+ The possible values are:
+ \list
+ \li OpenGLInfo.NoProfile (default) - OpenGL version is lower than 3.2.
+ \li OpenGLInfo.CoreProfile - Functionality deprecated in OpenGL version 3.0 is not available.
+ \li OpenGLInfo.CompatibilityProfile - Functionality from earlier OpenGL versions is available.
+ \endlist
+
+ Reusable QML components will typically use this property in bindings in order to
+ choose between core and non core profile compatible shader sources.
+
+ \sa majorVersion, minorVersion
+ */
+QQuickOpenGLInfo::ContextProfile QQuickOpenGLInfo::profile() const
+{
+ return m_profile;
+}
+
+/*!
+ \qmlproperty enumeration QtQuick::OpenGLInfo::renderableType
+
+ This property holds the renderable type.
+
+ The possible values are:
+ \list
+ \li OpenGLInfo.Unspecified (default) - Unspecified rendering method
+ \li OpenGLInfo.OpenGL - Desktop OpenGL rendering
+ \li OpenGLInfo.OpenGLES - OpenGL ES rendering
+ \endlist
+ */
+QQuickOpenGLInfo::RenderableType QQuickOpenGLInfo::renderableType() const
+{
+ return m_renderableType;
+}
+
+QQuickOpenGLInfo *QQuickOpenGLInfo::qmlAttachedProperties(QObject *object)
+{
+ if (QQuickItem *item = qobject_cast<QQuickItem *>(object))
+ return new QQuickOpenGLInfo(item);
+ return 0;
+}
+
+void QQuickOpenGLInfo::updateFormat()
+{
+ QOpenGLContext *context = 0;
+ if (m_window)
+ context = m_window->openglContext();
+ QSurfaceFormat format = context ? context->format() : QSurfaceFormat::defaultFormat();
+
+ if (m_majorVersion != format.majorVersion()) {
+ m_majorVersion = format.majorVersion();
+ emit majorVersionChanged();
+ }
+
+ if (m_minorVersion != format.minorVersion()) {
+ m_minorVersion = format.minorVersion();
+ emit minorVersionChanged();
+ }
+
+ ContextProfile profile = static_cast<ContextProfile>(format.profile());
+ if (m_profile != profile) {
+ m_profile = profile;
+ emit profileChanged();
+ }
+
+ RenderableType renderableType = static_cast<RenderableType>(format.renderableType());
+ if (m_renderableType != renderableType) {
+ m_renderableType = renderableType;
+ emit renderableTypeChanged();
+ }
+}
+
+void QQuickOpenGLInfo::setWindow(QQuickWindow *window)
+{
+ if (m_window != window) {
+ if (m_window) {
+ disconnect(m_window, SIGNAL(sceneGraphInitialized()), this, SLOT(updateFormat()));
+ disconnect(m_window, SIGNAL(sceneGraphInvalidated()), this, SLOT(updateFormat()));
+ }
+ if (window) {
+ connect(window, SIGNAL(sceneGraphInitialized()), this, SLOT(updateFormat()));
+ connect(window, SIGNAL(sceneGraphInvalidated()), this, SLOT(updateFormat()));
+ }
+ m_window = window;
+ }
+ updateFormat();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quick/items/qquickopenglinfo_p.h b/src/quick/items/qquickopenglinfo_p.h
new file mode 100644
index 0000000000..70684a2f40
--- /dev/null
+++ b/src/quick/items/qquickopenglinfo_p.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Ltd.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKOPENGLINFO_P_H
+#define QQUICKOPENGLINFO_P_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 <QtCore/qobject.h>
+#include <QtCore/qpointer.h>
+#include <QtGui/qsurfaceformat.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItem;
+class QQuickWindow;
+
+class QQuickOpenGLInfo : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int majorVersion READ majorVersion NOTIFY majorVersionChanged FINAL)
+ Q_PROPERTY(int minorVersion READ minorVersion NOTIFY minorVersionChanged FINAL)
+ Q_PROPERTY(ContextProfile profile READ profile NOTIFY profileChanged FINAL)
+ Q_PROPERTY(RenderableType renderableType READ renderableType NOTIFY renderableTypeChanged FINAL)
+ Q_ENUMS(ContextProfile RenderableType)
+
+public:
+ QQuickOpenGLInfo(QQuickItem *item = 0);
+
+ int majorVersion() const;
+ int minorVersion() const;
+
+ // keep in sync with QSurfaceFormat::OpenGLContextProfile
+ enum ContextProfile {
+ NoProfile = QSurfaceFormat::NoProfile,
+ CoreProfile = QSurfaceFormat::CoreProfile,
+ CompatibilityProfile = QSurfaceFormat::CompatibilityProfile
+ };
+ ContextProfile profile() const;
+
+ // keep in sync with QSurfaceFormat::RenderableType
+ enum RenderableType {
+ Unspecified = QSurfaceFormat::DefaultRenderableType,
+ OpenGL = QSurfaceFormat::OpenGL,
+ OpenGLES = QSurfaceFormat::OpenGLES
+ };
+ RenderableType renderableType() const;
+
+ static QQuickOpenGLInfo *qmlAttachedProperties(QObject *object);
+
+Q_SIGNALS:
+ void majorVersionChanged();
+ void minorVersionChanged();
+ void profileChanged();
+ void renderableTypeChanged();
+
+private Q_SLOTS:
+ void updateFormat();
+ void setWindow(QQuickWindow *window);
+
+private:
+ QPointer<QQuickWindow> m_window;
+ int m_majorVersion;
+ int m_minorVersion;
+ ContextProfile m_profile;
+ RenderableType m_renderableType;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QQuickOpenGLInfo, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKOPENGLINFO_P_H
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index efce244f7d..216b7cc7c1 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1599,6 +1599,7 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)
return;
startPoint = pointNear(event->localPos(), &startPc);
+ startPos = event->localPos();
if (idx == items.count()) {
qreal distance = qAbs(event->localPos().x() - startPoint.x()) + qAbs(event->localPos().y() - startPoint.y());
if (distance > dragMargin)
@@ -1621,8 +1622,6 @@ void QQuickPathView::mouseMoveEvent(QMouseEvent *event)
Q_D(QQuickPathView);
if (d->interactive) {
d->handleMouseMoveEvent(event);
- if (d->stealMouse)
- setKeepMouseGrab(true);
event->accept();
} else {
QQuickItem::mouseMoveEvent(event);
@@ -1639,9 +1638,17 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event)
qreal newPc;
QPointF pathPoint = pointNear(event->localPos(), &newPc);
if (!stealMouse) {
- QPointF delta = pathPoint - startPoint;
- if (qAbs(delta.x()) > qApp->styleHints()->startDragDistance() || qAbs(delta.y()) > qApp->styleHints()->startDragDistance()) {
- stealMouse = true;
+ QPointF posDelta = event->localPos() - startPos;
+ if (QQuickWindowPrivate::dragOverThreshold(posDelta.y(), Qt::YAxis, event) || QQuickWindowPrivate::dragOverThreshold(posDelta.x(), Qt::XAxis, event)) {
+ // The touch has exceeded the threshold. If the movement along the path is close to the drag threshold
+ // then we'll assume that this gesture targets the PathView. This ensures PathView gesture grabbing
+ // is in sync with other items.
+ QPointF pathDelta = pathPoint - startPoint;
+ if (qAbs(pathDelta.x()) > qApp->styleHints()->startDragDistance() * 0.8
+ || qAbs(pathDelta.y()) > qApp->styleHints()->startDragDistance() * 0.8) {
+ stealMouse = true;
+ q->setKeepMouseGrab(true);
+ }
}
} else {
moveReason = QQuickPathViewPrivate::Mouse;
diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h
index 6b6ad054f2..2558adbd94 100644
--- a/src/quick/items/qquickpathview_p_p.h
+++ b/src/quick/items/qquickpathview_p_p.h
@@ -135,6 +135,7 @@ public:
qreal currentItemOffset;
qreal startPc;
QPointF startPoint;
+ QPointF startPos;
qreal offset;
qreal offsetAdj;
qreal mappedRange;
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 9dfce3fb28..148c33d2cd 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -651,6 +651,8 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
\note Scene Graph textures have origin in the top-left corner rather than
bottom-left which is common in OpenGL.
+
+ For information about the GLSL version being used, see \l QtQuick::OpenGLInfo.
*/
QQuickShaderEffect::QQuickShaderEffect(QQuickItem *parent)
diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp
index d7bd5e5a4b..377f78ddb4 100644
--- a/src/quick/items/qquickshadereffectnode.cpp
+++ b/src/quick/items/qquickshadereffectnode.cpp
@@ -329,6 +329,11 @@ bool QQuickShaderEffectMaterialKey::operator == (const QQuickShaderEffectMateria
return true;
}
+bool QQuickShaderEffectMaterialKey::operator != (const QQuickShaderEffectMaterialKey &other) const
+{
+ return !(*this == other);
+}
+
uint qHash(const QQuickShaderEffectMaterialKey &key)
{
uint hash = qHash((void *)key.className);
@@ -381,9 +386,13 @@ bool QQuickShaderEffectMaterial::UniformData::operator == (const UniformData &ot
int QQuickShaderEffectMaterial::compare(const QSGMaterial *o) const
{
const QQuickShaderEffectMaterial *other = static_cast<const QQuickShaderEffectMaterial *>(o);
+ if (!supportsAtlasTextures || !other->supportsAtlasTextures)
+ return 1;
+ if (bool(flags() & QSGMaterial::RequiresFullMatrix) || bool(other->flags() & QSGMaterial::RequiresFullMatrix))
+ return 1;
if (cullMode != other->cullMode)
return 1;
- if (supportsAtlasTextures != other->supportsAtlasTextures)
+ if (m_source != other->m_source)
return 1;
for (int shaderType = 0; shaderType < QQuickShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
if (uniforms[shaderType] != other->uniforms[shaderType])
diff --git a/src/quick/items/qquickshadereffectnode_p.h b/src/quick/items/qquickshadereffectnode_p.h
index 20fcc0e43e..e6ebfbbdfd 100644
--- a/src/quick/items/qquickshadereffectnode_p.h
+++ b/src/quick/items/qquickshadereffectnode_p.h
@@ -65,6 +65,7 @@ struct QQuickShaderEffectMaterialKey {
const char *className;
bool operator == (const QQuickShaderEffectMaterialKey &other) const;
+ bool operator != (const QQuickShaderEffectMaterialKey &other) const;
};
uint qHash(const QQuickShaderEffectMaterialKey &key);
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 37e94cddc0..f2cf89c1b9 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1411,7 +1411,7 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const
This means that for all x values before the first character this function returns 0,
and for all x values after the last character this function returns text.length. If
the y value is above the text the position will be that of the nearest character on
- the first line line and if it is below the text the position of the nearest character
+ the first line and if it is below the text the position of the nearest character
on the last line will be returned.
The cursor position type specifies how the cursor position should be resolved.
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index c1f9404040..19762ca9f3 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -87,8 +87,6 @@ Q_LOGGING_CATEGORY(DBG_DIRTY, "qt.quick.dirty");
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
bool QQuickWindowPrivate::defaultAlphaBuffer = false;
-bool QQuickWindowPrivate::defaultFormatInitialized = false;
-QSurfaceFormat QQuickWindowPrivate::defaultFormat;
void QQuickWindowPrivate::updateFocusItemTransform()
{
@@ -192,7 +190,7 @@ having no effect if an item is removed from a window.
When an item is moved into a new focus scope (either being added to a window
for the first time, or having its parent changed), if the focus scope already has
a scope focused item that takes precedence over the item being added. Otherwise,
-the focus of the added tree is used. In the case of of a tree of items being
+the focus of the added tree is used. In the case of a tree of items being
added to a window for the first time, which may have a conflicted focus state (two
or more items in one scope having focus set), the same rule is applied item by item -
thus the first item that has focus will get it (assuming the scope doesn't already
@@ -466,7 +464,7 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
}
q->setSurfaceType(windowManager ? windowManager->windowSurfaceType() : QSurface::OpenGLSurface);
- q->setFormat(q->defaultFormat());
+ q->setFormat(sg->defaultSurfaceFormat());
animationController = new QQuickAnimatorController();
animationController->m_window = q;
@@ -1055,8 +1053,18 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
\note All classes with QSG prefix should be used solely on the scene graph's
rendering thread. See \l {Scene Graph and Rendering} for more information.
- \sa {Scene Graph - OpenGL Under QML}
+ \section2 Context and surface formats
+ While it is possible to specify a QSurfaceFormat for every QQuickWindow by
+ calling the member function setFormat(), windows may also be created from
+ QML by using the Window and ApplicationWindow elements. In this case there
+ is no C++ code involved in the creation of the window instance, yet
+ applications may still wish to set certain surface format values, for
+ example to request a given OpenGL version or profile. Such applications can
+ call the static function QSurfaceFormat::setDefaultFormat() at startup. The
+ specified format will be used for all Quick windows created afterwards.
+
+ \sa {Scene Graph - OpenGL Under QML}
*/
/*!
@@ -3535,11 +3543,7 @@ bool QQuickWindow::hasDefaultAlphaBuffer()
In any application which expects to create translucent windows, it's necessary to set
this to true before creating the first QQuickWindow. The default value is false.
- \note This function affects the size of the alpha buffer in the format returned by
- defaultFormat(). Enabling alpha via this function and passing a format with alpha
- buffer size 8 to setDefaultFormat() are equivalent.
-
- \sa hasDefaultAlphaBuffer(), setDefaultFormat(), defaultFormat()
+ \sa hasDefaultAlphaBuffer()
*/
void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha)
{
@@ -3619,53 +3623,6 @@ void QQuickWindow::resetOpenGLState()
}
/*!
- \brief QQuickWindow::setDefaultFormat
- \since 5.4
- @brief Sets the global default surface format that is used for all new QQuickWindow instances.
-
- While it is possible to specify a QSurfaceFormat for every QQuickWindow by
- calling the member function setFormat(), windows may also be created from
- QML by using the Window and ApplicationWindow elements. In this case there
- is no C++ code involved in the creation of the window instance, yet
- applications may still wish to set certain surface format values, for
- example to request a given OpenGL version or profile. Such applications can
- call this static functions in main(). \a format will be used for all Quick
- windows created afterwards.
-
- \note The default value for the default format is not necessarily a
- default-constructed QSurfaceFormat. It may already have depth, stencil and alpha
- buffer sizes set. Unless there is a need to change all these sizes, the format should
- first be queried via defaultFormat() and the changes should be applied to that,
- instead of merely starting with a default-constructed QSurfaceFormat.
-
- \sa setFormat(), format(), defaultFormat()
- */
-void QQuickWindow::setDefaultFormat(const QSurfaceFormat &format)
-{
- QQuickWindowPrivate::defaultFormatInitialized = true;
- QQuickWindowPrivate::defaultFormat = format;
-}
-
-/*!
- \brief QQuickWindow::defaultFormat
- \since 5.4
-
- \return The global default surface format that is used for all QQuickWindow instances.
-
- \note This function requires a QGuiApplication or QApplication instance.
-
- \sa setDefaultFormat()
- */
-QSurfaceFormat QQuickWindow::defaultFormat()
-{
- if (!QQuickWindowPrivate::defaultFormatInitialized) {
- QQuickWindowPrivate::defaultFormatInitialized = true;
- QQuickWindowPrivate::defaultFormat = QSGRenderLoop::instance()->sceneGraphContext()->defaultSurfaceFormat();
- }
- return QQuickWindowPrivate::defaultFormat;
-}
-
-/*!
\brief QQuickWindow::glslVersion
\since 5.4
\return The OpenGL Shading Language version for this window.
@@ -3687,7 +3644,7 @@ QSurfaceFormat QQuickWindow::defaultFormat()
OpenGL 2 style shaders. The most important for reusable components is to check for
core profiles since these do not accept shaders with the old syntax.
- \sa setFormat(), setDefaultFormat(), glslIsCoreProfile()
+ \sa setFormat(), glslIsCoreProfile()
*/
QString QQuickWindow::glslVersion() const
{
@@ -3738,7 +3695,7 @@ QString QQuickWindow::glslVersion() const
To retrieve more information about the shading language, use glslVersion().
- \sa glslVersion(), setFormat(), setDefaultFormat()
+ \sa glslVersion(), setFormat()
*/
bool QQuickWindow::glslIsCoreProfile() const
{
@@ -3854,7 +3811,7 @@ bool QQuickWindow::glslIsCoreProfile() const
\qmlattachedproperty QWindow::Visibility Window::visibility
\since 5.4
- This attached property holds whether whether the window is currently shown
+ This attached property holds whether the window is currently shown
in the windowing system as normal, minimized, maximized, fullscreen or
hidden. The Window attached property can be attached to any Item. If the
item is not shown in any window, the value will be \l {QWindow::}{Hidden}.
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index 21389f6155..00dbbbfcc5 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -150,9 +150,6 @@ public:
QOpenGLContext *openglContext() const;
- static void setDefaultFormat(const QSurfaceFormat &format);
- static QSurfaceFormat defaultFormat();
-
QString glslVersion() const;
bool glslIsCoreProfile() const;
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 93ceefe5af..c8f156ed37 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -258,9 +258,6 @@ public:
QString *untranslatedMessage,
bool isEs);
- static bool defaultFormatInitialized;
- static QSurfaceFormat defaultFormat;
-
QMutex renderJobMutex;
QList<QRunnable *> beforeSynchronizingJobs;
QList<QRunnable *> afterSynchronizingJobs;