aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-12-15 12:44:11 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-12-15 12:44:20 +0100
commit6812d1921161612788ac2f7c49decce77c8e0ccd (patch)
treecec87e29e40c69d72ca5d7ca126c31b3eff10635 /src/quick
parenta1c6480360560ba73d9d4797ed970103c53ba7a4 (diff)
parent0e80d28aa5892d6bbb4d0017b1bc9a33489f4176 (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp4
-rw-r--r--src/quick/accessible/qaccessiblequickitem_p.h4
-rw-r--r--src/quick/accessible/qaccessiblequickview.cpp4
-rw-r--r--src/quick/accessible/qaccessiblequickview_p.h4
-rw-r--r--src/quick/accessible/qquickaccessiblefactory.cpp2
-rw-r--r--src/quick/accessible/qquickaccessiblefactory_p.h2
-rw-r--r--src/quick/designer/qquickdesignercustomobjectdata.cpp2
-rw-r--r--src/quick/designer/qquickdesignersupport.cpp2
-rw-r--r--src/quick/designer/qquickdesignerwindowmanager.cpp4
-rw-r--r--src/quick/designer/qquickdesignerwindowmanager_p.h4
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc80
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp2
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp14
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp2
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture.cpp10
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture_p.h8
-rw-r--r--src/quick/items/context2d/qquickcontext2dtile.cpp4
-rw-r--r--src/quick/items/context2d/qquickcontext2dtile_p.h4
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp2
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h4
-rw-r--r--src/quick/items/qquickdrag.cpp4
-rw-r--r--src/quick/items/qquickdrag_p.h6
-rw-r--r--src/quick/items/qquickdroparea.cpp4
-rw-r--r--src/quick/items/qquickdroparea_p.h4
-rw-r--r--src/quick/items/qquickevents.cpp2
-rw-r--r--src/quick/items/qquickevents_p_p.h9
-rw-r--r--src/quick/items/qquickflickable.cpp2
-rw-r--r--src/quick/items/qquickflickable_p.h2
-rw-r--r--src/quick/items/qquickgraphicsinfo.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp68
-rw-r--r--src/quick/items/qquickitem.h14
-rw-r--r--src/quick/items/qquickitem_p.h10
-rw-r--r--src/quick/items/qquickitemsmodule.cpp8
-rw-r--r--src/quick/items/qquickmousearea.cpp30
-rw-r--r--src/quick/items/qquickmousearea_p.h12
-rw-r--r--src/quick/items/qquickmousearea_p_p.h4
-rw-r--r--src/quick/items/qquickpainteditem.cpp2
-rw-r--r--src/quick/items/qquickpincharea.cpp4
-rw-r--r--src/quick/items/qquickrendercontrol.cpp8
-rw-r--r--src/quick/items/qquickshadereffect.cpp48
-rw-r--r--src/quick/items/qquickshadereffect_p.h2
-rw-r--r--src/quick/items/qquickspriteengine.cpp11
-rw-r--r--src/quick/items/qquickspriteengine_p.h2
-rw-r--r--src/quick/items/qquicktext.cpp6
-rw-r--r--src/quick/items/qquicktextcontrol.cpp96
-rw-r--r--src/quick/items/qquicktextcontrol_p.h9
-rw-r--r--src/quick/items/qquicktextcontrol_p_p.h8
-rw-r--r--src/quick/items/qquicktextdocument.cpp2
-rw-r--r--src/quick/items/qquicktextedit.cpp72
-rw-r--r--src/quick/items/qquicktextedit_p.h6
-rw-r--r--src/quick/items/qquicktextedit_p_p.h6
-rw-r--r--src/quick/items/qquicktextinput.cpp160
-rw-r--r--src/quick/items/qquicktextinput_p.h8
-rw-r--r--src/quick/items/qquicktextinput_p_p.h28
-rw-r--r--src/quick/items/qquicktextnode.cpp12
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp6
-rw-r--r--src/quick/items/qquickwindow.cpp68
-rw-r--r--src/quick/items/qquickwindow.h8
-rw-r--r--src/quick/items/qquickwindow_p.h28
-rw-r--r--src/quick/qtquick2.cpp5
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp12
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp24
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp6
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp4
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp10
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.h12
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterialshader_p.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp24
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer_p.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendererinterface.cpp1
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendererinterface.h3
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp6
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h10
-rw-r--r--src/quick/scenegraph/qsgbasicglyphnode_p.h14
-rw-r--r--src/quick/scenegraph/qsgcontextplugin.cpp12
-rw-r--r--src/quick/scenegraph/qsgcontextplugin_p.h6
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h8
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p_p.h16
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.h18
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h34
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp24
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp24
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop_p.h30
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp21
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop_p.h26
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp17
-rw-r--r--src/quick/scenegraph/util/qsgdistancefieldutil.cpp2
-rw-r--r--src/quick/scenegraph/util/qsgengine.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.cpp10
-rw-r--r--src/quick/scenegraph/util/qsgsimplematerial.h10
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp36
-rw-r--r--src/quick/scenegraph/util/qsgtexture_p.h2
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.cpp18
-rw-r--r--src/quick/scenegraph/util/qsgvertexcolormaterial.cpp10
-rw-r--r--src/quick/util/qquickanimatorjob_p.h2
-rw-r--r--src/quick/util/qquickglobal.cpp2
-rw-r--r--src/quick/util/qquickprofiler_p.h141
-rw-r--r--src/quick/util/qquickpropertychanges.cpp12
-rw-r--r--src/quick/util/qquickstate_p_p.h2
-rw-r--r--src/quick/util/qquickutilmodule.cpp4
-rw-r--r--src/quick/util/qquickvalidator.cpp4
-rw-r--r--src/quick/util/qquickvalidator_p.h4
102 files changed, 886 insertions, 693 deletions
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
index 03236ce2f7..fbde5d354d 100644
--- a/src/quick/accessible/qaccessiblequickitem.cpp
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
@@ -47,7 +47,7 @@
#include "QtQuick/qquicktextdocument.h"
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item)
: QAccessibleObject(item), m_doc(textDocument())
@@ -591,6 +591,6 @@ void QAccessibleQuickItem::setSelection(int /* selectionIndex */, int /* startOf
}
-#endif // QT_NO_ACCESSIBILITY
+#endif // accessibility
QT_END_NAMESPACE
diff --git a/src/quick/accessible/qaccessiblequickitem_p.h b/src/quick/accessible/qaccessiblequickitem_p.h
index 7445fd1400..577a105627 100644
--- a/src/quick/accessible/qaccessiblequickitem_p.h
+++ b/src/quick/accessible/qaccessiblequickitem_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
class QTextDocument;
@@ -141,7 +141,7 @@ private:
QRect itemScreenRect(QQuickItem *item);
QList<QQuickItem *> accessibleUnignoredChildren(QQuickItem *item, bool paintOrder = false);
-#endif // QT_NO_ACCESSIBILITY
+#endif // accessibility
QT_END_NAMESPACE
diff --git a/src/quick/accessible/qaccessiblequickview.cpp b/src/quick/accessible/qaccessiblequickview.cpp
index edd39ed9db..222690e4f2 100644
--- a/src/quick/accessible/qaccessiblequickview.cpp
+++ b/src/quick/accessible/qaccessiblequickview.cpp
@@ -46,7 +46,7 @@
#include "qaccessiblequickitem_p.h"
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QT_BEGIN_NAMESPACE
@@ -145,4 +145,4 @@ int QAccessibleQuickWindow::indexOfChild(const QAccessibleInterface *iface) cons
QT_END_NAMESPACE
-#endif // QT_NO_ACCESSIBILITY
+#endif // accessibility
diff --git a/src/quick/accessible/qaccessiblequickview_p.h b/src/quick/accessible/qaccessiblequickview_p.h
index e9c150ac22..7c103380cb 100644
--- a/src/quick/accessible/qaccessiblequickview_p.h
+++ b/src/quick/accessible/qaccessiblequickview_p.h
@@ -56,7 +56,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
class QAccessibleQuickWindow : public QAccessibleObject
{
@@ -80,7 +80,7 @@ private:
QList<QQuickItem *> rootItems() const;
};
-#endif // QT_NO_ACCESSIBILITY
+#endif // accessibility
QT_END_NAMESPACE
diff --git a/src/quick/accessible/qquickaccessiblefactory.cpp b/src/quick/accessible/qquickaccessiblefactory.cpp
index 69a74f2b3d..a1fa695e5a 100644
--- a/src/quick/accessible/qquickaccessiblefactory.cpp
+++ b/src/quick/accessible/qquickaccessiblefactory.cpp
@@ -44,7 +44,7 @@
#include <QtQuick/private/qquickitem_p.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessibleInterface *qQuickAccessibleFactory(const QString &classname, QObject *object)
{
diff --git a/src/quick/accessible/qquickaccessiblefactory_p.h b/src/quick/accessible/qquickaccessiblefactory_p.h
index 6407b70223..ab8eb12ca4 100644
--- a/src/quick/accessible/qquickaccessiblefactory_p.h
+++ b/src/quick/accessible/qquickaccessiblefactory_p.h
@@ -54,7 +54,7 @@
#include <QtGui/qaccessible.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessibleInterface *qQuickAccessibleFactory(const QString &classname, QObject *object);
diff --git a/src/quick/designer/qquickdesignercustomobjectdata.cpp b/src/quick/designer/qquickdesignercustomobjectdata.cpp
index e37254d165..ca9c1259fd 100644
--- a/src/quick/designer/qquickdesignercustomobjectdata.cpp
+++ b/src/quick/designer/qquickdesignercustomobjectdata.cpp
@@ -258,7 +258,7 @@ void QQuickDesignerCustomObjectData::setPropertyBinding(QQmlContext *context,
if (property.isProperty()) {
QQmlBinding *binding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core,
- expression, object(), context);
+ expression, object(), QQmlContextData::get(context));
binding->setTarget(property);
binding->setNotifyOnValueChanged(true);
diff --git a/src/quick/designer/qquickdesignersupport.cpp b/src/quick/designer/qquickdesignersupport.cpp
index 3ff5a3ce96..749ece8221 100644
--- a/src/quick/designer/qquickdesignersupport.cpp
+++ b/src/quick/designer/qquickdesignersupport.cpp
@@ -95,7 +95,7 @@ void QQuickDesignerSupport::refFromEffectItem(QQuickItem *referencedItem, bool h
texture->setRect(referencedItem->boundingRect());
texture->setSize(referencedItem->boundingRect().size().toSize());
texture->setRecursive(true);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#ifndef QT_OPENGL_ES
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL)
texture->setFormat(GL_RGBA8);
diff --git a/src/quick/designer/qquickdesignerwindowmanager.cpp b/src/quick/designer/qquickdesignerwindowmanager.cpp
index 2d37db08e7..e2d7b98c33 100644
--- a/src/quick/designer/qquickdesignerwindowmanager.cpp
+++ b/src/quick/designer/qquickdesignerwindowmanager.cpp
@@ -39,7 +39,7 @@
#include "qquickdesignerwindowmanager_p.h"
#include "private/qquickwindow_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtQuick/private/qsgdefaultrendercontext_p.h>
#endif
#include <QtQuick/QQuickWindow>
@@ -67,7 +67,7 @@ void QQuickDesignerWindowManager::windowDestroyed(QQuickWindow *)
void QQuickDesignerWindowManager::makeOpenGLContext(QQuickWindow *window)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (!m_openGlContext) {
m_openGlContext.reset(new QOpenGLContext());
m_openGlContext->setFormat(window->requestedFormat());
diff --git a/src/quick/designer/qquickdesignerwindowmanager_p.h b/src/quick/designer/qquickdesignerwindowmanager_p.h
index 209d703d0a..5322b6c421 100644
--- a/src/quick/designer/qquickdesignerwindowmanager_p.h
+++ b/src/quick/designer/qquickdesignerwindowmanager_p.h
@@ -57,7 +57,7 @@
#include <private/qtquickglobal_p.h>
#include <QtQuick/private/qsgcontext_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/QOpenGLContext>
#endif
@@ -97,7 +97,7 @@ public:
static void createOpenGLContext(QQuickWindow *window);
private:
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QScopedPointer<QOpenGLContext> m_openGlContext;
#endif
QScopedPointer<QSGContext> m_sgContext;
diff --git a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
index 9ce26e1bb8..3fd92177f9 100644
--- a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
@@ -58,6 +58,8 @@ The supported backends are the following
\li Direct3D 12 - Requested by the string \c{"d3d12"} or the enum value QSGRendererInterface::Direct3D12.
+\li OpenVG - Requested by the string \c{"openvg"} or the enum value QSGRendererInterface::OpenVG.
+
\endlist
When in doubt which backend is in use, enable basic scenegraph information
@@ -92,6 +94,14 @@ running on Windows 10, both for Win32 and UWP applications. The details for
this adaptation are available here:
\l{qtquick-visualcanvas-adaptations-d3d12.html}{Direct3D 12 Adaptation}
+\section1 OpenVG
+
+The OpenVG adaptation is an alternative renderer for \l {Qt Quick} 2 that will
+renderer the contents of the scene graph using OpenVG commands to provide
+hardware-acclerated 2D vector and raster graphics. The details for this
+adaptation are available here:
+\l{qtquick-visualcanvas-scenegraph-openvg.html}{OpenVG Adaptation}
+
*/
@@ -387,3 +397,73 @@ between the frames). By default blocking present is disabled.
\endlist
*/
+
+/*!
+\title Qt Quick OpenVG Adaptation
+\page qtquick-visualcanvas-adaptations-openvg.html
+
+The OpenVG adaptation is an alternative renderer for \l {Qt Quick} 2 that will
+renderer the contents of the scene graph using OpenVG commands to provide
+hardware-acclerated 2D vector and raster graphics. Much like the Software
+adaptation, some features and optimizations are no longer available. Most
+Qt Quick 2 applications will run without modification though any attempts to
+use unsupported features will be ignored.
+
+\section2 EGL Requirement
+Unlike the defualt OpenGL Renderer, there is no built in support for acquiring
+an OpenVG context. This means that the renderer has the responsbility of
+requesting and managing the the current context. To do this EGL has to be used
+directly in the OpenVG renderer. This means that the OpenVG renderer is only
+usable with platform plugins that support creating QWindows with support for
+QSurfaceFormat::OpenVG. From this window, the renderer can get an EGLSurface
+which can be used with an EGLContext to render OpenVG content.
+
+\section2 Renderer
+The OpenVG Renderer works by using the OpenVG API to send commands and data to
+a Vector GPU which will render the scenegraph in an accelerated manner, offloading
+graphics rendering from the CPU. Many operations like the rendering of rectangles
+and fonts glyphs ideal for OpenVG because these can be represented as paths which
+are stroked and filled. Rendering scenegraph items that would typically involve
+textures are handled in the OpenVG renderer by using VGImage. In addition when
+rendering to offscreen surfaces (like when using Layers), the scene subtree is
+rendered to a VGImage which can be reused in the scene.
+
+\section2 Render Loop
+The OpenVG Renderer mirrors the behavior of the Basic render loop and will execute
+all OpenVG commands in a single thread.
+
+See the \l{qtquick-visualcanvas-scenegraph.html}{Scene Graph page} for more
+information on render loops
+
+\section2 Shader Effects
+ShaderEffect components in QtQuick 2 can not be rendered by the OpenVG adaptation.
+While it is possible to user ShaderEffectSource and QML Item Layers (which are both
+offscreen surfaces), it is not actually possible to apply shader effects to them
+via the ShaderEffect item. This is because OpenVG lacks an API for applying per
+vertex and per fragment shader operations. It may be possible however to take
+advantage of Image Filter operations in the OpenVG API to get similar effects to
+what is provided by ShaderEffects in custom items. To integrate custom OpenVG
+rendering, use QSGRenderNode in combination with QSGRendererInterface.
+
+\section2 Qt Graphical Effects Module
+\l {Qt Graphical Effects} uses ShaderEffect items to render effects. If you use
+graphical effects from this module, then you should not hide the source
+item so that the original item can still be rendered.
+
+\section2 Particle Effects
+It is not possible to render particle effects with the OpenVG adaptation. Whenever
+possible, remove particles completely from the scene. Otherwise they will still
+require some processing, even though they are not visible.
+
+\section2 Rendering Text
+The text rendering with the OpenVG adaptation is based on rendering the glpyh
+paths, and does not use the distance fields technique used by the OpenGL backend.
+
+\section2 Perspective Transforms
+The OpenVG API does not allow paths to be transformed with non-affine transforms,
+while it is possible with Qt Quick. This means that rendering components using
+paths like Rectangles and Text, when applying perspective transforms the OpenVG
+backend will first render to a VGImage before applying transformations. This uses
+more memory at runtime and is a slower path so avoid doing this if necessary.
+
+*/
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index dcad719ef0..78db92ba8a 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -802,7 +802,7 @@ QSGTextureProvider *QQuickCanvasItem::textureProvider() const
return QQuickItem::textureProvider();
Q_D(const QQuickCanvasItem);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QQuickWindow *w = window();
if (!w || !w->isSceneGraphInitialized()
|| QThread::currentThread() != QQuickWindowPrivate::get(w)->context->thread()) {
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 2483a8eadb..bcaedd67b4 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -75,7 +75,7 @@
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <private/qsgdefaultrendercontext_p.h>
#endif
@@ -3997,7 +3997,7 @@ public:
~QQuickContext2DThreadCleanup()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
context->makeCurrent(surface);
delete texture;
context->doneCurrent();
@@ -4038,7 +4038,7 @@ QQuickContext2D::~QQuickContext2D()
delete m_buffer;
if (m_renderTarget == QQuickCanvasItem::FramebufferObject) {
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_renderStrategy == QQuickCanvasItem::Immediate && m_glContext) {
Q_ASSERT(QThread::currentThread() == m_glContext->thread());
m_glContext->makeCurrent(m_surface.data());
@@ -4115,7 +4115,7 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
m_texture = new QQuickContext2DImageTexture;
break;
case QQuickCanvasItem::FramebufferObject:
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
m_texture = new QQuickContext2DFBOTexture;
#else
// It shouldn't be possible to use a FramebufferObject without OpenGL
@@ -4134,7 +4134,7 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
m_thread = QThread::currentThread();
QThread *renderThread = m_thread;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QQuickWindow *window = canvasItem->window();
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
QThread *sceneGraphThread = wd->context->thread();
@@ -4151,7 +4151,7 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
if (renderThread && renderThread != QThread::currentThread())
m_texture->moveToThread(renderThread);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_renderTarget == QQuickCanvasItem::FramebufferObject && renderThread != sceneGraphThread) {
auto openglRenderContext = static_cast<const QSGDefaultRenderContext *>(QQuickWindowPrivate::get(window)->context);
QOpenGLContext *cc = openglRenderContext->openglContext();
@@ -4212,7 +4212,7 @@ QImage QQuickContext2D::toImage(const QRectF& bounds)
flush();
m_texture->grabImage(bounds);
} else {
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QQuickWindow *window = m_canvas->window();
QOpenGLContext *ctx = window ? window->openglContext() : 0;
if (ctx && ctx->isValid()) {
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
index 8d659040b3..b985cb0ccc 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
@@ -43,7 +43,7 @@
#include <QtCore/QMutex>
#include <QtQuick/qsgtexture.h>
#include <QtGui/QPaintEngine>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/QOpenGLContext>
# include <QtGui/private/qopenglpaintengine_p.h>
#endif
diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp
index 4435c0c37b..38b5f054bf 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture.cpp
+++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp
@@ -44,7 +44,7 @@
#include <QtQuick/private/qsgtexture_p.h>
#include "qquickcontext2dcommandbuffer_p.h"
#include <QOpenGLPaintDevice>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <QOpenGLFramebufferObject>
#include <QOpenGLFramebufferObjectFormat>
#include <QOpenGLFunctions>
@@ -53,7 +53,7 @@
#include <QtGui/QGuiApplication>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#define QT_MINIMUM_FBO_SIZE 64
static inline int qt_next_power_of_two(int v)
@@ -90,7 +90,7 @@ struct GLAcquireContext {
#endif
QQuickContext2DTexture::QQuickContext2DTexture()
: m_context(0)
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
, m_gl(0)
#endif
, m_surface(0)
@@ -254,7 +254,7 @@ void QQuickContext2DTexture::paint(QQuickContext2DCommandBuffer *ccb)
return;
}
QQuickContext2D::mutex.unlock();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
GLAcquireContext currentContext(m_gl, m_surface);
#endif
if (!m_tiledCanvas) {
@@ -383,7 +383,7 @@ bool QQuickContext2DTexture::event(QEvent *e)
}
return QObject::event(e);
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
static inline QSize npotAdjustedSize(const QSize &size)
{
static bool checked = false;
diff --git a/src/quick/items/context2d/qquickcontext2dtexture_p.h b/src/quick/items/context2d/qquickcontext2dtexture_p.h
index 678e33826d..97135816a2 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture_p.h
+++ b/src/quick/items/context2d/qquickcontext2dtexture_p.h
@@ -58,7 +58,7 @@ QT_REQUIRE_CONFIG(quick_canvas);
#include <QtQuick/qsgtexture.h>
#include "qquickcanvasitem_p.h"
#include "qquickcontext2d_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QOpenGLContext>
# include <QOpenGLFramebufferObject>
#endif
@@ -125,7 +125,7 @@ public:
// Called during sync() on the scene graph thread while GUI is blocked.
virtual QSGTexture *textureForNextFrame(QSGTexture *lastFrame, QQuickWindow *window) = 0;
bool event(QEvent *e) override;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void initializeOpenGL(QOpenGLContext *gl, QOffscreenSurface *s) {
m_gl = gl;
m_surface = s;
@@ -157,7 +157,7 @@ protected:
QList<QQuickContext2DTile*> m_tiles;
QQuickContext2D *m_context;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QOpenGLContext *m_gl;
#endif
QSurface *m_surface;
@@ -180,7 +180,7 @@ protected:
uint m_painting : 1;
uint m_onCustomThread : 1; // Not GUI and not SGRender
};
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
class QQuickContext2DFBOTexture : public QQuickContext2DTexture
{
Q_OBJECT
diff --git a/src/quick/items/context2d/qquickcontext2dtile.cpp b/src/quick/items/context2d/qquickcontext2dtile.cpp
index 95b6c9d961..d31fee7f91 100644
--- a/src/quick/items/context2d/qquickcontext2dtile.cpp
+++ b/src/quick/items/context2d/qquickcontext2dtile.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qquickcontext2dtile_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QOpenGLFramebufferObject>
# include <QOpenGLFramebufferObjectFormat>
# include <QOpenGLPaintDevice>
@@ -97,7 +97,7 @@ QPainter* QQuickContext2DTile::createPainter(bool smooth, bool antialiasing)
return 0;
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QQuickContext2DFBOTile::QQuickContext2DFBOTile()
: QQuickContext2DTile()
, m_fbo(0)
diff --git a/src/quick/items/context2d/qquickcontext2dtile_p.h b/src/quick/items/context2d/qquickcontext2dtile_p.h
index 02238a882b..d5255edcfc 100644
--- a/src/quick/items/context2d/qquickcontext2dtile_p.h
+++ b/src/quick/items/context2d/qquickcontext2dtile_p.h
@@ -56,7 +56,7 @@
QT_REQUIRE_CONFIG(quick_canvas);
#include "qquickcontext2d_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QOpenGLFramebufferObject>
#endif
QT_BEGIN_NAMESPACE
@@ -87,7 +87,7 @@ protected:
QPainter m_painter;
};
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
class QQuickContext2DFBOTile : public QQuickContext2DTile
{
public:
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 41c036c7a8..4e918802d1 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -39,7 +39,7 @@
#include "qquickaccessibleattached_p.h"
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
#include "private/qquickitem_p.h"
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index 7054d9d9c9..215a1e5db6 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -56,7 +56,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
#include <QtGui/qaccessible.h>
#include <private/qtquickglobal_p.h>
@@ -265,6 +265,6 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickAccessibleAttached)
QML_DECLARE_TYPEINFO(QQuickAccessibleAttached, QML_HAS_ATTACHED_PROPERTIES)
-#endif // QT_NO_ACCESSIBILITY
+#endif // accessibility
#endif
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index cbb052856e..7a112e840a 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -55,7 +55,7 @@
#include <QtGui/qstylehints.h>
#include <QtGui/qguiapplication.h>
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QT_BEGIN_NAMESPACE
@@ -995,4 +995,4 @@ QQuickDragAttached *QQuickDrag::qmlAttachedProperties(QObject *obj)
QT_END_NAMESPACE
-#endif // QT_NO_DRAGANDDROP
+#endif // draganddrop
diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h
index f9faca55e0..357f72b3e7 100644
--- a/src/quick/items/qquickdrag_p.h
+++ b/src/quick/items/qquickdrag_p.h
@@ -60,7 +60,7 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qurl.h>
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QT_BEGIN_NAMESPACE
@@ -77,7 +77,7 @@ class QQuickDragGrabber
QIntrusiveListNode node;
protected:
- void objectDestroyed(QQuickItem *) { delete this; }
+ void objectDestroyed(QQuickItem *) override { delete this; }
};
typedef QIntrusiveList<Item, &Item::node> ItemList;
@@ -318,6 +318,6 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickDrag)
QML_DECLARE_TYPEINFO(QQuickDrag, QML_HAS_ATTACHED_PROPERTIES)
-#endif // QT_NO_DRAGANDDROP
+#endif // draganddrop
#endif
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index 70d76c99a1..b314390915 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -43,7 +43,7 @@
#include <private/qv4arraybuffer_p.h>
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QT_BEGIN_NAMESPACE
@@ -618,4 +618,4 @@ void QQuickDropEvent::accept(QQmlV4Function *args)
QT_END_NAMESPACE
-#endif // QT_NO_DRAGANDDROP
+#endif // draganddrop
diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h
index ecd4da4367..0c4c072db7 100644
--- a/src/quick/items/qquickdroparea_p.h
+++ b/src/quick/items/qquickdroparea_p.h
@@ -55,7 +55,7 @@
#include <QtGui/qevent.h>
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QT_BEGIN_NAMESPACE
@@ -190,6 +190,6 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickDropEvent)
QML_DECLARE_TYPE(QQuickDropArea)
-#endif // QT_NO_DRAGANDDROP
+#endif // draganddrop
#endif // QQUICKDROPAREA_P_H
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 2fad9f5a8d..42588fd058 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -552,7 +552,7 @@ void QQuickEventTouchPoint::reset(const QTouchEvent::TouchPoint &tp, ulong times
QQuickEventPoint::reset(tp.state(), tp.scenePos(), tp.id(), timestamp);
m_rotation = tp.rotation();
m_pressure = tp.pressure();
- m_uniqueId = tp.uniqueId();
+// m_uniqueId = tp.uniqueId();
}
/*!
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 61bbb4ecda..6179791413 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -302,7 +302,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventTouchPoint : public QQuickEventPoint
Q_OBJECT
Q_PROPERTY(qreal rotation READ rotation)
Q_PROPERTY(qreal pressure READ pressure)
- Q_PROPERTY(QPointerUniqueId uniqueId READ uniqueId)
+// TODO rename to QPointingDeviceUniqueId
+// Q_PROPERTY(QPointerUniqueId uniqueId READ uniqueId)
public:
QQuickEventTouchPoint(QQuickPointerTouchEvent *parent);
@@ -311,12 +312,12 @@ public:
qreal rotation() const { return m_rotation; }
qreal pressure() const { return m_pressure; }
- QPointerUniqueId uniqueId() const { return m_uniqueId; }
+// QPointerUniqueId uniqueId() const { return m_uniqueId; }
private:
qreal m_rotation;
qreal m_pressure;
- QPointerUniqueId m_uniqueId;
+// QPointerUniqueId m_uniqueId;
Q_DISABLE_COPY(QQuickEventTouchPoint)
};
@@ -554,7 +555,7 @@ QML_DECLARE_TYPE(QQuickMouseEvent)
QML_DECLARE_TYPE(QQuickWheelEvent)
QML_DECLARE_TYPE(QQuickCloseEvent)
QML_DECLARE_TYPE(QQuickPointerDevice)
-QML_DECLARE_TYPE(QPointerUniqueId)
+//QML_DECLARE_TYPE(QPointerUniqueId)
QML_DECLARE_TYPE(QQuickPointerEvent)
#endif // QQUICKEVENTS_P_P_H
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 26959ef584..00a1306627 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1404,7 +1404,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event)
}
}
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
void QQuickFlickable::wheelEvent(QWheelEvent *event)
{
Q_D(QQuickFlickable);
diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h
index 2da4781f37..7384c7271a 100644
--- a/src/quick/items/qquickflickable_p.h
+++ b/src/quick/items/qquickflickable_p.h
@@ -249,7 +249,7 @@ protected:
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
diff --git a/src/quick/items/qquickgraphicsinfo.cpp b/src/quick/items/qquickgraphicsinfo.cpp
index 761d0c3cad..f735f17a4d 100644
--- a/src/quick/items/qquickgraphicsinfo.cpp
+++ b/src/quick/items/qquickgraphicsinfo.cpp
@@ -257,7 +257,7 @@ void QQuickGraphicsInfo::updateInfo()
}
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_window && m_window->isSceneGraphInitialized()) {
QOpenGLContext *context = m_window->openglContext();
if (context)
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 274bfbf6d4..ca8ef7ba2e 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -73,7 +73,7 @@
#include <private/qv4qobjectwrapper_p.h>
#include <private/qdebug_p.h>
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
# include <QtGui/qcursor.h>
#endif
@@ -317,7 +317,7 @@ void QQuickItemKeyFilter::keyReleased(QKeyEvent *event, bool post)
if (m_next) m_next->keyReleased(event, post);
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void QQuickItemKeyFilter::inputMethodEvent(QInputMethodEvent *event, bool post)
{
if (m_next)
@@ -331,7 +331,7 @@ QVariant QQuickItemKeyFilter::inputMethodQuery(Qt::InputMethodQuery query) const
if (m_next) return m_next->inputMethodQuery(query);
return QVariant();
}
-#endif // QT_NO_IM
+#endif // im
void QQuickItemKeyFilter::componentComplete()
{
@@ -1298,7 +1298,7 @@ void QQuickKeysAttached::setPriority(Priority order)
void QQuickKeysAttached::componentComplete()
{
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Q_D(QQuickKeysAttached);
if (d->item) {
for (QQuickItem *targetItem : qAsConst(d->targets)) {
@@ -1387,7 +1387,7 @@ void QQuickKeysAttached::keyReleased(QKeyEvent *event, bool post)
if (!event->isAccepted()) QQuickItemKeyFilter::keyReleased(event, post);
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void QQuickKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool post)
{
Q_D(QQuickKeysAttached);
@@ -1424,7 +1424,7 @@ QVariant QQuickKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const
}
return QQuickItemKeyFilter::inputMethodQuery(query);
}
-#endif // QT_NO_IM
+#endif // im
QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj)
{
@@ -1675,7 +1675,7 @@ void QQuickEnterKeyAttached::setType(Qt::EnterKeyType type)
{
if (keyType != type) {
keyType = type;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (itemPrivate && itemPrivate->activeFocus)
QGuiApplication::inputMethod()->update(Qt::ImEnterKeyType);
#endif
@@ -2366,7 +2366,7 @@ bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item)
if (item == item->window()->contentItem())
return true;
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
if (QObject *acc = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false)) {
int role = acc->property("role").toInt();
if (role == QAccessible::EditableText
@@ -2855,7 +2855,7 @@ void QQuickItemPrivate::addChild(QQuickItem *child)
childItems.append(child);
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
// if the added child has a cursor and we do not currently have any children
@@ -2883,7 +2883,7 @@ void QQuickItemPrivate::removeChild(QQuickItem *child)
childItems.removeOne(child);
Q_ASSERT(!childItems.contains(child));
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
// turn it off, if nothing else is using it
@@ -2958,7 +2958,7 @@ void QQuickItemPrivate::derefWindow()
if (polishScheduled)
c->itemsToPolish.removeOne(q);
c->removeGrabber(q);
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
if (c->cursorItem == q) {
c->cursorItem = 0;
window->unsetCursor();
@@ -3842,7 +3842,7 @@ void QQuickItem::keyReleaseEvent(QKeyEvent *event)
event->ignore();
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
/*!
This event handler can be reimplemented in a subclass to receive input
method events for an item. The event information is provided by the
@@ -3852,7 +3852,7 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event)
{
event->ignore();
}
-#endif // QT_NO_IM
+#endif // im
/*!
This event handler can be reimplemented in a subclass to receive focus-in
@@ -3861,7 +3861,7 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event)
*/
void QQuickItem::focusInEvent(QFocusEvent * /*event*/)
{
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
if (QAccessible::isActive()) {
if (QObject *acc = QQuickAccessibleAttached::findAccessible(this)) {
QAccessibleEvent ev(acc, QAccessible::Focus);
@@ -3939,7 +3939,7 @@ void QQuickItem::touchUngrabEvent()
// XXX todo
}
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
/*!
This event handler can be reimplemented in a subclass to receive
wheel events for an item. The event information is provided by the
@@ -3997,7 +3997,7 @@ void QQuickItem::hoverLeaveEvent(QHoverEvent *event)
Q_UNUSED(event);
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
This event handler can be reimplemented in a subclass to receive drag-enter
events for an item. The event information is provided by the
@@ -4057,7 +4057,7 @@ void QQuickItem::dropEvent(QDropEvent *event)
{
Q_UNUSED(event);
}
-#endif // QT_NO_DRAGANDDROP
+#endif // draganddrop
/*!
Reimplement this method to filter the mouse events that are received by
@@ -4088,7 +4088,7 @@ void QQuickItem::windowDeactivateEvent()
}
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
/*!
This method is only relevant for input items.
@@ -4146,7 +4146,7 @@ QVariant QQuickItem::inputMethodQuery(Qt::InputMethodQuery query) const
return v;
}
-#endif // QT_NO_IM
+#endif // im
QQuickAnchorLine QQuickItemPrivate::left() const
{
@@ -4991,7 +4991,7 @@ void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e)
}
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void QQuickItemPrivate::deliverInputMethodEvent(QInputMethodEvent *e)
{
Q_Q(QQuickItem);
@@ -5017,7 +5017,7 @@ void QQuickItemPrivate::deliverInputMethodEvent(QInputMethodEvent *e)
extra->keyHandler->inputMethodEvent(e, true);
}
}
-#endif // QT_NO_IM
+#endif // im
/*!
Called when \a change occurs for this item.
@@ -5038,7 +5038,7 @@ void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value)
emit windowChanged(value.window);
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
/*!
Notify input method on updated query values if needed. \a queries indicates
the changed attributes.
@@ -5048,7 +5048,7 @@ void QQuickItem::updateInputMethod(Qt::InputMethodQueries queries)
if (hasActiveFocus())
QGuiApplication::inputMethod()->update(queries);
}
-#endif // QT_NO_IM
+#endif // im
/*! \internal */
// XXX todo - do we want/need this anymore?
@@ -5790,7 +5790,7 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
}
itemChange(QQuickItem::ItemVisibleHasChanged, effectiveVisible);
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
if (isAccessible) {
QAccessibleEvent ev(q, effectiveVisible ? QAccessible::ObjectShow : QAccessible::ObjectHide);
QAccessible::updateAccessibility(&ev);
@@ -7074,7 +7074,7 @@ void QQuickItem::setAcceptHoverEvents(bool enabled)
void QQuickItemPrivate::setHasCursorInChild(bool hasCursor)
{
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
Q_Q(QQuickItem);
// if we're asked to turn it off (because of an unsetcursor call, or a node
@@ -7123,7 +7123,7 @@ void QQuickItemPrivate::setHasHoverInChild(bool hasHover)
}
}
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
/*!
Returns the cursor shape for this item.
@@ -7609,7 +7609,7 @@ bool QQuickItem::event(QEvent *ev)
updatePolish();
break;
#endif
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
case QEvent::InputMethodQuery: {
QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(ev);
Qt::InputMethodQueries queries = query->queries();
@@ -7626,7 +7626,7 @@ bool QQuickItem::event(QEvent *ev)
case QEvent::InputMethod:
inputMethodEvent(static_cast<QInputMethodEvent *>(ev));
break;
-#endif // QT_NO_IM
+#endif // im
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
@@ -7670,12 +7670,12 @@ bool QQuickItem::event(QEvent *ev)
case QEvent::MouseButtonDblClick:
mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
break;
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
case QEvent::Wheel:
wheelEvent(static_cast<QWheelEvent*>(ev));
break;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::DragEnter:
dragEnterEvent(static_cast<QDragEnterEvent*>(ev));
break;
@@ -7688,12 +7688,12 @@ bool QQuickItem::event(QEvent *ev)
case QEvent::Drop:
dropEvent(static_cast<QDropEvent*>(ev));
break;
-#endif // QT_NO_DRAGANDDROP
-#ifndef QT_NO_GESTURES
+#endif // draganddrop
+#if QT_CONFIG(gestures)
case QEvent::NativeGesture:
ev->ignore();
break;
-#endif // QT_NO_GESTURES
+#endif // gestures
default:
return QObject::event(ev);
}
@@ -8291,7 +8291,7 @@ QQuickItemPrivate::ExtraData::ExtraData()
}
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::Role QQuickItemPrivate::accessibleRole() const
{
Q_Q(const QQuickItem);
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index b1b1d627b1..c9494d91bd 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -153,7 +153,7 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus
public:
enum Flag {
ItemClipsChildrenToShape = 0x01,
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
ItemAcceptsInputMethod = 0x02,
#endif
ItemIsFocusScope = 0x04,
@@ -292,7 +292,7 @@ public:
bool acceptHoverEvents() const;
void setAcceptHoverEvents(bool enabled);
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
QCursor cursor() const;
void setCursor(const QCursor &cursor);
void unsetCursor();
@@ -340,7 +340,7 @@ public:
Q_REVISION(1) Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true);
Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
#endif
@@ -393,7 +393,7 @@ protected:
bool isComponentComplete() const;
virtual void itemChange(ItemChange, const ItemChangeData &);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void updateInputMethod(Qt::InputMethodQueries queries = Qt::ImQueryInput);
#endif
@@ -406,7 +406,7 @@ protected:
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
virtual void inputMethodEvent(QInputMethodEvent *);
#endif
virtual void focusInEvent(QFocusEvent *);
@@ -417,14 +417,14 @@ protected:
virtual void mouseDoubleClickEvent(QMouseEvent *event);
virtual void mouseUngrabEvent(); // XXX todo - params?
virtual void touchUngrabEvent();
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
virtual void wheelEvent(QWheelEvent *event);
#endif
virtual void touchEvent(QTouchEvent *event);
virtual void hoverEnterEvent(QHoverEvent *event);
virtual void hoverMoveEvent(QHoverEvent *event);
virtual void hoverLeaveEvent(QHoverEvent *event);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
virtual void dragEnterEvent(QDragEnterEvent *);
virtual void dragMoveEvent(QDragMoveEvent *);
virtual void dragLeaveEvent(QDragLeaveEvent *);
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 7781c94f95..3002b73a8c 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -347,7 +347,7 @@ public:
#if QT_CONFIG(quick_shadereffect)
mutable QQuickItemLayer *layer;
#endif
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
QCursor cursor;
#endif
QPointF userTransformOriginPoint;
@@ -534,7 +534,7 @@ public:
virtual void implicitWidthChanged();
virtual void implicitHeightChanged();
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
virtual QAccessible::Role accessibleRole() const;
#endif
@@ -556,7 +556,7 @@ public:
virtual void transformChanged();
void deliverKeyEvent(QKeyEvent *);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void deliverInputMethodEvent(QInputMethodEvent *);
#endif
@@ -618,7 +618,7 @@ public:
virtual void keyPressed(QKeyEvent *event, bool post);
virtual void keyReleased(QKeyEvent *event, bool post);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
virtual void inputMethodEvent(QInputMethodEvent *event, bool post);
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
#endif
@@ -857,7 +857,7 @@ Q_SIGNALS:
private:
void keyPressed(QKeyEvent *event, bool post) Q_DECL_OVERRIDE;
void keyReleased(QKeyEvent *event, bool post) Q_DECL_OVERRIDE;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void inputMethodEvent(QInputMethodEvent *, bool post) Q_DECL_OVERRIDE;
QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
#endif
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index 0705d9b504..8dd4a96b62 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -96,7 +96,7 @@
#include "qquickspritesequence_p.h"
#include "qquickanimatedsprite_p.h"
#endif
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include "qquickopenglinfo_p.h"
#endif
#include "qquickgraphicsinfo_p.h"
@@ -278,7 +278,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickPathInterpolator>("QtQuick",2,0,"PathInterpolator");
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
qmlRegisterType<QQuickDropArea>("QtQuick", 2, 0, "DropArea");
qmlRegisterType<QQuickDropEvent>();
qmlRegisterType<QQuickDropAreaDrag>();
@@ -289,7 +289,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickTouchPoint>("QtQuick", 2, 0, "TouchPoint");
qmlRegisterType<QQuickGrabGestureEvent>();
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
qmlRegisterUncreatableType<QQuickAccessibleAttached>("QtQuick", 2, 0, "Accessible",QQuickAccessibleAttached::tr("Accessible is only available via attached properties"));
#endif
@@ -325,7 +325,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickShaderEffect, 1>(uri, 2, 4, "ShaderEffect");
#endif
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
qmlRegisterUncreatableType<QQuickOpenGLInfo>(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties"));
#endif
qmlRegisterType<QQuickPinchArea, 1>(uri, 2, 5,"PinchArea");
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 6bd83dd808..5e30bf9e0a 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -61,10 +61,10 @@ QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
: enabled(true), scrollGestureEnabled(true), hovered(false), longPress(false),
moved(false), stealMouse(false), doubleClick(false), preventStealing(false),
propagateComposedEvents(false), overThreshold(false), pressed(0)
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
, drag(0)
#endif
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
, cursor(0)
#endif
{
@@ -72,10 +72,10 @@ QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
QQuickMouseAreaPrivate::~QQuickMouseAreaPrivate()
{
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
delete drag;
#endif
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
delete cursor;
#endif
}
@@ -435,7 +435,7 @@ QQuickMouseArea::QQuickMouseArea(QQuickItem *parent)
{
Q_D(QQuickMouseArea);
d->init();
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
// Explcitly call setCursor on QQuickItem since
// it internally keeps a boolean hasCursor that doesn't
// get set to true unless you call setCursor
@@ -679,7 +679,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event)
} else {
d->longPress = false;
d->saveEvent(event);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (d->drag)
d->drag->setActive(false);
#endif
@@ -705,7 +705,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
// ### can GV handle this for us?
setHovered(contains(d->lastPos));
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (d->drag && d->drag->target()) {
if (!d->moved) {
d->targetStartPos = d->drag->target()->parentItem()
@@ -788,7 +788,7 @@ void QQuickMouseArea::mouseReleaseEvent(QMouseEvent *event)
setPressed(event->button(), false, event->source());
if (!d->pressed) {
// no other buttons are pressed
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (d->drag)
d->drag->setActive(false);
#endif
@@ -866,7 +866,7 @@ void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event)
setHovered(false);
}
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
void QQuickMouseArea::wheelEvent(QWheelEvent *event)
{
Q_D(QQuickMouseArea);
@@ -897,7 +897,7 @@ void QQuickMouseArea::ungrabMouse()
d->overThreshold = false;
setKeepMouseGrab(false);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (d->drag)
d->drag->setActive(false);
#endif
@@ -980,7 +980,7 @@ bool QQuickMouseArea::childMouseEventFilter(QQuickItem *i, QEvent *e)
Q_D(QQuickMouseArea);
if (!d->pressed &&
(!d->enabled || !isVisible()
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
|| !d->drag || !d->drag->filterChildren()
#endif
)
@@ -1003,7 +1003,7 @@ void QQuickMouseArea::timerEvent(QTimerEvent *event)
Q_D(QQuickMouseArea);
if (event->timerId() == d->pressAndHoldTimer.timerId()) {
d->pressAndHoldTimer.stop();
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
bool dragged = d->drag && d->drag->active();
#else
bool dragged = false;
@@ -1179,7 +1179,7 @@ bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p, Qt::MouseEventS
{
Q_D(QQuickMouseArea);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
bool dragged = d->drag && d->drag->active();
#else
bool dragged = false;
@@ -1276,7 +1276,7 @@ bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p, Qt::MouseEventS
\sa Qt::CursorShape
*/
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
Qt::CursorShape QQuickMouseArea::cursorShape() const
{
return cursor().shape();
@@ -1343,7 +1343,7 @@ void QQuickMouseArea::setCursorShape(Qt::CursorShape shape)
*/
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QQuickDrag *QQuickMouseArea::drag()
{
Q_D(QQuickMouseArea);
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index 5cd86541d4..d90c8e1baa 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -75,12 +75,12 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem
Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedButtonsChanged)
Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
Q_PROPERTY(QQuickDrag *drag READ drag CONSTANT) //### add flicking to QQuickDrag or add a QQuickFlick ???
#endif
Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged)
Q_PROPERTY(bool propagateComposedEvents READ propagateComposedEvents WRITE setPropagateComposedEvents NOTIFY propagateComposedEventsChanged)
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
Q_PROPERTY(Qt::CursorShape cursorShape READ cursorShape WRITE setCursorShape RESET unsetCursor NOTIFY cursorShapeChanged)
#endif
Q_PROPERTY(bool containsPress READ containsPress NOTIFY containsPressChanged REVISION 1)
@@ -110,7 +110,7 @@ public:
bool hoverEnabled() const;
void setHoverEnabled(bool h);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QQuickDrag *drag();
#endif
@@ -120,7 +120,7 @@ public:
bool propagateComposedEvents() const;
void setPropagateComposedEvents(bool propagate);
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
Qt::CursorShape cursorShape() const;
void setCursorShape(Qt::CursorShape shape);
#endif
@@ -133,7 +133,7 @@ Q_SIGNALS:
void pressedButtonsChanged();
void acceptedButtonsChanged();
void hoverEnabledChanged();
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
void cursorShapeChanged();
#endif
void positionChanged(QQuickMouseEvent *mouse);
@@ -166,7 +166,7 @@ protected:
void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif
bool childMouseEventFilter(QQuickItem *i, QEvent *e) Q_DECL_OVERRIDE;
diff --git a/src/quick/items/qquickmousearea_p_p.h b/src/quick/items/qquickmousearea_p_p.h
index b59e02910f..456b1866a3 100644
--- a/src/quick/items/qquickmousearea_p_p.h
+++ b/src/quick/items/qquickmousearea_p_p.h
@@ -95,7 +95,7 @@ public:
bool propagateComposedEvents : 1;
bool overThreshold : 1;
Qt::MouseButtons pressed;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QQuickDrag *drag;
#endif
QPointF startScene;
@@ -106,7 +106,7 @@ public:
Qt::MouseButtons lastButtons;
Qt::KeyboardModifiers lastModifiers;
QBasicTimer pressAndHoldTimer;
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
QCursor *cursor;
#endif
QQuickMouseEvent quickMouseEvent;
diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp
index e565fceab8..3911bb0f28 100644
--- a/src/quick/items/qquickpainteditem.cpp
+++ b/src/quick/items/qquickpainteditem.cpp
@@ -662,7 +662,7 @@ QSGTextureProvider *QQuickPaintedItem::textureProvider() const
return QQuickItem::textureProvider();
Q_D(const QQuickPaintedItem);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QQuickWindow *w = window();
if (!w || !w->openglContext() || QThread::currentThread() != w->openglContext()->thread()) {
qWarning("QQuickPaintedItem::textureProvider: can only be queried on the rendering thread of an exposed window");
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index fd8971c845..6295aa1932 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -682,7 +682,7 @@ bool QQuickPinchArea::event(QEvent *event)
return QQuickItem::event(event);
switch (event->type()) {
-#ifndef QT_NO_GESTURES
+#if QT_CONFIG(gestures)
case QEvent::NativeGesture: {
QNativeGestureEvent *gesture = static_cast<QNativeGestureEvent *>(event);
switch (gesture->gestureType()) {
@@ -775,7 +775,7 @@ bool QQuickPinchArea::event(QEvent *event)
return QQuickItem::event(event);
}
} break;
-#endif // QT_NO_GESTURES
+#endif // gestures
case QEvent::Wheel:
event->ignore();
return false;
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index 74aa2da9e0..13e13890b7 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -44,7 +44,7 @@
#include <QtCore/QTime>
#include <QtQuick/private/qquickanimatorcontroller_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/QOpenGLContext>
# include <QtQuick/private/qsgdefaultrendercontext_p.h>
#if QT_CONFIG(quick_shadereffect)
@@ -62,7 +62,7 @@
#include <QtCore/private/qobject_p.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
#endif
/*!
@@ -227,7 +227,7 @@ void QQuickRenderControl::initialize(QOpenGLContext *gl)
{
Q_D(QQuickRenderControl);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (!d->window) {
qWarning("QQuickRenderControl::initialize called with no associated window");
return;
@@ -379,7 +379,7 @@ QImage QQuickRenderControl::grab()
QImage grabContent;
if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL) {
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
render();
grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false);
#endif
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 5670696ce2..7926607e33 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -40,7 +40,7 @@
#include <private/qquickshadereffect_p.h>
#include <private/qsgcontextplugin_p.h>
#include <private/qquickitem_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <private/qquickopenglshadereffect_p.h>
#endif
#include <private/qquickgenericshadereffect_p.h>
@@ -499,14 +499,14 @@ QSGContextFactoryInterface::Flags qsg_backend_flags();
QQuickShaderEffect::QQuickShaderEffect(QQuickItem *parent)
: QQuickItem(*new QQuickShaderEffectPrivate, parent),
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
m_glImpl(nullptr),
#endif
m_impl(nullptr)
{
setFlag(QQuickItem::ItemHasContents);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (!qsg_backend_flags().testFlag(QSGContextFactoryInterface::SupportsShaderEffectNode))
m_glImpl = new QQuickOpenGLShaderEffect(this, this);
@@ -539,7 +539,7 @@ QQuickShaderEffect::QQuickShaderEffect(QQuickItem *parent)
QByteArray QQuickShaderEffect::fragmentShader() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->fragmentShader();
#endif
@@ -548,7 +548,7 @@ QByteArray QQuickShaderEffect::fragmentShader() const
void QQuickShaderEffect::setFragmentShader(const QByteArray &code)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->setFragmentShader(code);
return;
@@ -578,7 +578,7 @@ void QQuickShaderEffect::setFragmentShader(const QByteArray &code)
QByteArray QQuickShaderEffect::vertexShader() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->vertexShader();
#endif
@@ -587,7 +587,7 @@ QByteArray QQuickShaderEffect::vertexShader() const
void QQuickShaderEffect::setVertexShader(const QByteArray &code)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->setVertexShader(code);
return;
@@ -607,7 +607,7 @@ void QQuickShaderEffect::setVertexShader(const QByteArray &code)
bool QQuickShaderEffect::blending() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->blending();
#endif
@@ -616,7 +616,7 @@ bool QQuickShaderEffect::blending() const
void QQuickShaderEffect::setBlending(bool enable)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->setBlending(enable);
return;
@@ -640,7 +640,7 @@ void QQuickShaderEffect::setBlending(bool enable)
QVariant QQuickShaderEffect::mesh() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->mesh();
#endif
@@ -649,7 +649,7 @@ QVariant QQuickShaderEffect::mesh() const
void QQuickShaderEffect::setMesh(const QVariant &mesh)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->setMesh(mesh);
return;
@@ -674,7 +674,7 @@ void QQuickShaderEffect::setMesh(const QVariant &mesh)
QQuickShaderEffect::CullMode QQuickShaderEffect::cullMode() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->cullMode();
#endif
@@ -683,7 +683,7 @@ QQuickShaderEffect::CullMode QQuickShaderEffect::cullMode() const
void QQuickShaderEffect::setCullMode(CullMode face)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->setCullMode(face);
return;
@@ -715,7 +715,7 @@ void QQuickShaderEffect::setCullMode(CullMode face)
bool QQuickShaderEffect::supportsAtlasTextures() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->supportsAtlasTextures();
#endif
@@ -724,7 +724,7 @@ bool QQuickShaderEffect::supportsAtlasTextures() const
void QQuickShaderEffect::setSupportsAtlasTextures(bool supports)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->setSupportsAtlasTextures(supports);
return;
@@ -771,7 +771,7 @@ void QQuickShaderEffect::setSupportsAtlasTextures(bool supports)
QString QQuickShaderEffect::log() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->log();
#endif
@@ -780,7 +780,7 @@ QString QQuickShaderEffect::log() const
QQuickShaderEffect::Status QQuickShaderEffect::status() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->status();
#endif
@@ -789,7 +789,7 @@ QQuickShaderEffect::Status QQuickShaderEffect::status() const
bool QQuickShaderEffect::event(QEvent *e)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->handleEvent(e);
return QQuickItem::event(e);
@@ -801,7 +801,7 @@ bool QQuickShaderEffect::event(QEvent *e)
void QQuickShaderEffect::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->handleGeometryChanged(newGeometry, oldGeometry);
QQuickItem::geometryChanged(newGeometry, oldGeometry);
@@ -814,7 +814,7 @@ void QQuickShaderEffect::geometryChanged(const QRectF &newGeometry, const QRectF
QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->handleUpdatePaintNode(oldNode, updatePaintNodeData);
#endif
@@ -823,7 +823,7 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
void QQuickShaderEffect::componentComplete()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->maybeUpdateShaders();
QQuickItem::componentComplete();
@@ -836,7 +836,7 @@ void QQuickShaderEffect::componentComplete()
void QQuickShaderEffect::itemChange(ItemChange change, const ItemChangeData &value)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl) {
m_glImpl->handleItemChange(change, value);
QQuickItem::itemChange(change, value);
@@ -854,7 +854,7 @@ bool QQuickShaderEffect::isComponentComplete() const
QString QQuickShaderEffect::parseLog() // for OpenGL-based autotests
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_glImpl)
return m_glImpl->parseLog();
#endif
@@ -864,7 +864,7 @@ QString QQuickShaderEffect::parseLog() // for OpenGL-based autotests
void QQuickShaderEffectPrivate::updatePolish()
{
Q_Q(QQuickShaderEffect);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (q->m_glImpl) {
q->m_glImpl->maybeUpdateShaders();
return;
diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h
index 2b7ff4cf6e..7885daffbb 100644
--- a/src/quick/items/qquickshadereffect_p.h
+++ b/src/quick/items/qquickshadereffect_p.h
@@ -135,7 +135,7 @@ protected:
void itemChange(ItemChange change, const ItemChangeData &value) override;
private:
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QQuickOpenGLShaderEffect *m_glImpl;
#endif
QQuickGenericShaderEffect *m_impl;
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp
index 74b04a75ad..f54a8911b2 100644
--- a/src/quick/items/qquickspriteengine.cpp
+++ b/src/quick/items/qquickspriteengine.cpp
@@ -664,13 +664,14 @@ uint QQuickStochasticEngine::updateSprites(uint time)//### would returning a lis
//Sprite State Update;
m_timeOffset = time;
m_addAdvance = false;
- while (!m_stateUpdates.isEmpty() && time >= m_stateUpdates.constFirst().first){
- const auto copy = m_stateUpdates.constFirst().second;
+ int i = 0;
+ for (; i < m_stateUpdates.count() && time >= m_stateUpdates.at(i).first; ++i) {
+ const auto copy = m_stateUpdates.at(i).second;
for (int idx : copy)
advance(idx);
- m_stateUpdates.pop_front();
}
+ m_stateUpdates.remove(0, i);
m_advanceTime.start();
m_addAdvance = true;
if (m_stateUpdates.isEmpty())
@@ -760,13 +761,13 @@ void QQuickStochasticEngine::addToUpdateList(uint t, int idx)
m_stateUpdates[i].second << idx;
return;
} else if (m_stateUpdates.at(i).first > t) {
- QList<int> tmpList;
+ QVector<int> tmpList;
tmpList << idx;
m_stateUpdates.insert(i, qMakePair(t, tmpList));
return;
}
}
- QList<int> tmpList;
+ QVector<int> tmpList;
tmpList << idx;
m_stateUpdates << qMakePair(t, tmpList);
}
diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h
index 89de9ce4f2..90ee68b2f6 100644
--- a/src/quick/items/qquickspriteengine_p.h
+++ b/src/quick/items/qquickspriteengine_p.h
@@ -254,7 +254,7 @@ protected:
QVector<int> m_goals;
QVector<int> m_duration;
QVector<int> m_startTimes;
- QList<QPair<uint, QList<int> > > m_stateUpdates;//### This could be done faster - priority queue?
+ QVector<QPair<uint, QVector<int> > > m_stateUpdates;//### This could be done faster - priority queue?
QTime m_advanceTime;
uint m_timeOffset;
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 2bfb4501fc..e37a7e6d5e 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -1819,7 +1819,7 @@ bool QQuickTextPrivate::setHAlign(QQuickText::HAlignment alignment, bool forceAl
bool QQuickTextPrivate::determineHorizontalAlignment()
{
if (hAlignImplicit) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
bool alignToRight = text.isEmpty() ? QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft : rightToLeftText;
#else
bool alignToRight = rightToLeftText;
@@ -2713,12 +2713,12 @@ QString QQuickText::hoveredLink() const
if (d->extra.isAllocated())
return d->extra->hoveredLink;
} else {
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
if (QQuickWindow *wnd = window()) {
QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0));
return d->anchorAt(pos);
}
-#endif // QT_NO_CURSOR
+#endif // cursor
}
return QString();
}
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp
index fe29249934..555fd233b3 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -79,9 +79,6 @@ const int textCursorWidth = 1;
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE)
-#ifndef QT_NO_CONTEXTMENU
-#endif
-
// could go into QTextCursor...
static QTextLine currentTextLine(const QTextCursor &cursor)
{
@@ -99,7 +96,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor)
QQuickTextControlPrivate::QQuickTextControlPrivate()
: doc(0),
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
preeditCursor(0),
#endif
interactionFlags(Qt::TextEditorInteraction),
@@ -123,7 +120,7 @@ QQuickTextControlPrivate::QQuickTextControlPrivate()
bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
{
-#ifdef QT_NO_SHORTCUT
+#if !QT_CONFIG(shortcut)
Q_UNUSED(e);
#endif
@@ -139,7 +136,7 @@ bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
if (false) {
}
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
if (e == QKeySequence::MoveToNextChar) {
op = QTextCursor::Right;
}
@@ -232,7 +229,7 @@ bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
else if (e == QKeySequence::MoveToEndOfDocument) {
op = QTextCursor::End;
}
-#endif // QT_NO_SHORTCUT
+#endif // shortcut
else {
return false;
}
@@ -290,7 +287,7 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString &
{
Q_Q(QQuickTextControl);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
cancelPreedit();
#endif
@@ -326,7 +323,7 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString &
formatCursor.setCharFormat(charFormatForInsertion);
formatCursor.endEditBlock();
} else {
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
doc->setHtml(text);
#else
doc->setPlainText(text);
@@ -407,7 +404,7 @@ void QQuickTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /
{
Q_Q(QQuickTextControl);
if (forceEmitSelectionChanged) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (hasFocus)
qGuiApp->inputMethod()->update(Qt::ImCurrentSelection);
#endif
@@ -429,7 +426,7 @@ void QQuickTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /
lastSelectionEnd = selectionEnd;
if (!forceEmitSelectionChanged) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (hasFocus)
qGuiApp->inputMethod()->update(Qt::ImCurrentSelection);
#endif
@@ -443,7 +440,7 @@ void QQuickTextControlPrivate::_q_updateCurrentCharFormatAndSelection()
selectionChanged();
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void QQuickTextControlPrivate::setClipboardSelection()
{
QClipboard *clipboard = QGuiApplication::clipboard();
@@ -544,7 +541,7 @@ void QQuickTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition,
}
if (interactionFlags & Qt::TextSelectableByMouse) {
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
setClipboardSelection();
#endif
selectionChanged(true);
@@ -574,7 +571,7 @@ void QQuickTextControlPrivate::extendBlockwiseSelection(int suggestedNewPosition
}
if (interactionFlags & Qt::TextSelectableByMouse) {
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
setClipboardSelection();
#endif
selectionChanged(true);
@@ -611,7 +608,7 @@ void QQuickTextControl::clear()
}
QQuickTextControl::QQuickTextControl(QTextDocument *doc, QObject *parent)
- : QObject(*new QQuickTextControlPrivate, parent)
+ : QInputControl(TextEdit, *new QQuickTextControlPrivate, parent)
{
Q_D(QQuickTextControl);
Q_ASSERT(doc);
@@ -656,7 +653,7 @@ void QQuickTextControl::updateCursorRectangle(bool force)
void QQuickTextControl::setTextCursor(const QTextCursor &cursor)
{
Q_D(QQuickTextControl);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
d->commitPreedit();
#endif
d->cursorIsFocusIndicator = false;
@@ -677,7 +674,7 @@ QTextCursor QQuickTextControl::textCursor() const
return d->cursor;
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void QQuickTextControl::cut()
{
@@ -759,7 +756,7 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix)
QHoverEvent *ev = static_cast<QHoverEvent *>(e);
d->hoverEvent(ev, matrix.map(ev->posF()));
break; }
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
case QEvent::InputMethod:
d->inputMethodEvent(static_cast<QInputMethodEvent *>(e));
break;
@@ -795,7 +792,7 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix)
break;
}
}
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
} else if (ke == QKeySequence::Copy
|| ke == QKeySequence::Paste
|| ke == QKeySequence::Cut
@@ -873,20 +870,20 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e)
return;
}
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
if (e == QKeySequence::SelectAll) {
e->accept();
q->selectAll();
return;
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
else if (e == QKeySequence::Copy) {
e->accept();
q->copy();
return;
}
#endif
-#endif // QT_NO_SHORTCUT
+#endif // shortcut
if (interactionFlags & Qt::TextSelectableByKeyboard
&& cursorMoveKeyEvent(e))
@@ -924,7 +921,7 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e)
}
goto accept;
}
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
else if (e == QKeySequence::InsertParagraphSeparator) {
cursor.insertBlock();
e->accept();
@@ -937,14 +934,14 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e)
#endif
if (false) {
}
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
else if (e == QKeySequence::Undo) {
q->undo();
}
else if (e == QKeySequence::Redo) {
q->redo();
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
else if (e == QKeySequence::Cut) {
q->cut();
}
@@ -975,7 +972,7 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e)
cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
cursor.removeSelectedText();
}
-#endif // QT_NO_SHORTCUT
+#endif // shortcut
else {
goto process;
}
@@ -983,8 +980,7 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e)
process:
{
- QString text = e->text();
- if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) {
+ if (q->isAcceptableInput(e)) {
if (overwriteMode
// no need to call deleteChar() if we have a selection, insertText
// does it already
@@ -993,7 +989,7 @@ process:
cursor.deleteChar();
}
- cursor.insertText(text);
+ cursor.insertText(e->text());
selectionChanged();
} else {
e->ignore();
@@ -1019,7 +1015,7 @@ QRectF QQuickTextControlPrivate::rectForPosition(int position) const
const QTextLayout *layout = block.layout();
const QPointF layoutPos = q->blockBoundingRect(block).topLeft();
int relativePos = position - block.position();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (preeditCursor != 0) {
int preeditPos = layout->preeditAreaPosition();
if (relativePos == preeditPos)
@@ -1083,7 +1079,7 @@ void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &po
const QTextCursor oldSelection = cursor;
const int oldCursorPos = cursor.position();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
commitPreedit();
#endif
@@ -1157,7 +1153,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou
int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (isPreediting()) {
// note: oldCursorPos not including preedit
int selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit);
@@ -1183,7 +1179,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou
extendBlockwiseSelection(newCursorPos);
else if (selectedWordOnDoubleClick.hasSelection())
extendWordwiseSelection(newCursorPos, mouseX);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
else if (!isPreediting())
setCursorPosition(newCursorPos, QTextCursor::KeepAnchor);
#endif
@@ -1194,7 +1190,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou
q->updateCursorRectangle(true);
}
_q_updateCurrentCharFormatAndSelection();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (qGuiApp)
qGuiApp->inputMethod()->update(Qt::ImQueryInput);
#endif
@@ -1221,7 +1217,7 @@ void QQuickTextControlPrivate::mouseReleaseEvent(QMouseEvent *e, const QPointF &
if (mousePressed) {
mousePressed = false;
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
setClipboardSelection();
selectionChanged(true);
} else if (e->button() == Qt::MidButton
@@ -1270,7 +1266,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin
Q_Q(QQuickTextControl);
if (e->button() == Qt::LeftButton && (interactionFlags & Qt::TextSelectableByMouse)) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
commitPreedit();
#endif
@@ -1291,7 +1287,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin
tripleClickTimer.start(QGuiApplication::styleHints()->mouseDoubleClickInterval(), q);
if (doEmit) {
selectionChanged();
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
setClipboardSelection();
#endif
emit q->cursorPositionChanged();
@@ -1304,7 +1300,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin
bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, const QPointF &pos)
{
-#if !defined(QT_NO_IM)
+#if QT_CONFIG(im)
Q_Q(QQuickTextControl);
Q_UNUSED(e);
@@ -1328,7 +1324,7 @@ bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, cons
return false;
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void QQuickTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
{
Q_Q(QQuickTextControl);
@@ -1481,7 +1477,7 @@ QVariant QQuickTextControl::inputMethodQuery(Qt::InputMethodQuery property, QVar
return QVariant();
}
}
-#endif // QT_NO_IM
+#endif // im
void QQuickTextControlPrivate::focusEvent(QFocusEvent *e)
{
@@ -1611,7 +1607,7 @@ void QQuickTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::M
bool QQuickTextControl::canPaste() const
{
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
Q_D(const QQuickTextControl);
if (d->interactionFlags & Qt::TextEditable) {
const QMimeData *md = QGuiApplication::clipboard()->mimeData();
@@ -1661,7 +1657,7 @@ void QQuickTextControl::insertFromMimeData(const QMimeData *source)
bool hasData = false;
QTextDocumentFragment fragment;
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
if (source->hasFormat(QLatin1String("application/x-qrichtext")) && d->acceptRichText) {
// x-qrichtext is always UTF-8 (taken from Qt3 since we don't use it anymore).
const QString richtext = QLatin1String("<meta name=\"qrichtext\" content=\"1\" />")
@@ -1680,7 +1676,7 @@ void QQuickTextControl::insertFromMimeData(const QMimeData *source)
}
#else
fragment = QTextDocumentFragment::fromPlainText(source->text());
-#endif // QT_NO_TEXTHTMLPARSER
+#endif // texthtmlparser
if (hasData)
d->cursor.insertFragment(fragment);
@@ -1751,7 +1747,7 @@ void QQuickTextControlPrivate::activateLinkUnderCursor(QString href)
emit q_func()->linkActivated(href);
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
bool QQuickTextControlPrivate::isPreediting() const
{
QTextLayout *layout = cursor.block().layout();
@@ -1789,7 +1785,7 @@ void QQuickTextControlPrivate::cancelPreedit()
QInputMethodEvent event;
QCoreApplication::sendEvent(q->parent(), &event);
}
-#endif // QT_NO_IM
+#endif // im
void QQuickTextControl::setTextInteractionFlags(Qt::TextInteractionFlags flags)
{
@@ -1813,7 +1809,7 @@ QString QQuickTextControl::toPlainText() const
return document()->toPlainText();
}
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
QString QQuickTextControl::toHtml() const
{
return document()->toHtml();
@@ -1840,7 +1836,7 @@ QRectF QQuickTextControl::blockBoundingRect(const QTextBlock &block) const
QString QQuickTextControl::preeditText() const
{
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Q_D(const QQuickTextControl);
QTextLayout *layout = d->cursor.block().layout();
if (!layout)
@@ -1857,7 +1853,7 @@ QStringList QQuickTextEditMimeData::formats() const
{
if (!fragment.isEmpty())
return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html")
-#ifndef QT_NO_TEXTODFWRITER
+#if QT_CONFIG(textodfwriter)
<< QString::fromLatin1("application/vnd.oasis.opendocument.text")
#endif
;
@@ -1875,10 +1871,10 @@ QVariant QQuickTextEditMimeData::retrieveData(const QString &mimeType, QVariant:
void QQuickTextEditMimeData::setup() const
{
QQuickTextEditMimeData *that = const_cast<QQuickTextEditMimeData *>(this);
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
that->setData(QLatin1String("text/html"), fragment.toHtml("utf-8").toUtf8());
#endif
-#ifndef QT_NO_TEXTODFWRITER
+#if QT_CONFIG(textodfwriter)
{
QBuffer buffer;
QTextDocumentWriter writer(&buffer, "ODF");
diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h
index e06e3b8b29..70104a97e0 100644
--- a/src/quick/items/qquicktextcontrol_p.h
+++ b/src/quick/items/qquicktextcontrol_p.h
@@ -59,6 +59,7 @@
#include <QtGui/qabstracttextdocumentlayout.h>
#include <QtGui/qtextdocumentfragment.h>
#include <QtGui/qclipboard.h>
+#include <QtGui/private/qinputcontrol_p.h>
#include <QtCore/qmimedata.h>
QT_BEGIN_NAMESPACE
@@ -71,7 +72,7 @@ class QAbstractScrollArea;
class QEvent;
class QTimerEvent;
-class Q_AUTOTEST_EXPORT QQuickTextControl : public QObject
+class Q_AUTOTEST_EXPORT QQuickTextControl : public QInputControl
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQuickTextControl)
@@ -89,7 +90,7 @@ public:
QString toPlainText() const;
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
QString toHtml() const;
#endif
@@ -129,7 +130,7 @@ public Q_SLOTS:
void setPlainText(const QString &text);
void setHtml(const QString &text);
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void cut();
void copy();
void paste(QClipboard::Mode mode = QClipboard::Clipboard);
@@ -164,7 +165,7 @@ public:
virtual void processEvent(QEvent *e, const QMatrix &matrix);
void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF());
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
#endif
diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h
index 0f78feb5de..0582e6d113 100644
--- a/src/quick/items/qquicktextcontrol_p_p.h
+++ b/src/quick/items/qquicktextcontrol_p_p.h
@@ -90,7 +90,7 @@ public:
void _q_updateCurrentCharFormatAndSelection();
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void setClipboardSelection();
#endif
@@ -114,14 +114,14 @@ public:
void mouseDoubleClickEvent(QMouseEvent *event, const QPointF &pos);
bool sendMouseEventToInputContext(QMouseEvent *event, const QPointF &pos);
void focusEvent(QFocusEvent *e);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void inputMethodEvent(QInputMethodEvent *);
#endif
void hoverEvent(QHoverEvent *e, const QPointF &pos);
void activateLinkUnderCursor(QString href = QString());
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
bool isPreediting() const;
void commitPreedit();
void cancelPreedit();
@@ -143,7 +143,7 @@ public:
QBasicTimer cursorBlinkTimer;
QBasicTimer tripleClickTimer;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
int preeditCursor;
#endif
diff --git a/src/quick/items/qquicktextdocument.cpp b/src/quick/items/qquicktextdocument.cpp
index 287e07e980..61d75fe99b 100644
--- a/src/quick/items/qquicktextdocument.cpp
+++ b/src/quick/items/qquicktextdocument.cpp
@@ -230,7 +230,7 @@ void QQuickTextDocumentWithImageResources::setText(const QString &text)
{
clearResources();
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
setHtml(text);
#else
setPlainText(text);
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index b53bf064b6..106acf57cf 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -190,7 +190,7 @@ QString QQuickTextEdit::text() const
Q_D(const QQuickTextEdit);
if (!d->textCached && isComponentComplete()) {
QQuickTextEditPrivate *d = const_cast<QQuickTextEditPrivate *>(d_func());
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
if (d->richText)
d->text = d->control->toHtml();
else
@@ -381,7 +381,7 @@ void QQuickTextEdit::setText(const QString &text)
if (!isComponentComplete()) {
d->text = text;
} else if (d->richText) {
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
d->control->setHtml(text);
#else
d->control->setPlainText(text);
@@ -458,7 +458,7 @@ void QQuickTextEdit::setTextFormat(TextFormat format)
bool wasRich = d->richText;
d->richText = format == RichText || (format == AutoText && (wasRich || Qt::mightBeRichText(text())));
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
if (isComponentComplete()) {
if (wasRich && !d->richText) {
d->control->setPlainText(!d->textCached ? d->control->toHtml() : d->text);
@@ -540,7 +540,7 @@ void QQuickTextEdit::setFont(const QFont &font)
}
updateSize();
updateWholeDocument();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImFont);
#endif
}
@@ -738,7 +738,7 @@ bool QQuickTextEditPrivate::determineHorizontalAlignment()
Q_Q(QQuickTextEdit);
if (hAlignImplicit && q->isComponentComplete()) {
Qt::LayoutDirection direction = contentDirection;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (direction == Qt::LayoutDirectionAuto) {
const QString preeditText = control->textCursor().block().layout()->preeditAreaText();
direction = textDirection(preeditText);
@@ -764,7 +764,7 @@ void QQuickTextEditPrivate::mirrorChange()
}
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Qt::InputMethodHints QQuickTextEditPrivate::effectiveInputMethodHints() const
{
return inputMethodHints | Qt::ImhMultiLine;
@@ -1012,7 +1012,7 @@ int QQuickTextEdit::positionAt(qreal x, qreal y) const
y -= d->yoff;
int r = d->document->documentLayout()->hitTest(QPointF(x, y), Qt::FuzzyHit);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QTextCursor cursor = d->control->textCursor();
if (r > cursor.position()) {
// The cursor position includes positions within the preedit text, but only positions in the
@@ -1261,7 +1261,7 @@ int QQuickTextEdit::selectionEnd() const
QString QQuickTextEdit::selectedText() const
{
Q_D(const QQuickTextEdit);
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
return d->richText
? d->control->textCursor().selectedText()
: d->control->textCursor().selection().toPlainText();
@@ -1379,17 +1379,17 @@ void QQuickTextEdit::setTextMargin(qreal margin)
Qt::InputMethodHints QQuickTextEdit::inputMethodHints() const
{
-#ifdef QT_NO_IM
+#if !QT_CONFIG(im)
return Qt::ImhNone;
#else
Q_D(const QQuickTextEdit);
return d->inputMethodHints;
-#endif // QT_NO_IM
+#endif // im
}
void QQuickTextEdit::setInputMethodHints(Qt::InputMethodHints hints)
{
-#ifdef QT_NO_IM
+#if !QT_CONFIG(im)
Q_UNUSED(hints);
#else
Q_D(QQuickTextEdit);
@@ -1400,7 +1400,7 @@ void QQuickTextEdit::setInputMethodHints(Qt::InputMethodHints hints)
d->inputMethodHints = hints;
updateInputMethod(Qt::ImHints);
emit inputMethodHintsChanged();
-#endif // QT_NO_IM
+#endif // im
}
void QQuickTextEdit::geometryChanged(const QRectF &newGeometry,
@@ -1427,7 +1427,7 @@ void QQuickTextEdit::componentComplete()
QQuickImplicitSizeItem::componentComplete();
d->document->setBaseUrl(baseUrl());
-#ifndef QT_NO_TEXTHTML_PARSER
+#if QT_CONFIG(texthtmlparser)
if (d->richText)
d->control->setHtml(d->text);
else
@@ -1554,7 +1554,7 @@ void QQuickTextEdit::setReadOnly(bool r)
if (r == isReadOnly())
return;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
setFlag(QQuickItem::ItemAcceptsInputMethod, !r);
#endif
Qt::TextInteractionFlags flags = Qt::LinksAccessibleByMouse;
@@ -1569,7 +1569,7 @@ void QQuickTextEdit::setReadOnly(bool r)
d->control->setTextInteractionFlags(flags);
d->control->moveCursor(QTextCursor::End);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
updateInputMethod(Qt::ImEnabled);
#endif
q_canPasteChanged();
@@ -1748,7 +1748,7 @@ bool QQuickTextEdit::isRightToLeft(int start, int end)
}
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
/*!
\qmlmethod QtQuick::TextEdit::cut()
@@ -1781,7 +1781,7 @@ void QQuickTextEdit::paste()
Q_D(QQuickTextEdit);
d->control->paste();
}
-#endif // QT_NO_CLIPBOARD
+#endif // clipboard
/*!
@@ -1822,7 +1822,7 @@ void QQuickTextEdit::mousePressEvent(QMouseEvent *event)
bool hadActiveFocus = hasActiveFocus();
forceActiveFocus(Qt::MouseFocusReason);
// re-open input panel on press if already focused
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (hasActiveFocus() && hadActiveFocus && !isReadOnly())
qGuiApp->inputMethod()->show();
#else
@@ -1870,7 +1870,7 @@ void QQuickTextEdit::mouseMoveEvent(QMouseEvent *event)
QQuickImplicitSizeItem::mouseMoveEvent(event);
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
/*!
\overload
Handles the given input method \a event.
@@ -1923,7 +1923,7 @@ QVariant QQuickTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
{
return inputMethodQuery(property, QVariant());
}
-#endif // QT_NO_IM
+#endif // im
void QQuickTextEdit::triggerPreprocess()
{
@@ -2197,12 +2197,12 @@ bool QQuickTextEdit::canRedo() const
*/
bool QQuickTextEdit::isInputMethodComposing() const
{
-#ifdef QT_NO_IM
+#if !QT_CONFIG(im)
return false;
#else
Q_D(const QQuickTextEdit);
return d->control->hasImState();
-#endif // QT_NO_IM
+#endif // im
}
QQuickTextEditPrivate::ExtraData::ExtraData()
@@ -2223,14 +2223,14 @@ void QQuickTextEditPrivate::init()
{
Q_Q(QQuickTextEdit);
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
if (QGuiApplication::clipboard()->supportsSelection())
q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton);
else
#endif
q->setAcceptedMouseButtons(Qt::LeftButton);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
q->setFlag(QQuickItem::ItemAcceptsInputMethod);
#endif
q->setFlag(QQuickItem::ItemHasContents);
@@ -2255,7 +2255,7 @@ void QQuickTextEditPrivate::init()
qmlobject_connect(control, QQuickTextControl, SIGNAL(overwriteModeChanged(bool)), q, QQuickTextEdit, SIGNAL(overwriteModeChanged(bool)));
qmlobject_connect(control, QQuickTextControl, SIGNAL(textChanged()), q, QQuickTextEdit, SLOT(q_textChanged()));
qmlobject_connect(control, QQuickTextControl, SIGNAL(preeditTextChanged()), q, QQuickTextEdit, SIGNAL(preeditTextChanged()));
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
qmlobject_connect(QGuiApplication::clipboard(), QClipboard, SIGNAL(dataChanged()), q, QQuickTextEdit, SLOT(q_canPasteChanged()));
#endif
qmlobject_connect(document, QQuickTextDocumentWithImageResources, SIGNAL(undoAvailable(bool)), q, QQuickTextEdit, SIGNAL(canUndoChanged()));
@@ -2341,7 +2341,7 @@ void QQuickTextEdit::q_contentsChange(int pos, int charsRemoved, int charsAdded)
void QQuickTextEdit::moveCursorDelegate()
{
Q_D(QQuickTextEdit);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
updateInputMethod();
#endif
emit cursorRectangleChanged();
@@ -2582,7 +2582,7 @@ void QQuickTextEditPrivate::updateDefaultTextOption()
else
opt.setAlignment(Qt::Alignment(vAlign));
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (contentDirection == Qt::LayoutDirectionAuto) {
opt.setTextDirection(qGuiApp->inputMethod()->inputDirection());
} else
@@ -2627,14 +2627,14 @@ void QQuickTextEditPrivate::handleFocusEvent(QFocusEvent *event)
control->processEvent(event, QPointF(-xoff, -yoff));
if (focus) {
q->q_updateAlignment();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (focusOnPress && !q->isReadOnly())
qGuiApp->inputMethod()->show();
q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
q, SLOT(q_updateAlignment()));
#endif
} else {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
q, SLOT(q_updateAlignment()));
#endif
@@ -2685,7 +2685,7 @@ QString QQuickTextEdit::getText(int start, int end) const
QTextCursor cursor(d->document);
cursor.setPosition(start, QTextCursor::MoveAnchor);
cursor.setPosition(end, QTextCursor::KeepAnchor);
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
return d->richText
? cursor.selectedText()
: cursor.selection().toPlainText();
@@ -2714,7 +2714,7 @@ QString QQuickTextEdit::getFormattedText(int start, int end) const
cursor.setPosition(end, QTextCursor::KeepAnchor);
if (d->richText) {
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
return cursor.selection().toHtml();
#else
return cursor.selection().toPlainText();
@@ -2738,7 +2738,7 @@ void QQuickTextEdit::insert(int position, const QString &text)
cursor.setPosition(position);
d->richText = d->richText || (d->format == AutoText && Qt::mightBeRichText(text));
if (d->richText) {
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
cursor.insertHtml(text);
#else
cursor.insertText(text);
@@ -2831,12 +2831,12 @@ QString QQuickTextEdit::hoveredLink() const
if (const_cast<QQuickTextEditPrivate *>(d)->isLinkHoveredConnected()) {
return d->control->hoveredLink();
} else {
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
if (QQuickWindow *wnd = window()) {
QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0));
return d->control->anchorAt(pos);
}
-#endif // QT_NO_CURSOR
+#endif // cursor
}
return QString();
}
@@ -2881,7 +2881,7 @@ void QQuickTextEdit::append(const QString &text)
if (!d->document->isEmpty())
cursor.insertBlock();
-#ifndef QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(texthtmlparser)
if (d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text))) {
cursor.insertHtml(text);
} else {
@@ -2889,7 +2889,7 @@ void QQuickTextEdit::append(const QString &text)
}
#else
cursor.insertText(text);
-#endif // QT_NO_TEXTHTMLPARSER
+#endif // texthtmlparser
cursor.endEditBlock();
d->control->updateCursorRectangle(false);
diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h
index 42c9064860..c8d3515be1 100644
--- a/src/quick/items/qquicktextedit_p.h
+++ b/src/quick/items/qquicktextedit_p.h
@@ -242,7 +242,7 @@ public:
QRectF cursorRectangle() const;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
Q_REVISION(4) Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
#endif
@@ -347,7 +347,7 @@ public Q_SLOTS:
void select(int start, int end);
void deselect();
bool isRightToLeft(int start, int end);
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void cut();
void copy();
void paste();
@@ -399,7 +399,7 @@ protected:
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void inputMethodEvent(QInputMethodEvent *e) Q_DECL_OVERRIDE;
#endif
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) Q_DECL_OVERRIDE;
diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h
index 1613dd7676..03bce00cb0 100644
--- a/src/quick/items/qquicktextedit_p_p.h
+++ b/src/quick/items/qquicktextedit_p_p.h
@@ -119,7 +119,7 @@ public:
#endif
, contentDirection(Qt::LayoutDirectionAuto)
, mouseSelectionMode(QQuickTextEdit::SelectCharacters)
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
, inputMethodHints(Qt::ImhNone)
#endif
, updateType(UpdatePaintNode)
@@ -156,7 +156,7 @@ public:
void addCurrentTextNodeToRoot(QQuickTextNodeEngine *, QSGTransformNode *, QQuickTextNode*, TextNodeIterator&, int startPos);
QQuickTextNode* createTextNode();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Qt::InputMethodHints effectiveInputMethodHints() const;
#endif
@@ -208,7 +208,7 @@ public:
QQuickTextEdit::RenderType renderType;
Qt::LayoutDirection contentDirection;
QQuickTextEdit::SelectionMode mouseSelectionMode;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Qt::InputMethodHints inputMethodHints;
#endif
UpdateType updateType;
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index fbfaa0e199..27f3dcecfa 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -57,12 +57,13 @@
#include <QtGui/qinputmethod.h>
#include <QtCore/qmath.h>
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
#include "qaccessible.h"
#include "qquickaccessibleattached_p.h"
#endif
#include <QtGui/private/qtextengine_p.h>
+#include <QtGui/private/qinputcontrol_p.h>
QT_BEGIN_NAMESPACE
@@ -142,7 +143,7 @@ void QQuickTextInput::setText(const QString &s)
if (s == text())
return;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
d->cancelPreedit();
#endif
d->internalSetText(s, -1, false);
@@ -400,7 +401,7 @@ void QQuickTextInput::setFont(const QFont &font)
if (oldFont != d->font) {
d->updateLayout();
updateCursorRectangle();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
updateInputMethod(Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle);
#endif
}
@@ -575,7 +576,7 @@ bool QQuickTextInputPrivate::setHAlign(QQuickTextInput::HAlignment alignment, bo
Qt::LayoutDirection QQuickTextInputPrivate::textDirection() const
{
QString text = m_text;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (text.isEmpty())
text = m_textLayout.preeditAreaText();
#endif
@@ -602,7 +603,7 @@ Qt::LayoutDirection QQuickTextInputPrivate::layoutDirection() const
Qt::LayoutDirection direction = m_layoutDirection;
if (direction == Qt::LayoutDirectionAuto) {
direction = textDirection();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (direction == Qt::LayoutDirectionAuto)
direction = QGuiApplication::inputMethod()->inputDirection();
#endif
@@ -615,7 +616,7 @@ bool QQuickTextInputPrivate::determineHorizontalAlignment()
if (hAlignImplicit) {
// if no explicit alignment has been set, follow the natural layout direction of the text
Qt::LayoutDirection direction = textDirection();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (direction == Qt::LayoutDirectionAuto)
direction = QGuiApplication::inputMethod()->inputDirection();
#endif
@@ -707,12 +708,12 @@ void QQuickTextInput::setReadOnly(bool ro)
if (d->m_readOnly == ro)
return;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
setFlag(QQuickItem::ItemAcceptsInputMethod, !ro);
#endif
d->m_readOnly = ro;
d->setCursorPosition(d->end());
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
updateInputMethod(Qt::ImEnabled);
#endif
q_canPasteChanged();
@@ -830,7 +831,7 @@ QRectF QQuickTextInput::cursorRectangle() const
Q_D(const QQuickTextInput);
int c = d->m_cursor;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
c += d->m_preeditCursor;
#endif
if (d->m_echoMode == NoEcho)
@@ -994,17 +995,17 @@ void QQuickTextInput::setAutoScroll(bool b)
QValidator* QQuickTextInput::validator() const
{
-#ifdef QT_NO_VALIDATOR
+#if !QT_CONFIG(validator)
return 0;
#else
Q_D(const QQuickTextInput);
return d->m_validator;
-#endif // QT_NO_VALIDATOR
+#endif // validator
}
void QQuickTextInput::setValidator(QValidator* v)
{
-#ifdef QT_NO_VALIDATOR
+#if !QT_CONFIG(validator)
Q_UNUSED(v);
#else
Q_D(QQuickTextInput);
@@ -1029,16 +1030,16 @@ void QQuickTextInput::setValidator(QValidator* v)
d->checkIsValid();
emit validatorChanged();
-#endif // QT_NO_VALIDATOR
+#endif // validator
}
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
void QQuickTextInput::q_validatorChanged()
{
Q_D(QQuickTextInput);
d->checkIsValid();
}
-#endif // QT_NO_VALIDATOR
+#endif // validator
QRectF QQuickTextInputPrivate::anchorRectangle() const
{
@@ -1056,7 +1057,7 @@ QRectF QQuickTextInputPrivate::anchorRectangle() const
else
a = m_selstart == m_cursor ? m_selend : m_selstart;
if (a >= 0) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
a += m_preeditCursor;
#endif
if (m_echoMode == QQuickTextInput::NoEcho)
@@ -1151,7 +1152,7 @@ bool QQuickTextInput::hasAcceptableInput() const
The corresponding handler is \c onEditingFinished.
*/
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const
{
Qt::InputMethodHints hints = inputMethodHints;
@@ -1192,7 +1193,7 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo)
d->cancelPasswordEchoTimer();
d->m_echoMode = echo;
d->m_passwordEchoEditing = false;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
updateInputMethod(Qt::ImHints);
#endif
d->updateDisplayText();
@@ -1249,17 +1250,17 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo)
Qt::InputMethodHints QQuickTextInput::inputMethodHints() const
{
-#ifdef QT_NO_IM
+#if !QT_CONFIG(im)
return Qt::ImhNone;
#else
Q_D(const QQuickTextInput);
return d->inputMethodHints;
-#endif // QT_NO_IM
+#endif // im
}
void QQuickTextInput::setInputMethodHints(Qt::InputMethodHints hints)
{
-#ifdef QT_NO_IM
+#if !QT_CONFIG(im)
Q_UNUSED(hints);
#else
Q_D(QQuickTextInput);
@@ -1270,7 +1271,7 @@ void QQuickTextInput::setInputMethodHints(Qt::InputMethodHints hints)
d->inputMethodHints = hints;
updateInputMethod(Qt::ImHints);
emit inputMethodHintsChanged();
-#endif // QT_NO_IM
+#endif // im
}
/*!
@@ -1319,7 +1320,7 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const
Q_D(const QQuickTextInput);
if (d->m_echoMode == NoEcho)
pos = 0;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
else if (pos > d->m_cursor)
pos += d->preeditAreaText().length();
#endif
@@ -1389,7 +1390,7 @@ void QQuickTextInput::positionAt(QQmlV4Function *args) const
int pos = d->positionAt(x, y, position);
const int cursor = d->m_cursor;
if (pos > cursor) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
const int preeditLength = d->preeditAreaText().length();
pos = pos > cursor + preeditLength
? pos - preeditLength
@@ -1470,7 +1471,7 @@ void QQuickTextInput::keyPressEvent(QKeyEvent* ev)
QQuickImplicitSizeItem::keyPressEvent(ev);
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void QQuickTextInput::inputMethodEvent(QInputMethodEvent *ev)
{
Q_D(QQuickTextInput);
@@ -1493,7 +1494,7 @@ void QQuickTextInput::mouseDoubleClickEvent(QMouseEvent *event)
Q_D(QQuickTextInput);
if (d->selectByMouse && event->button() == Qt::LeftButton) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
d->commitPreedit();
#endif
int cursor = d->positionAt(event->localPos());
@@ -1549,7 +1550,7 @@ void QQuickTextInput::mouseMoveEvent(QMouseEvent *event)
if (qAbs(int(event->localPos().x() - d->pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
setKeepMouseGrab(true);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (d->composeMode()) {
// start selection
int startPos = d->positionAt(d->pressPos);
@@ -1576,7 +1577,7 @@ void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event)
d->selectPressed = false;
setKeepMouseGrab(false);
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
if (QGuiApplication::clipboard()->supportsSelection()) {
if (event->button() == Qt::LeftButton) {
d->copy(QClipboard::Selection);
@@ -1596,7 +1597,7 @@ void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event)
bool QQuickTextInputPrivate::sendMouseEventToInputContext(QMouseEvent *event)
{
-#if !defined QT_NO_IM
+#if QT_CONFIG(im)
if (composeMode()) {
int tmp_cursor = positionAt(event->localPos());
int mousePos = tmp_cursor - m_cursor;
@@ -1623,7 +1624,7 @@ void QQuickTextInput::mouseUngrabEvent()
bool QQuickTextInput::event(QEvent* ev)
{
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
Q_D(QQuickTextInput);
if (ev->type() == QEvent::ShortcutOverride) {
if (d->m_readOnly)
@@ -1723,7 +1724,7 @@ void QQuickTextInputPrivate::ensureVisible(int position, int preeditCursor, int
// left
hscroll = width - widthUsed;
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (preeditLength > 0) {
// check to ensure long pre-edit text doesn't push the cursor
// off to the left
@@ -1740,7 +1741,7 @@ void QQuickTextInputPrivate::ensureVisible(int position, int preeditCursor, int
void QQuickTextInputPrivate::updateHorizontalScroll()
{
if (autoScroll && m_echoMode != QQuickTextInput::NoEcho) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
const int preeditLength = m_textLayout.preeditAreaText().length();
ensureVisible(m_cursor, m_preeditCursor, preeditLength);
#else
@@ -1754,7 +1755,7 @@ void QQuickTextInputPrivate::updateHorizontalScroll()
void QQuickTextInputPrivate::updateVerticalScroll()
{
Q_Q(QQuickTextInput);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
const int preeditLength = m_textLayout.preeditAreaText().length();
#endif
const qreal height = qMax<qreal>(0, q->height() - q->topPadding() - q->bottomPadding());
@@ -1766,7 +1767,7 @@ void QQuickTextInputPrivate::updateVerticalScroll()
vscroll = -QQuickTextUtil::alignedY(
heightUsed, height, vAlign & ~(Qt::AlignAbsolute|Qt::AlignHorizontal_Mask));
} else {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QTextLine currentLine = m_textLayout.lineForTextPosition(m_cursor + preeditLength);
#else
QTextLine currentLine = m_textLayout.lineForTextPosition(m_cursor);
@@ -1786,7 +1787,7 @@ void QQuickTextInputPrivate::updateVerticalScroll()
// right
vscroll = heightUsed - height;
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (preeditLength > 0) {
// check to ensure long pre-edit text doesn't push the cursor
// off the top
@@ -1827,7 +1828,7 @@ void QQuickTextInput::ensureActiveFocus()
{
bool hadActiveFocus = hasActiveFocus();
forceActiveFocus();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Q_D(QQuickTextInput);
// re-open input panel on press if already focused
if (hasActiveFocus() && hadActiveFocus && !d->m_readOnly)
@@ -1877,7 +1878,7 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
}
if (!d->m_textLayout.text().isEmpty()
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
|| !d->m_textLayout.preeditAreaText().isEmpty()
#endif
) {
@@ -1900,7 +1901,7 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
return node;
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property) const
{
return inputMethodQuery(property, QVariant());
@@ -1957,7 +1958,7 @@ QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property, QVaria
return QQuickItem::inputMethodQuery(property);
}
}
-#endif // QT_NO_IM
+#endif // im
/*!
\qmlmethod QtQuick::TextInput::deselect()
@@ -1997,7 +1998,7 @@ bool QQuickTextInput::isRightToLeft(int start, int end)
}
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
/*!
\qmlmethod QtQuick::TextInput::cut()
@@ -2042,7 +2043,7 @@ void QQuickTextInput::paste()
if (!d->m_readOnly)
d->paste();
}
-#endif // QT_NO_CLIPBOARD
+#endif // clipboard
/*!
\qmlmethod QtQuick::TextInput::undo()
@@ -2416,7 +2417,7 @@ void QQuickTextInput::setPersistentSelection(bool on)
*/
bool QQuickTextInput::canPaste() const
{
-#if !defined(QT_NO_CLIPBOARD)
+#if QT_CONFIG(clipboard)
Q_D(const QQuickTextInput);
if (!d->canPasteValid) {
if (const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData())
@@ -2597,7 +2598,7 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event)
}
if (focus) {
q->q_updateAlignment();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (focusOnPress && !m_readOnly)
qGuiApp->inputMethod()->show();
q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
@@ -2617,7 +2618,7 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event)
if (hasAcceptableInput(m_text) == AcceptableInput || fixup())
emit q->editingFinished();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
q, SLOT(q_updateAlignment()));
#endif
@@ -2645,7 +2646,7 @@ void QQuickTextInput::focusOutEvent(QFocusEvent *event)
*/
bool QQuickTextInput::isInputMethodComposing() const
{
-#ifdef QT_NO_IM
+#if !QT_CONFIG(im)
return false;
#else
Q_D(const QQuickTextInput);
@@ -2670,21 +2671,21 @@ QQuickTextInputPrivate::ExtraData::ExtraData()
void QQuickTextInputPrivate::init()
{
Q_Q(QQuickTextInput);
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
if (QGuiApplication::clipboard()->supportsSelection())
q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton);
else
#endif
q->setAcceptedMouseButtons(Qt::LeftButton);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
q->setFlag(QQuickItem::ItemAcceptsInputMethod);
#endif
q->setFlag(QQuickItem::ItemHasContents);
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
qmlobject_connect(QGuiApplication::clipboard(), QClipboard, SIGNAL(dataChanged()),
q, QQuickTextInput, SLOT(q_canPasteChanged()));
-#endif // QT_NO_CLIPBOARD
+#endif // clipboard
lastSelectionStart = 0;
lastSelectionEnd = 0;
@@ -2695,6 +2696,8 @@ void QQuickTextInputPrivate::init()
option.setUseDesignMetrics(renderType != QQuickTextInput::NativeRendering);
m_textLayout.setTextOption(option);
}
+
+ m_inputControl = new QInputControl(QInputControl::LineEdit, q);
}
void QQuickTextInputPrivate::resetInputMethod()
@@ -2723,7 +2726,7 @@ void QQuickTextInput::updateCursorRectangle(bool scroll)
d->cursorItem->setPosition(r.topLeft());
d->cursorItem->setHeight(r.height());
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle);
#endif
}
@@ -2783,7 +2786,7 @@ void QQuickTextInput::q_canPasteChanged()
{
Q_D(QQuickTextInput);
bool old = d->canPaste;
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
if (const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData())
d->canPaste = !d->m_readOnly && mimeData->hasText();
else
@@ -2877,7 +2880,7 @@ qreal QQuickTextInputPrivate::getImplicitWidth() const
option.setAlignment(Qt::Alignment(q->effectiveHAlign()));
layout.setTextOption(option);
layout.setFont(font);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
layout.setPreeditArea(m_textLayout.preeditAreaPosition(), m_textLayout.preeditAreaText());
#endif
layout.beginLayout();
@@ -3054,7 +3057,7 @@ void QQuickTextInputPrivate::updateBaselineOffset()
q->setBaselineOffset(fm.ascent() + yoff + q->topPadding());
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
/*!
\internal
@@ -3091,9 +3094,9 @@ void QQuickTextInputPrivate::paste(QClipboard::Mode clipboardMode)
}
}
-#endif // !QT_NO_CLIPBOARD
+#endif // clipboard
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
/*!
\internal
*/
@@ -3125,7 +3128,7 @@ void QQuickTextInputPrivate::cancelPreedit()
QInputMethodEvent ev;
QCoreApplication::sendEvent(q, &ev);
}
-#endif // QT_NO_IM
+#endif // im
/*!
\internal
@@ -3225,7 +3228,7 @@ void QQuickTextInputPrivate::clear()
void QQuickTextInputPrivate::setSelection(int start, int length)
{
Q_Q(QQuickTextInput);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
commitPreedit();
#endif
@@ -3257,7 +3260,7 @@ void QQuickTextInputPrivate::setSelection(int start, int length)
}
emit q->selectionChanged();
emitCursorPositionChanged();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
q->updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImCursorPosition | Qt::ImAnchorPosition
| Qt::ImCurrentSelection);
#endif
@@ -3287,7 +3290,7 @@ void QQuickTextInputPrivate::updatePasswordEchoEditing(bool editing)
*/
bool QQuickTextInputPrivate::fixup() // this function assumes that validate currently returns != Acceptable
{
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
if (m_validator) {
QString textCopy = m_text;
int cursorCopy = m_cursor;
@@ -3311,7 +3314,7 @@ bool QQuickTextInputPrivate::fixup() // this function assumes that validate curr
void QQuickTextInputPrivate::moveCursor(int pos, bool mark)
{
Q_Q(QQuickTextInput);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
commitPreedit();
#endif
@@ -3339,12 +3342,12 @@ void QQuickTextInputPrivate::moveCursor(int pos, bool mark)
emit q->selectionChanged();
}
emitCursorPositionChanged();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
q->updateInputMethod();
#endif
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
/*!
\internal
@@ -3461,7 +3464,7 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event)
| Qt::ImCurrentSelection);
}
}
-#endif // QT_NO_IM
+#endif // im
/*!
\internal
@@ -3501,7 +3504,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
Q_Q(QQuickTextInput);
Q_UNUSED(update)
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
bool inputMethodAttributesChanged = m_textDirty || m_selDirty;
#endif
bool alignmentChanged = false;
@@ -3513,7 +3516,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
bool wasAcceptable = m_acceptableInput;
m_validInput = true;
m_acceptableInput = true;
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
if (m_validator) {
QString textCopy = m_text;
int cursorCopy = m_cursor;
@@ -3563,7 +3566,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
if (m_textDirty) {
textChanged = true;
m_textDirty = false;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
m_preeditDirty = false;
#endif
alignmentChanged = determineHorizontalAlignment();
@@ -3575,7 +3578,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
if (m_acceptableInput != wasAcceptable)
emit q->acceptableInputChanged();
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (m_preeditDirty) {
m_preeditDirty = false;
if (determineHorizontalAlignment()) {
@@ -3590,7 +3593,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
emit q->selectionChanged();
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
inputMethodAttributesChanged |= (m_cursor != m_lastCursorPos);
if (inputMethodAttributesChanged)
q->updateInputMethod();
@@ -3624,7 +3627,7 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e
m_textDirty = (oldText != m_text);
bool changed = finishChange(-1, true, edited);
-#ifdef QT_NO_ACCESSIBILITY
+#if !QT_CONFIG(accessibility)
Q_UNUSED(changed)
#else
Q_Q(QQuickTextInput);
@@ -3970,7 +3973,7 @@ bool QQuickTextInputPrivate::isValidInput(QChar key, QChar mask) const
*/
QQuickTextInputPrivate::ValidatorState QQuickTextInputPrivate::hasAcceptableInput(const QString &str) const
{
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
QString textCopy = str;
int cursorCopy = m_cursor;
if (m_validator) {
@@ -4280,7 +4283,7 @@ bool QQuickTextInputPrivate::emitCursorPositionChanged()
}
}
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
if (QAccessible::isActive()) {
if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) {
QAccessibleTextCursorEvent ev(acc, m_cursor);
@@ -4391,7 +4394,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
if (false) {
}
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
else if (event == QKeySequence::Undo) {
q->undo();
}
@@ -4401,7 +4404,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
else if (event == QKeySequence::SelectAll) {
selectAll();
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
else if (event == QKeySequence::Copy) {
copy();
}
@@ -4418,7 +4421,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
if (!m_readOnly)
deleteEndOfLine();
}
-#endif //QT_NO_CLIPBOARD
+#endif // clipboard
else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) {
home(0);
}
@@ -4490,13 +4493,13 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
} else if (event == QKeySequence::DeleteCompleteLine) {
if (!m_readOnly) {
selectAll();
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
copy();
#endif
del();
}
}
-#endif // QT_NO_SHORTCUT
+#endif // shortcut
else {
bool handled = false;
if (event->modifiers() & Qt::ControlModifier) {
@@ -4529,8 +4532,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
}
if (unknown && !m_readOnly) {
- QString t = event->text();
- if (!t.isEmpty() && t.at(0).isPrint()) {
+ if (m_inputControl->isAcceptableInput(event)) {
if (overwriteMode
// no need to call del() if we have a selection, insert
// does it already
@@ -4539,7 +4541,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
del();
}
- insert(t);
+ insert(event->text());
event->accept();
return;
}
diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h
index d0461f551e..f4545e1574 100644
--- a/src/quick/items/qquicktextinput_p.h
+++ b/src/quick/items/qquicktextinput_p.h
@@ -266,7 +266,7 @@ public:
bool hasAcceptableInput() const;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
Q_REVISION(3) Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
#endif
@@ -372,7 +372,7 @@ protected:
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent* ev) Q_DECL_OVERRIDE;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
#endif
void mouseUngrabEvent() Q_DECL_OVERRIDE;
@@ -389,7 +389,7 @@ public Q_SLOTS:
void select(int start, int end);
void deselect();
bool isRightToLeft(int start, int end);
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void cut();
void copy();
void paste();
@@ -409,7 +409,7 @@ private Q_SLOTS:
void q_updateAlignment();
void triggerPreprocess();
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
void q_validatorChanged();
#endif
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h
index 93a8778c40..0bf5779a53 100644
--- a/src/quick/items/qquicktextinput_p_p.h
+++ b/src/quick/items/qquicktextinput_p_p.h
@@ -70,6 +70,7 @@
QT_BEGIN_NAMESPACE
class QQuickTextNode;
+class QInputControl;
class Q_QUICK_PRIVATE_EXPORT QQuickTextInputPrivate : public QQuickImplicitSizeItemPrivate
{
@@ -104,7 +105,7 @@ public:
, selectionColor(QRgb(0xFF000080))
, selectedTextColor(QRgb(0xFFFFFFFF))
, m_cursor(0)
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
, m_preeditCursor(0)
#endif
, m_blinkEnabled(false)
@@ -114,7 +115,7 @@ public:
, m_undoState(0)
, m_selstart(0)
, m_selend(0)
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
, inputMethodHints(Qt::ImhNone)
#endif
, hAlign(QQuickTextInput::AlignLeft)
@@ -148,7 +149,7 @@ public:
, m_separator(0)
, m_readOnly(0)
, m_textDirty(0)
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
, m_preeditDirty(0)
#endif
, m_selDirty(0)
@@ -176,7 +177,7 @@ public:
bool setHAlign(QQuickTextInput::HAlignment, bool forceAlign = false);
void mirrorChange() Q_DECL_OVERRIDE;
bool sendMouseEventToInputContext(QMouseEvent *event);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Qt::InputMethodHints effectiveInputMethodHints() const;
#endif
void handleFocusEvent(QFocusEvent *event);
@@ -211,7 +212,7 @@ public:
QPointF tripleClickStartPoint;
QPointer<QQmlComponent> cursorComponent;
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
QPointer<QValidator> m_validator;
#endif
@@ -228,6 +229,7 @@ public:
QQuickItem *cursorItem;
QQuickTextNode *textNode;
MaskInputData *m_maskData;
+ QInputControl *m_inputControl;
QList<int> m_transactions;
QVector<Command> m_history;
@@ -240,7 +242,7 @@ public:
int lastSelectionStart;
int lastSelectionEnd;
int m_cursor;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
int m_preeditCursor;
#endif
bool m_blinkEnabled;
@@ -257,7 +259,7 @@ public:
UpdatePaintNode
};
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Qt::InputMethodHints inputMethodHints;
#endif
QQuickTextInput::HAlignment hAlign;
@@ -290,7 +292,7 @@ public:
bool m_separator : 1;
bool m_readOnly : 1;
bool m_textDirty : 1;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
bool m_preeditDirty : 1;
#endif
bool m_selDirty : 1;
@@ -362,12 +364,12 @@ public:
QString realText() const;
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void copy(QClipboard::Mode mode = QClipboard::Clipboard) const;
void paste(QClipboard::Mode mode = QClipboard::Clipboard);
#endif
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void commitPreedit();
void cancelPreedit();
#endif
@@ -419,7 +421,7 @@ public:
}
// input methods
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
bool composeMode() const { return !m_textLayout.preeditAreaText().isEmpty(); }
QString preeditAreaText() const { return m_textLayout.preeditAreaText(); }
@@ -441,7 +443,7 @@ public:
}
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
void processInputMethodEvent(QInputMethodEvent *event);
#endif
void processKeyEvent(QKeyEvent* ev);
@@ -496,7 +498,7 @@ private:
void deleteEndOfLine();
enum ValidatorState {
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
InvalidInput = QValidator::Invalid,
IntermediateInput = QValidator::Intermediate,
AcceptableInput = QValidator::Acceptable
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 6cfc1d0313..cf4e71adf5 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -99,10 +99,12 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun
bool preferNativeGlyphNode = m_useNativeRenderer;
if (!preferNativeGlyphNode) {
QRawFontPrivate *fontPriv = QRawFontPrivate::get(font);
- if (fontPriv->fontEngine->hasUnreliableGlyphOutline())
+ if (fontPriv->fontEngine->hasUnreliableGlyphOutline()) {
preferNativeGlyphNode = true;
- else
- preferNativeGlyphNode = !QFontDatabase().isSmoothlyScalable(font.familyName(), font.styleName());
+ } else {
+ QFontEngine *fe = QRawFontPrivate::get(font)->fontEngine;
+ preferNativeGlyphNode = !fe->isSmoothlyScalable;
+ }
}
QSGGlyphNode *node = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode);
@@ -235,7 +237,7 @@ void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLay
engine.setAnchorColor(anchorColor);
engine.setPosition(position);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
int preeditLength = textLayout->preeditAreaText().length();
int preeditPosition = textLayout->preeditAreaPosition();
#endif
@@ -254,7 +256,7 @@ void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLay
int length = line.textLength();
int end = start + length;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (preeditPosition >= 0
&& preeditPosition >= start
&& preeditPosition < end) {
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index 538356e679..c179ab7163 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -950,7 +950,7 @@ void QQuickTextNodeEngine::mergeFormats(QTextLayout *textLayout, QVarLengthArray
void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QTextBlock &block, const QPointF &position, const QColor &textColor, const QColor &anchorColor, int selectionStart, int selectionEnd)
{
Q_ASSERT(textDocument);
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
int preeditLength = block.isValid() ? block.layout()->preeditAreaText().length() : 0;
int preeditPosition = block.isValid() ? block.layout()->preeditAreaPosition() : -1;
#endif
@@ -1070,7 +1070,7 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText
setTextColor(textColor);
int fragmentEnd = textPos + fragment.length();
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (preeditPosition >= 0
&& (preeditPosition + block.position()) >= textPos
&& (preeditPosition + block.position()) <= fragmentEnd) {
@@ -1092,7 +1092,7 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText
++blockIterator;
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (preeditLength >= 0 && textPos <= block.position() + preeditPosition) {
setPosition(blockPosition);
textPos = block.position() + preeditPosition;
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index b0871fc173..07d87989b5 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -62,7 +62,6 @@
#include <QtGui/qpainter.h>
#include <QtGui/qevent.h>
#include <QtGui/qmatrix4x4.h>
-#include <QtGui/qstylehints.h>
#include <QtCore/qvarlengtharray.h>
#include <QtCore/qabstractanimation.h>
#include <QtCore/QLibraryInfo>
@@ -74,7 +73,7 @@
#include <private/qqmlmemoryprofiler_p.h>
#include <private/qqmldebugserviceinterfaces_p.h>
#include <private/qqmldebugconnector_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <private/qopenglvertexarrayobject_p.h>
# include <private/qsgdefaultrendercontext_p.h>
#endif
@@ -95,7 +94,7 @@ bool QQuickWindowPrivate::defaultAlphaBuffer = false;
void QQuickWindowPrivate::updateFocusItemTransform()
{
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
Q_Q(QQuickWindow);
QQuickItem *focus = q->activeFocusItem();
if (focus && QGuiApplication::focusObject() == focus) {
@@ -172,7 +171,7 @@ private:
#include "qquickwindow.moc"
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
/*!
Returns an accessibility interface for this window, or 0 if such an
interface cannot be created.
@@ -256,7 +255,7 @@ void QQuickWindow::focusInEvent(QFocusEvent *ev)
d->updateFocusItemTransform();
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
static bool transformDirtyOnItemOrAncestor(const QQuickItem *item)
{
while (item) {
@@ -297,7 +296,7 @@ void QQuickWindowPrivate::polishItems()
if (recursionSafeguard == 0)
qWarning("QQuickWindow: possible QQuickItem::polish() loop");
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (QQuickItem *focusItem = q_func()->activeFocusItem()) {
// If the current focus item, or any of its anchestors, has changed location
// inside the window, we need inform IM about it. This to ensure that overlays
@@ -473,10 +472,10 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size)
QQuickWindowPrivate::QQuickWindowPrivate()
: contentItem(0)
, activeFocusItem(0)
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
, cursorItem(0)
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
, dragGrabber(0)
#endif
, touchMouseId(-1)
@@ -502,7 +501,7 @@ QQuickWindowPrivate::QQuickWindowPrivate()
, vaoHelper(0)
, incubationController(0)
{
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
dragGrabber = new QQuickDragGrabber;
#endif
}
@@ -896,7 +895,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
}
if (oldActiveFocusItem) {
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QGuiApplication::inputMethod()->commit();
#endif
@@ -1002,7 +1001,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
oldActiveFocusItem = activeFocusItem;
newActiveFocusItem = scope;
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QGuiApplication::inputMethod()->commit();
#endif
@@ -1278,7 +1277,7 @@ QQuickWindow::~QQuickWindow()
}
delete d->incubationController; d->incubationController = 0;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
delete d->dragGrabber; d->dragGrabber = 0;
#endif
delete d->contentItem; d->contentItem = 0;
@@ -1547,7 +1546,7 @@ bool QQuickWindow::event(QEvent *e)
d->clearHover();
d->lastMousePosition = QPointF();
break;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::DragEnter:
case QEvent::DragLeave:
case QEvent::DragMove:
@@ -1567,7 +1566,7 @@ bool QQuickWindow::event(QEvent *e)
e->setAccepted(qev.isAccepted());
} break;
case QEvent::FocusAboutToChange:
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
if (d->activeFocusItem)
qGuiApp->inputMethod()->commit();
#endif
@@ -1579,7 +1578,7 @@ bool QQuickWindow::event(QEvent *e)
d->windowManager->handleUpdateRequest(this);
break;
}
-#ifndef QT_NO_GESTURES
+#if QT_CONFIG(gestures)
case QEvent::NativeGesture:
d->deliverNativeGestureEvent(d->contentItem, static_cast<QNativeGestureEvent*>(e));
break;
@@ -1776,7 +1775,7 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce
return false;
}
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event)
{
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -1830,9 +1829,9 @@ void QQuickWindow::wheelEvent(QWheelEvent *event)
d->deliverWheelEvent(d->contentItem, event);
d->lastWheelEventAccepted = event->isAccepted();
}
-#endif // QT_NO_WHEELEVENT
+#endif // wheelevent
-#ifndef QT_NO_GESTURES
+#if QT_CONFIG(gestures)
bool QQuickWindowPrivate::deliverNativeGestureEvent(QQuickItem *item, QNativeGestureEvent *event)
{
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -1864,7 +1863,7 @@ bool QQuickWindowPrivate::deliverNativeGestureEvent(QQuickItem *item, QNativeGes
return false;
}
-#endif // QT_NO_GESTURES
+#endif // gestures
bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
{
@@ -2045,7 +2044,7 @@ void QQuickWindowPrivate::handleMouseEvent(QMouseEvent *event)
qCDebug(DBG_HOVER_TRACE) << this;
- #ifndef QT_NO_CURSOR
+ #if QT_CONFIG(cursor)
updateCursor(event->windowPos());
#endif
@@ -2360,7 +2359,7 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo
return eventAccepted;
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *event)
{
grabber->resetTarget();
@@ -2481,9 +2480,9 @@ bool QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickIte
return accepted;
}
-#endif // QT_NO_DRAGANDDROP
+#endif // draganddrop
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
void QQuickWindowPrivate::updateCursor(const QPointF &scenePos)
{
Q_Q(QQuickWindow);
@@ -2640,15 +2639,6 @@ bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent
return overThreshold;
}
-bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, const QTouchEvent::TouchPoint *tp, int startDragThreshold)
-{
- QStyleHints *styleHints = qApp->styleHints();
- bool overThreshold = qAbs(d) > (startDragThreshold >= 0 ? startDragThreshold : styleHints->startDragDistance());
- qreal velocity = axis == Qt::XAxis ? tp->velocity().x() : tp->velocity().y();
- overThreshold |= qAbs(velocity) > styleHints->startDragVelocity();
- return overThreshold;
-}
-
/*!
\qmlproperty list<Object> Window::data
\default
@@ -3186,7 +3176,7 @@ void QQuickWindow::maybeUpdate()
void QQuickWindow::cleanupSceneGraph()
{
Q_D(QQuickWindow);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
delete d->vaoHelper;
d->vaoHelper = 0;
#endif
@@ -3225,7 +3215,7 @@ void QQuickWindow::setTransientParent_helper(QQuickWindow *window)
QOpenGLContext *QQuickWindow::openglContext() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
Q_D(const QQuickWindow);
if (d->context && d->context->isValid()) {
QSGRendererInterface *rif = d->context->sceneGraphContext()->rendererInterface(d->context);
@@ -3353,7 +3343,7 @@ bool QQuickWindow::isSceneGraphInitialized() const
The corresponding handler is \c onClosing.
*/
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
/*!
Sets the render target for this window to be \a fbo.
@@ -3441,7 +3431,7 @@ QSize QQuickWindow::renderTargetSize() const
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
/*!
Returns the render target for this window.
@@ -3480,7 +3470,7 @@ QImage QQuickWindow::grabWindow()
return d->windowManager->grab(this);
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (!isVisible() && !d->renderControl) {
auto openglRenderContext = static_cast<QSGDefaultRenderContext *>(d->context);
if (!openglRenderContext->openglContext()) {
@@ -3838,7 +3828,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText
*/
QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (openglContext()) {
QSGPlainTexture *texture = new QSGPlainTexture();
texture->setTextureId(id);
@@ -3921,7 +3911,7 @@ void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha)
{
QQuickWindowPrivate::defaultAlphaBuffer = useAlpha;
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
/*!
\since 5.2
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index 7e1e45f345..27a73988ae 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -115,19 +115,19 @@ public:
bool sendEvent(QQuickItem *, QEvent *);
QImage grabWindow();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void setRenderTarget(QOpenGLFramebufferObject *fbo);
QOpenGLFramebufferObject *renderTarget() const;
#endif
void setRenderTarget(uint fboId, const QSize &size);
uint renderTargetId() const;
QSize renderTargetSize() const;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void resetOpenGLState();
#endif
QQmlIncubationController *incubationController() const;
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessibleInterface *accessibleRoot() const Q_DECL_OVERRIDE;
#endif
@@ -209,7 +209,7 @@ protected:
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
#endif
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 3e146d5440..be915903c6 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -66,6 +66,8 @@
#include <qopenglcontext.h>
#include <QtGui/qopenglframebufferobject.h>
#include <QtGui/qevent.h>
+#include <QtGui/qstylehints.h>
+#include <QtGui/qguiapplication.h>
QT_BEGIN_NAMESPACE
@@ -125,10 +127,10 @@ public:
void deliverKeyEvent(QKeyEvent *e);
// Keeps track of the item currently receiving mouse events
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
QQuickItem *cursorItem;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QQuickDragGrabber *dragGrabber;
#endif
int touchMouseId;
@@ -146,10 +148,10 @@ public:
static QMouseEvent *cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos = 0);
void deliverMouseEvent(QQuickPointerMouseEvent *pointerEvent);
bool sendFilteredMouseEvent(QQuickItem *, QQuickItem *, QEvent *, QSet<QQuickItem *> *);
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
bool deliverWheelEvent(QQuickItem *, QWheelEvent *);
#endif
-#ifndef QT_NO_GESTURES
+#if QT_CONFIG(gestures)
bool deliverNativeGestureEvent(QQuickItem *, QNativeGestureEvent *);
#endif
@@ -179,11 +181,11 @@ public:
Qt::KeyboardModifiers modifiers, ulong timestamp, bool accepted);
bool clearHover(ulong timestamp = 0);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void deliverDragEvent(QQuickDragGrabber *, QEvent *);
bool deliverDragEvent(QQuickDragGrabber *, QQuickItem *, QDragMoveEvent *);
#endif
-#ifndef QT_NO_CURSOR
+#if QT_CONFIG(cursor)
void updateCursor(const QPointF &scenePos);
QQuickItem *findCursorItem(QQuickItem *item, const QPointF &scenePos);
#endif
@@ -270,7 +272,19 @@ public:
static bool defaultAlphaBuffer;
static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int startDragThreshold = -1);
- static bool dragOverThreshold(qreal d, Qt::Axis axis, const QTouchEvent::TouchPoint *tp, int startDragThreshold = -1);
+
+ template <typename TEventPoint>
+ static bool dragOverThreshold(qreal d, Qt::Axis axis, const TEventPoint *p, int startDragThreshold = -1)
+ {
+ QStyleHints *styleHints = qApp->styleHints();
+ bool overThreshold = qAbs(d) > (startDragThreshold >= 0 ? startDragThreshold : styleHints->startDragDistance());
+ const bool dragVelocityLimitAvailable = (styleHints->startDragVelocity() > 0);
+ if (!overThreshold && dragVelocityLimitAvailable) {
+ qreal velocity = axis == Qt::XAxis ? p->velocity().x() : p->velocity().y();
+ overThreshold |= qAbs(velocity) > styleHints->startDragVelocity();
+ }
+ return overThreshold;
+ }
// data property
static void data_append(QQmlListProperty<QObject> *, QObject *);
diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp
index 4028c63da5..c6b89fabd3 100644
--- a/src/quick/qtquick2.cpp
+++ b/src/quick/qtquick2.cpp
@@ -130,6 +130,7 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context,
const QString &fileName, int line, int column,
bool *inBaseState)
{
+ Q_UNUSED(column);
typedef QPointer<QQuickState> QuickStatePointer;
QObject *object = property.object();
QString propertyName = property.name();
@@ -144,7 +145,7 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context,
newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core,
expression.toString(), object,
QQmlContextData::get(context), fileName,
- line, column);
+ line);
newBinding->setTarget(property);
}
@@ -196,7 +197,7 @@ void QQmlQtQuick2Module::defineModule()
QQuickValueTypes::registerValueTypes();
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::installFactory(&qQuickAccessibleFactory);
#endif
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
index 19a963b403..6856d34616 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
@@ -143,7 +143,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
- QQuickProfiler::SceneGraphRenderLoopFrame);
+ QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphPolishPolish);
emit window->afterAnimating();
@@ -151,7 +152,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
//Tell the renderer about the windows backing store
auto softwareRenderer = static_cast<QSGSoftwareRenderer*>(cd->renderer);
@@ -162,7 +164,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (data.grabOnly) {
grabContent = m_backingStores[window]->handle()->toImage();
@@ -178,7 +181,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
if (QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled()) {
static QTime lastFrameTime = QTime::currentTime();
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
index 5d5485ed8f..df5ec9b745 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
@@ -484,7 +484,8 @@ void QSGSoftwareRenderThread::syncAndRender()
if (syncRequested)
sync(exposeRequested);
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
if (!syncResultedInChanges && !repaintRequested) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - no changes, render aborted");
@@ -510,7 +511,8 @@ void QSGSoftwareRenderThread::syncAndRender()
softwareRenderer->setBackingStore(backingStore);
wd->renderSceneGraph(exposedWindow->size());
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (softwareRenderer && (!wd->customRenderStage || !wd->customRenderStage->swap()))
backingStore->flush(softwareRenderer->flushRegion());
@@ -526,7 +528,8 @@ void QSGSoftwareRenderThread::syncAndRender()
wd->fireFrameSwapped();
} else {
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame, 1);
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync, 1);
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - window not ready, skipping render");
}
@@ -538,7 +541,8 @@ void QSGSoftwareRenderThread::syncAndRender()
mutex.unlock();
}
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
}
template<class T> T *windowFor(const QVector<T> &list, QQuickWindow *window)
@@ -951,7 +955,8 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
wd->polishItems();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncPolish);
w->updateDuringSync = false;
@@ -965,13 +970,15 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - wait for sync");
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncWait);
w->thread->waitCondition.wait(&w->thread->mutex);
lockedForSync = false;
w->thread->mutex.unlock();
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - unlock after sync");
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncSync);
if (!animationTimer && m_anim->isRunning()) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - advancing animations");
@@ -983,7 +990,8 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
w->window->requestUpdate();
}
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncAnimations);
}
#include "qsgsoftwarethreadedrenderloop.moc"
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index ae13163ea7..8de205fc98 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -170,7 +170,8 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material)
qCDebug(QSG_LOG_TIME_COMPILATION, "shader compiled in %dms", (int) qsg_renderer_timer.elapsed());
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame,
+ QQuickProfiler::SceneGraphContextMaterialCompile);
rewrittenShaders[type] = shader;
return shader;
@@ -201,7 +202,8 @@ ShaderManager::Shader *ShaderManager::prepareMaterialNoRewrite(QSGMaterial *mate
qCDebug(QSG_LOG_TIME_COMPILATION, "shader compiled in %dms (no rewrite)", (int) qsg_renderer_timer.elapsed());
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame,
+ QQuickProfiler::SceneGraphContextMaterialCompile);
return shader;
}
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index b43a2bc2ba..a278c6079b 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -39,7 +39,7 @@
#include "qsggeometry.h"
#include "qsggeometry_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <qopenglcontext.h>
# include <qopenglfunctions.h>
# include <private/qopenglextensions_p.h>
@@ -441,7 +441,7 @@ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes,
Q_UNUSED(m_reserved_bits);
Q_ASSERT(m_attributes.count > 0);
Q_ASSERT(m_attributes.stride > 0);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
Q_ASSERT_X(indexType != GL_UNSIGNED_INT
|| static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions())
->hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint),
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index 502ae56c63..8d666d3d0b 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -40,7 +40,7 @@
#include "qsgmaterial.h"
#include "qsgrenderer_p.h"
#include "qsgmaterialshader_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <private/qsgshadersourcebuilder_p.h>
# include <private/qsgdefaultcontext_p.h>
# include <private/qsgdefaultrendercontext_p.h>
@@ -64,7 +64,7 @@ void qsg_set_material_failure()
qsg_material_failure = true;
}
#endif
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
const char *QSGMaterialShaderPrivate::loadShaderSource(QOpenGLShader::ShaderType type) const
{
const QStringList files = m_sourceFiles[type];
@@ -227,7 +227,7 @@ QSGMaterialShader::~QSGMaterialShader()
defines the attribute register position in the vertex shader.
*/
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
/*!
\fn const char *QSGMaterialShader::vertexShader() const
@@ -320,7 +320,7 @@ void QSGMaterialShader::updateState(const RenderState & /* state */, QSGMaterial
{
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
/*!
Sets the GLSL source file for the shader stage \a type to \a sourceFile. The
default implementation of the vertexShader() and fragmentShader() functions
@@ -550,7 +550,7 @@ QRect QSGMaterialShader::RenderState::deviceRect() const
return static_cast<const QSGRenderer *>(m_data)->deviceRect();
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
/*!
Returns the QOpenGLContext that is being used for rendering
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h
index 114651653f..c002cd5d5e 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.h
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.h
@@ -41,7 +41,7 @@
#define QSGMATERIAL_H
#include <QtQuick/qtquickglobal.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/qopenglshaderprogram.h>
#endif
#include <QtGui/QMatrix4x4>
@@ -84,7 +84,7 @@ public:
QRect deviceRect() const;
float determinant() const;
float devicePixelRatio() const;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QOpenGLContext *context() const;
#endif
private:
@@ -101,7 +101,7 @@ public:
// First time a material is used, oldMaterial is null.
virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
virtual char const *const *attributeNames() const = 0; // Array must end with null.
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
inline QOpenGLShaderProgram *program() { return &m_program; }
#endif
protected:
@@ -110,19 +110,19 @@ protected:
friend class QSGDefaultRenderContext;
friend class QSGBatchRenderer::ShaderManager;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
void setShaderSourceFile(QOpenGLShader::ShaderType type, const QString &sourceFile);
void setShaderSourceFiles(QOpenGLShader::ShaderType type, const QStringList &sourceFiles);
virtual void compile();
#endif
virtual void initialize() { }
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
virtual const char *vertexShader() const;
virtual const char *fragmentShader() const;
#endif
private:
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QOpenGLShaderProgram m_program;
#endif
QScopedPointer<QSGMaterialShaderPrivate> d_ptr;
diff --git a/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h b/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h
index 0dbce010db..47f5e5de09 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h
+++ b/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class Q_QUICK_PRIVATE_EXPORT QSGMaterialShaderPrivate
{
public:
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
const char *loadShaderSource(QOpenGLShader::ShaderType type) const;
QHash<QOpenGLShader::ShaderType, QStringList> m_sourceFiles;
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index 220e6ab212..e5d464930c 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -39,7 +39,7 @@
#include "qsgrenderer_p.h"
#include "qsgnodeupdater_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/QOpenGLFramebufferObject>
# include <QtGui/QOpenGLContext>
# include <QtGui/QOpenGLFunctions>
@@ -67,7 +67,7 @@ int qt_sg_envInt(const char *name, int defaultValue)
void QSGBindable::clear(QSGAbstractRenderer::ClearMode mode) const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
GLuint bits = 0;
if (mode & QSGAbstractRenderer::ClearColorBuffer) bits |= GL_COLOR_BUFFER_BIT;
if (mode & QSGAbstractRenderer::ClearDepthBuffer) bits |= GL_DEPTH_BUFFER_BIT;
@@ -81,11 +81,11 @@ void QSGBindable::clear(QSGAbstractRenderer::ClearMode mode) const
// Reactivate the color buffer after switching to the stencil.
void QSGBindable::reactivate() const
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QOpenGLContext::currentContext()->functions()->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
#endif
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QSGBindableFboId::QSGBindableFboId(GLuint id)
: m_id(id)
{
@@ -181,7 +181,7 @@ bool QSGRenderer::isMirrored() const
void QSGRenderer::renderScene(uint fboId)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (fboId) {
QSGBindableFboId bindable(fboId);
renderScene(bindable);
@@ -220,9 +220,10 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
bindable.bind();
if (profileFrames)
bindTime = frameTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
+ QQuickProfiler::SceneGraphRendererBinding);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
// Sanity check that attribute registers are disabled
if (qsg_sanity_check) {
GLint count = 0;
@@ -240,7 +241,8 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
render();
if (profileFrames)
renderTime = frameTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRendererFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRendererFrame,
+ QQuickProfiler::SceneGraphRendererRender);
m_is_rendering = false;
m_changed_emitted = false;
@@ -304,13 +306,15 @@ void QSGRenderer::preprocess()
bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled();
if (profileFrames)
preprocessTime = frameTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
+ QQuickProfiler::SceneGraphRendererPreprocess);
nodeUpdater()->updateStates(root);
if (profileFrames)
updatePassTime = frameTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
+ QQuickProfiler::SceneGraphRendererUpdate);
}
void QSGRenderer::addNodesToPreprocess(QSGNode *node)
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
index 3fb23fe3cd..4589685765 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
@@ -133,7 +133,7 @@ public:
virtual void clear(QSGAbstractRenderer::ClearMode mode) const;
virtual void reactivate() const;
};
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
class QSGBindableFboId : public QSGBindable
{
public:
diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
index d309044e8f..3b0b2faf97 100644
--- a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
@@ -77,6 +77,7 @@ QT_BEGIN_NAMESPACE
\value Software The Qt Quick 2D Renderer is in use
\value OpenGL OpenGL ES 2.0 or higher
\value Direct3D12 Direct3D 12
+ \value OpenVG OpenVG via EGL
*/
/*!
diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.h b/src/quick/scenegraph/coreapi/qsgrendererinterface.h
index cf8fcf9015..722488201b 100644
--- a/src/quick/scenegraph/coreapi/qsgrendererinterface.h
+++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.h
@@ -53,7 +53,8 @@ public:
Unknown,
Software,
OpenGL,
- Direct3D12
+ Direct3D12,
+ OpenVG
};
enum Resource {
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 9923fa6e24..412023564f 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -73,7 +73,7 @@ QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCach
// this allows us to call pathForGlyph once and reuse the result.
m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution) * QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution));
Q_ASSERT(m_referenceFont.isValid());
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
m_coreProfile = (c->format().profile() == QSurfaceFormat::CoreProfile);
#else
Q_UNUSED(c)
@@ -189,7 +189,8 @@ void QSGDistanceFieldGlyphCache::update()
int count = m_pendingGlyphs.size();
if (profileFrames)
renderTime = qsg_render_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphAdaptationLayerFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphAdaptationLayerFrame,
+ QQuickProfiler::SceneGraphAdaptationLayerGlyphRender);
m_pendingGlyphs.reset();
@@ -210,6 +211,7 @@ void QSGDistanceFieldGlyphCache::update()
int((now - (renderTime / 1000000))));
}
Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(QQuickProfiler::SceneGraphAdaptationLayerFrame,
+ QQuickProfiler::SceneGraphAdaptationLayerGlyphStore,
(qint64)count);
}
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index 5880c67af0..bf267ccf92 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_p.h
@@ -141,7 +141,7 @@ public:
virtual void update() = 0;
- virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
+ void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
};
@@ -165,7 +165,7 @@ public:
virtual void update() = 0;
- virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
+ void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
};
class Q_QUICK_PRIVATE_EXPORT QSGPainterNode : public QSGVisitableNode
@@ -188,7 +188,7 @@ public:
virtual void update() = 0;
virtual QSGTexture *texture() const = 0;
- virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
+ void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
};
class Q_QUICK_EXPORT QSGLayer : public QSGDynamicTexture
@@ -231,7 +231,7 @@ public:
virtual void update() = 0;
- virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
+ void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
};
#endif
@@ -389,7 +389,7 @@ public:
void setOwnerElement(QQuickItem *ownerElement) { m_ownerElement = ownerElement; }
QQuickItem *ownerElement() const { return m_ownerElement; }
- virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
+ void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
protected:
QRectF m_bounding_rect;
QQuickItem *m_ownerElement;
diff --git a/src/quick/scenegraph/qsgbasicglyphnode_p.h b/src/quick/scenegraph/qsgbasicglyphnode_p.h
index 1d09367ea5..0a43d17d2b 100644
--- a/src/quick/scenegraph/qsgbasicglyphnode_p.h
+++ b/src/quick/scenegraph/qsgbasicglyphnode_p.h
@@ -63,16 +63,16 @@ public:
QSGBasicGlyphNode();
virtual ~QSGBasicGlyphNode();
- virtual QPointF baseLine() const { return m_baseLine; }
- virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs);
- virtual void setColor(const QColor &color);
+ QPointF baseLine() const override { return m_baseLine; }
+ void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override;
+ void setColor(const QColor &color) override;
- virtual void setPreferredAntialiasingMode(AntialiasingMode) { }
- virtual void setStyle(QQuickText::TextStyle);
- virtual void setStyleColor(const QColor &);
+ void setPreferredAntialiasingMode(AntialiasingMode) override { }
+ void setStyle(QQuickText::TextStyle) override;
+ void setStyleColor(const QColor &) override;
virtual void setMaterialColor(const QColor &color) = 0;
- virtual void update() = 0;
+ void update() override = 0;
protected:
QGlyphRun m_glyphs;
diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp
index 7fab9aeae8..635308c38a 100644
--- a/src/quick/scenegraph/qsgcontextplugin.cpp
+++ b/src/quick/scenegraph/qsgcontextplugin.cpp
@@ -45,7 +45,7 @@
// Built-in adaptations
#include <QtQuick/private/qsgsoftwareadaptation_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <QtQuick/private/qsgdefaultcontext_p.h>
#endif
@@ -62,7 +62,7 @@ QSGContextPlugin::~QSGContextPlugin()
{
}
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QSGContextFactoryInterface_iid, QLatin1String("/scenegraph")))
#endif
@@ -128,7 +128,7 @@ QSGAdaptationBackendData *contextFactory()
if (requestedBackend.isEmpty() && qEnvironmentVariableIsSet("QT_QUICK_BACKEND"))
requestedBackend = QString::fromLocal8Bit(qgetenv("QT_QUICK_BACKEND"));
-#ifdef QT_NO_OPENGL
+#if !QT_CONFIG(opengl)
// If this is a build without OpenGL, and no backend has been set
// default to the software renderer
if (requestedBackend.isEmpty())
@@ -148,7 +148,7 @@ QSGAdaptationBackendData *contextFactory()
}
}
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
// Then try the plugins.
if (!backendData->factory) {
const int index = loader()->indexOf(requestedBackend);
@@ -165,7 +165,7 @@ QSGAdaptationBackendData *contextFactory()
qPrintable(QLibraryInfo::location(QLibraryInfo::PluginsPath)));
}
}
-#endif // QT_NO_LIBRARY
+#endif // library
}
}
@@ -185,7 +185,7 @@ QSGContext *QSGContext::createDefaultContext()
QSGAdaptationBackendData *backendData = contextFactory();
if (backendData->factory)
return backendData->factory->create(backendData->name);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
return new QSGDefaultContext();
#else
return nullptr;
diff --git a/src/quick/scenegraph/qsgcontextplugin_p.h b/src/quick/scenegraph/qsgcontextplugin_p.h
index 08c3d21408..5914b42809 100644
--- a/src/quick/scenegraph/qsgcontextplugin_p.h
+++ b/src/quick/scenegraph/qsgcontextplugin_p.h
@@ -90,10 +90,10 @@ public:
explicit QSGContextPlugin(QObject *parent = 0);
virtual ~QSGContextPlugin();
- virtual QStringList keys() const = 0;
+ virtual QStringList keys() const override = 0;
- virtual QQuickTextureFactory *createTextureFactoryFromImage(const QImage &) { return 0; }
- virtual QSGRenderLoop *createWindowManager() { return 0; }
+ QQuickTextureFactory *createTextureFactoryFromImage(const QImage &) override { return 0; }
+ QSGRenderLoop *createWindowManager() override { return 0; }
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
index 0fefb95328..57dc4a5d07 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
@@ -72,10 +72,10 @@ public:
QSGDefaultDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font);
virtual ~QSGDefaultDistanceFieldGlyphCache();
- void requestGlyphs(const QSet<glyph_t> &glyphs);
- void storeGlyphs(const QList<QDistanceField> &glyphs);
- void referenceGlyphs(const QSet<glyph_t> &glyphs);
- void releaseGlyphs(const QSet<glyph_t> &glyphs);
+ void requestGlyphs(const QSet<glyph_t> &glyphs) override;
+ void storeGlyphs(const QList<QDistanceField> &glyphs) override;
+ void referenceGlyphs(const QSet<glyph_t> &glyphs) override;
+ void releaseGlyphs(const QSet<glyph_t> &glyphs) override;
bool useTextureResizeWorkaround() const;
bool useTextureUploadWorkaround() const;
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
index caa7dfad07..b0a2788dd8 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
@@ -71,9 +71,9 @@ public:
QSGTextMaskMaterial(const QRawFont &font, QFontEngine::GlyphFormat glyphFormat = QFontEngine::Format_None);
virtual ~QSGTextMaskMaterial();
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
- virtual int compare(const QSGMaterial *other) const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
+ int compare(const QSGMaterial *other) const override;
void setColor(const QColor &c) { m_color = QVector4D(c.redF(), c.greenF(), c.blueF(), c.alphaF()); }
void setColor(const QVector4D &color) { m_color = color; }
@@ -115,10 +115,10 @@ public:
void setStyleColor(const QVector4D &color) { m_styleColor = color; }
const QVector4D &styleColor() const { return m_styleColor; }
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
- int compare(const QSGMaterial *other) const;
+ int compare(const QSGMaterial *other) const override;
private:
QVector2D m_styleShift;
@@ -131,8 +131,8 @@ public:
QSGOutlinedTextMaterial(const QRawFont &font);
~QSGOutlinedTextMaterial() { }
- QSGMaterialType *type() const;
- QSGMaterialShader *createShader() const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
index 22c68558ef..c0c6bda718 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
@@ -67,19 +67,19 @@ public:
QSGDistanceFieldGlyphNode(QSGRenderContext *context);
~QSGDistanceFieldGlyphNode();
- virtual QPointF baseLine() const { return m_baseLine; }
- virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs);
- virtual void setColor(const QColor &color);
+ QPointF baseLine() const override { return m_baseLine; }
+ void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override;
+ void setColor(const QColor &color) override;
- virtual void setPreferredAntialiasingMode(AntialiasingMode mode);
+ void setPreferredAntialiasingMode(AntialiasingMode mode) override;
- virtual void setStyle(QQuickText::TextStyle style);
- virtual void setStyleColor(const QColor &color);
+ void setStyle(QQuickText::TextStyle style) override;
+ void setStyleColor(const QColor &color) override;
- virtual void update();
- void preprocess();
+ void update() override;
+ void preprocess() override;
- void invalidateGlyphs(const QVector<quint32> &glyphs);
+ void invalidateGlyphs(const QVector<quint32> &glyphs) override;
void updateGeometry();
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
index 38dcf3d307..c13a0898eb 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
@@ -63,9 +63,9 @@ public:
QSGDistanceFieldTextMaterial();
~QSGDistanceFieldTextMaterial();
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
- virtual int compare(const QSGMaterial *other) const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
+ int compare(const QSGMaterial *other) const override;
virtual void setColor(const QColor &color);
const QVector4D &color() const { return m_color; }
@@ -97,9 +97,9 @@ public:
QSGDistanceFieldStyledTextMaterial();
~QSGDistanceFieldStyledTextMaterial();
- virtual QSGMaterialType *type() const = 0;
- virtual QSGMaterialShader *createShader() const = 0;
- virtual int compare(const QSGMaterial *other) const;
+ QSGMaterialType *type() const override = 0;
+ QSGMaterialShader *createShader() const override = 0;
+ int compare(const QSGMaterial *other) const override;
void setStyleColor(const QColor &color);
const QVector4D &styleColor() const { return m_styleColor; }
@@ -114,8 +114,8 @@ public:
QSGDistanceFieldOutlineTextMaterial();
~QSGDistanceFieldOutlineTextMaterial();
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
};
class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldShiftedStyleTextMaterial : public QSGDistanceFieldStyledTextMaterial
@@ -124,9 +124,9 @@ public:
QSGDistanceFieldShiftedStyleTextMaterial();
~QSGDistanceFieldShiftedStyleTextMaterial();
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
- virtual int compare(const QSGMaterial *other) const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
+ int compare(const QSGMaterial *other) const override;
void setShift(const QPointF &shift) { m_shift = shift; }
const QPointF &shift() const { return m_shift; }
@@ -138,17 +138,17 @@ protected:
class Q_QUICK_PRIVATE_EXPORT QSGHiQSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
{
public:
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
- void setColor(const QColor &color) { m_color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
+ void setColor(const QColor &color) override { m_color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
};
class Q_QUICK_PRIVATE_EXPORT QSGLoQSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
{
public:
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
- void setColor(const QColor &color) { m_color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
+ void setColor(const QColor &color) override { m_color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 9ddbe5aa1d..48288bfc62 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -58,7 +58,7 @@
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qquickprofiler_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/QOpenGLContext>
# include <private/qsgdefaultrendercontext_p.h>
#if QT_CONFIG(quick_shadereffect)
@@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE
extern bool qsg_useConsistentTiming();
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
/*!
expectations for this manager to work:
- one opengl context to render multiple windows
@@ -119,7 +119,7 @@ void QSGRenderLoop::cleanup()
void QSGRenderLoop::postJob(QQuickWindow *window, QRunnable *job)
{
Q_ASSERT(job);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
Q_ASSERT(window);
if (window->openglContext()) {
window->openglContext()->makeCurrent(window);
@@ -131,7 +131,7 @@ void QSGRenderLoop::postJob(QQuickWindow *window, QRunnable *job)
#endif
delete job;
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
class QSGGuiThreadRenderLoop : public QSGRenderLoop
{
Q_OBJECT
@@ -182,7 +182,7 @@ QSGRenderLoop *QSGRenderLoop::instance()
const_cast<QLoggingCategory &>(QSG_LOG_INFO()).setEnabled(QtDebugMsg, true);
s_instance = QSGContext::createWindowManager();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (!s_instance) {
enum RenderLoopType {
@@ -272,7 +272,7 @@ void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window,
if (!signalEmitted)
qFatal("%s", qPrintable(untranslatedMessage));
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QSGGuiThreadRenderLoop::QSGGuiThreadRenderLoop()
: gl(0)
{
@@ -401,7 +401,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
- QQuickProfiler::SceneGraphRenderLoopFrame);
+ QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphPolishPolish);
emit window->afterAnimating();
@@ -409,13 +410,15 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
cd->renderSceneGraph(window->size());
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (data.grabOnly) {
bool alpha = window->format().alphaBufferSize() > 0 && window->color().alpha() != 255;
@@ -432,7 +435,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled()) {
static QTime lastFrameTime = QTime::currentTime();
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 693012154e..4543782d5b 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -602,7 +602,8 @@ void QSGRenderThread::syncAndRender()
if (profileFrames)
syncTime = threadTimer.nsecsElapsed();
#endif
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
if (!syncResultedInChanges && !repaintRequested && sgrc->isValid()) {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- no changes, render aborted";
@@ -634,12 +635,14 @@ void QSGRenderThread::syncAndRender()
d->renderSceneGraph(windowSize);
if (profileFrames)
renderTime = threadTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (!d->customRenderStage || !d->customRenderStage->swap())
gl->swapBuffers(window);
d->fireFrameSwapped();
} else {
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame, 1);
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync, 1);
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- window not ready, skipping render";
}
@@ -664,7 +667,8 @@ void QSGRenderThread::syncAndRender()
int(threadTimer.elapsed() - renderTime / 1000000));
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
}
@@ -1169,7 +1173,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
if (profileFrames)
polishTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncPolish);
w->updateDuringSync = false;
@@ -1184,7 +1189,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
qCDebug(QSG_LOG_RENDERLOOP) << "- wait for sync";
if (profileFrames)
waitTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncWait);
w->thread->waitCondition.wait(&w->thread->mutex);
m_lockedForSync = false;
w->thread->mutex.unlock();
@@ -1192,7 +1198,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
if (profileFrames)
syncTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncSync);
if (m_animation_timer == 0 && m_animation_driver->isRunning()) {
qCDebug(QSG_LOG_RENDERLOOP) << "- advancing animations";
@@ -1213,7 +1220,8 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
<< ", animations=" << (timer.nsecsElapsed() - syncTime) / 1000000
<< " - (on Gui thread) " << window;
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync,
+ QQuickProfiler::SceneGraphPolishAndSyncAnimations);
}
bool QSGThreadedRenderLoop::event(QEvent *e)
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h
index 0ab83b444a..32bfcb7148 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h
+++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h
@@ -68,29 +68,29 @@ public:
QSGThreadedRenderLoop();
~QSGThreadedRenderLoop();
- void show(QQuickWindow *) {}
- void hide(QQuickWindow *);
+ void show(QQuickWindow *) override {}
+ void hide(QQuickWindow *) override;
- void windowDestroyed(QQuickWindow *window);
- void exposureChanged(QQuickWindow *window);
+ void windowDestroyed(QQuickWindow *window) override;
+ void exposureChanged(QQuickWindow *window) override;
- QImage grab(QQuickWindow *);
+ QImage grab(QQuickWindow *) override;
- void update(QQuickWindow *window);
- void maybeUpdate(QQuickWindow *window);
- void handleUpdateRequest(QQuickWindow *window);
+ void update(QQuickWindow *window) override;
+ void maybeUpdate(QQuickWindow *window) override;
+ void handleUpdateRequest(QQuickWindow *window) override;
- QSGContext *sceneGraphContext() const;
- QSGRenderContext *createRenderContext(QSGContext *) const;
+ QSGContext *sceneGraphContext() const override;
+ QSGRenderContext *createRenderContext(QSGContext *) const override;
- QAnimationDriver *animationDriver() const;
+ QAnimationDriver *animationDriver() const override;
- void releaseResources(QQuickWindow *window);
+ void releaseResources(QQuickWindow *window) override;
- bool event(QEvent *);
- void postJob(QQuickWindow *window, QRunnable *job);
+ bool event(QEvent *) override;
+ void postJob(QQuickWindow *window, QRunnable *job) override;
- bool interleaveIncubation() const;
+ bool interleaveIncubation() const override;
public Q_SLOTS:
void animationStarted();
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 2a2d8be657..e944ddbc4f 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -71,9 +71,9 @@ static QElapsedTimer qsg_render_timer;
if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled()) \
sampleName = qsg_render_timer.nsecsElapsed(); \
-#define QSG_RENDER_TIMING_SAMPLE(frameType, sampleName) \
+#define QSG_RENDER_TIMING_SAMPLE(frameType, sampleName, position) \
QSG_LOG_TIME_SAMPLE(sampleName) \
- Q_QUICK_SG_PROFILE_RECORD(frameType);
+ Q_QUICK_SG_PROFILE_RECORD(frameType, position);
QSGWindowsRenderLoop::QSGWindowsRenderLoop()
@@ -405,7 +405,7 @@ void QSGWindowsRenderLoop::render()
"animations ticked in %dms",
int((qsg_render_timer.nsecsElapsed() - time_start)/1000000));
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphWindowsAnimations);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphWindowsAnimations, 1);
// It is not given that animations triggered another maybeUpdate()
// and thus another render pass, so to keep things running,
@@ -456,22 +456,26 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
d->polishItems();
QSG_LOG_TIME_SAMPLE(time_polished);
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
- QQuickProfiler::SceneGraphRenderLoopFrame);
+ QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphPolishPolish);
emit window->afterAnimating();
RLDEBUG(" - syncing");
d->syncSceneGraph();
- QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced,
+ QQuickProfiler::SceneGraphRenderLoopSync);
RLDEBUG(" - rendering");
d->renderSceneGraph(window->size());
- QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_rendered);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_rendered,
+ QQuickProfiler::SceneGraphRenderLoopRender);
RLDEBUG(" - swapping");
if (!d->customRenderStage || !d->customRenderStage->swap())
m_gl->swapBuffers(window);
- QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_swapped);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_swapped,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
RLDEBUG(" - frameDone");
d->fireFrameSwapped();
@@ -484,7 +488,8 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
<< ", swap=" << (time_swapped - time_rendered) / 1000000
<< " - " << window;
- Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
}
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop_p.h b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
index 9e5d7f04d3..1940a66af2 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop_p.h
+++ b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
@@ -70,31 +70,31 @@ public:
explicit QSGWindowsRenderLoop();
~QSGWindowsRenderLoop();
- void show(QQuickWindow *window);
- void hide(QQuickWindow *window);
+ void show(QQuickWindow *window) override;
+ void hide(QQuickWindow *window) override;
- void windowDestroyed(QQuickWindow *window);
+ void windowDestroyed(QQuickWindow *window) override;
- void exposureChanged(QQuickWindow *window);
- QImage grab(QQuickWindow *window);
+ void exposureChanged(QQuickWindow *window) override;
+ QImage grab(QQuickWindow *window) override;
- void update(QQuickWindow *window);
- void maybeUpdate(QQuickWindow *window);
+ void update(QQuickWindow *window) override;
+ void maybeUpdate(QQuickWindow *window) override;
- QAnimationDriver *animationDriver() const { return m_animationDriver; }
+ QAnimationDriver *animationDriver() const override { return m_animationDriver; }
- QSGContext *sceneGraphContext() const { return m_sg; }
- QSGRenderContext *createRenderContext(QSGContext *) const;
+ QSGContext *sceneGraphContext() const override { return m_sg; }
+ QSGRenderContext *createRenderContext(QSGContext *) const override;
- void releaseResources(QQuickWindow *) { }
+ void releaseResources(QQuickWindow *) override { }
void render();
void renderWindow(QQuickWindow *window);
- bool event(QEvent *event);
+ bool event(QEvent *event) override;
bool anyoneShowing() const;
- bool interleaveIncubation() const;
+ bool interleaveIncubation() const override;
public Q_SLOTS:
void started();
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index b6abb55bd3..c864ea9496 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -395,9 +395,12 @@ void Atlas::bind(QSGTexture::Filtering filtering)
bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled();
if (profileFrames)
qsg_renderer_timer.start();
- // Skip bind, convert, swizzle; they're irrelevant
+
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphTexturePrepare);
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare, 3);
+
+ // Skip bind, convert, swizzle; they're irrelevant
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareStart, 3);
Texture *t = m_pending_uploads.at(i);
if (m_externalFormat == GL_BGRA &&
@@ -415,10 +418,14 @@ void Atlas::bind(QSGTexture::Filtering filtering)
<< "ms (" << t->textureSize().width() << "x"
<< t->textureSize().height() << ")";
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareUpload);
+
// Skip mipmap; unused
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare, 1);
- Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareUpload, 1);
+ Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareMipmap);
}
GLenum f = filtering == QSGTexture::Nearest ? GL_NEAREST : GL_LINEAR;
diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp
index 79e43e3820..9ca9cdb107 100644
--- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp
+++ b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp
@@ -40,7 +40,7 @@
#include "qsgdistancefieldutil_p.h"
#include <private/qsgadaptationlayer_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/private/qopenglengineshadersource_p.h>
#endif
#include <QtQuick/private/qsgcontext_p.h>
diff --git a/src/quick/scenegraph/util/qsgengine.cpp b/src/quick/scenegraph/util/qsgengine.cpp
index ad1fcfa470..09e4cdf5a7 100644
--- a/src/quick/scenegraph/util/qsgengine.cpp
+++ b/src/quick/scenegraph/util/qsgengine.cpp
@@ -44,7 +44,7 @@
#include <private/qsgrenderer_p.h>
#include <private/qsgtexture_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/QOpenGLContext>
# include <private/qsgdefaultrendercontext_p.h>
#endif
@@ -116,7 +116,7 @@ QSGEngine::~QSGEngine()
void QSGEngine::initialize(QOpenGLContext *context)
{
Q_D(QSGEngine);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (context && QOpenGLContext::currentContext() != context) {
qWarning("WARNING: The context must be current before calling QSGEngine::initialize.");
return;
@@ -125,7 +125,7 @@ void QSGEngine::initialize(QOpenGLContext *context)
if (d->sgRenderContext && !d->sgRenderContext->isValid()) {
d->sgRenderContext->setAttachToGraphicsContext(false);
d->sgRenderContext->initialize(context);
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (context)
connect(context, &QOpenGLContext::aboutToBeDestroyed, this, &QSGEngine::invalidate);
#endif
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
index 2ce27275cd..8ab7669891 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
@@ -39,7 +39,7 @@
#include "qsgflatcolormaterial.h"
#include <private/qsgmaterialshader_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <qopenglshaderprogram.h>
#endif
@@ -57,7 +57,7 @@ public:
private:
virtual void initialize();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
int m_matrix_id;
int m_color_id;
#endif
@@ -68,7 +68,7 @@ QSGMaterialType FlatColorMaterialShader::type;
FlatColorMaterialShader::FlatColorMaterialShader()
: QSGMaterialShader(*new QSGMaterialShaderPrivate)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/flatcolor.vert"));
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/flatcolor.frag"));
#endif
@@ -76,7 +76,7 @@ FlatColorMaterialShader::FlatColorMaterialShader()
void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
QSGFlatColorMaterial *oldMaterial = static_cast<QSGFlatColorMaterial *>(oldEffect);
QSGFlatColorMaterial *newMaterial = static_cast<QSGFlatColorMaterial *>(newEffect);
@@ -109,7 +109,7 @@ char const *const *FlatColorMaterialShader::attributeNames() const
void FlatColorMaterialShader::initialize()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
m_matrix_id = program()->uniformLocation("matrix");
m_color_id = program()->uniformLocation("color");
#endif
diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h
index 01f98767fd..0e7219d7bd 100644
--- a/src/quick/scenegraph/util/qsgsimplematerial.h
+++ b/src/quick/scenegraph/util/qsgsimplematerial.h
@@ -48,9 +48,9 @@ template <typename State>
class QSGSimpleMaterialShader : public QSGMaterialShader
{
public:
- void initialize() {
+ void initialize() override {
QSGMaterialShader::initialize();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
m_id_matrix = program()->uniformLocation(uniformMatrixName());
if (m_id_matrix < 0) {
qFatal("QSGSimpleMaterialShader does not implement 'uniform highp mat4 %s;' in its vertex shader",
@@ -74,7 +74,7 @@ public:
const char *uniformMatrixName() const { return "qt_Matrix"; }
const char *uniformOpacityName() const { return "qt_Opacity"; }
- void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
+ void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
virtual void updateState(const State *newState, const State *oldState) = 0;
@@ -82,7 +82,7 @@ public:
virtual QList<QByteArray> attributes() const = 0;
- char const *const *attributeNames() const
+ char const *const *attributeNames() const override
{
if (m_attribute_pointers.size())
return m_attribute_pointers.constData();
@@ -197,7 +197,7 @@ QSGMaterialType QSGSimpleMaterial<State>::m_type;
template <typename State>
Q_INLINE_TEMPLATE void QSGSimpleMaterialShader<State>::updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (state.isMatrixDirty())
program()->setUniformValue(m_id_matrix, state.combinedMatrix());
if (state.isOpacityDirty() && m_id_opacity >= 0)
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index 4cf339aeb8..47248f2f37 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -45,7 +45,7 @@
#include <private/qqmlglobal_p.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qpa/qplatformnativeinterface.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <qopenglfunctions.h>
# include <QtGui/qopenglcontext.h>
# include <QtGui/qopenglfunctions.h>
@@ -70,7 +70,7 @@
#include <QHash>
#endif
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
static QElapsedTimer qsg_renderer_timer;
#endif
@@ -86,7 +86,7 @@ static const bool qsg_leak_check = !qEnvironmentVariableIsEmpty("QML_LEAK_CHECK"
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
inline static bool isPowerOfTwo(int x)
{
// Assumption: x >= 1
@@ -284,7 +284,7 @@ Q_GLOBAL_STATIC(QMutex, qsg_valid_texture_mutex)
bool qsg_safeguard_texture(QSGTexture *texture)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QMutexLocker locker(qsg_valid_texture_mutex());
if (!qsg_valid_texture_set()->contains(texture)) {
qWarning() << "Invalid texture accessed:" << (void *) texture;
@@ -527,7 +527,7 @@ QSGTexture::WrapMode QSGTexture::verticalWrapMode() const
*/
void QSGTexture::updateBindOptions(bool force)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
Q_D(QSGTexture);
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
force |= isAtlasTexture();
@@ -582,7 +582,7 @@ QSGPlainTexture::QSGPlainTexture()
QSGPlainTexture::~QSGPlainTexture()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_texture_id && m_owns_texture && QOpenGLContext::currentContext())
QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_texture_id);
#endif
@@ -617,7 +617,7 @@ int QSGPlainTexture::textureId() const
// or ~QSGPlainTexture so just keep it minimal here.
return 0;
} else if (m_texture_id == 0){
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
// Generate a texture id for use later and return it.
QOpenGLContext::currentContext()->functions()->glGenTextures(1, &const_cast<QSGPlainTexture *>(this)->m_texture_id);
#endif
@@ -629,7 +629,7 @@ int QSGPlainTexture::textureId() const
void QSGPlainTexture::setTextureId(int id)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (m_texture_id && m_owns_texture)
QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_texture_id);
#endif
@@ -643,7 +643,7 @@ void QSGPlainTexture::setTextureId(int id)
void QSGPlainTexture::bind()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QOpenGLContext *context = QOpenGLContext::currentContext();
QOpenGLFunctions *funcs = context->functions();
if (!m_dirty_texture) {
@@ -673,7 +673,8 @@ void QSGPlainTexture::bind()
(int) qsg_renderer_timer.elapsed(),
m_texture_size.width(),
m_texture_size.height());
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTextureDeletion);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTextureDeletion,
+ QQuickProfiler::SceneGraphTextureDeletionDelete);
}
m_texture_id = 0;
m_texture_size = QSize();
@@ -689,7 +690,8 @@ void QSGPlainTexture::bind()
qint64 bindTime = 0;
if (profileFrames)
bindTime = qsg_renderer_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareBind);
// ### TODO: check for out-of-memory situations...
@@ -730,7 +732,8 @@ void QSGPlainTexture::bind()
qint64 convertTime = 0;
if (profileFrames)
convertTime = qsg_renderer_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareConvert);
updateBindOptions(m_dirty_bind_options);
@@ -773,14 +776,16 @@ void QSGPlainTexture::bind()
qint64 swizzleTime = 0;
if (profileFrames)
swizzleTime = qsg_renderer_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareSwizzle);
funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, m_texture_size.width(), m_texture_size.height(), 0, externalFormat, GL_UNSIGNED_BYTE, tmp.constBits());
qint64 uploadTime = 0;
if (profileFrames)
uploadTime = qsg_renderer_timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareUpload);
if (mipmapFiltering() != QSGTexture::None) {
funcs->glGenerateMipmap(GL_TEXTURE_2D);
@@ -803,7 +808,8 @@ void QSGPlainTexture::bind()
int((mipmapTime - uploadTime)/1000000),
m_texture_size != m_image.size() ? " (scaled to GL_MAX_TEXTURE_SIZE)" : "");
}
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTexturePrepareMipmap);
m_texture_rect = QRectF(0, 0, 1, 1);
diff --git a/src/quick/scenegraph/util/qsgtexture_p.h b/src/quick/scenegraph/util/qsgtexture_p.h
index e09cbdbef1..b6fcfc31c4 100644
--- a/src/quick/scenegraph/util/qsgtexture_p.h
+++ b/src/quick/scenegraph/util/qsgtexture_p.h
@@ -53,7 +53,7 @@
#include <QtQuick/qtquickglobal.h>
#include <private/qobject_p.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/qopengl.h>
#endif
#include "qsgtexture.h"
diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp
index 119828bc81..9326ea640d 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial.cpp
+++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp
@@ -39,14 +39,14 @@
#include "qsgtexturematerial_p.h"
#include "qsgtexture_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QtGui/qopenglshaderprogram.h>
# include <QtGui/qopenglfunctions.h>
#endif
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
inline static bool isPowerOfTwo(int x)
{
// Assumption: x >= 1
@@ -59,7 +59,7 @@ QSGMaterialType QSGOpaqueTextureMaterialShader::type;
QSGOpaqueTextureMaterialShader::QSGOpaqueTextureMaterialShader()
: QSGMaterialShader()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/opaquetexture.vert"));
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/opaquetexture.frag"));
#endif
@@ -73,7 +73,7 @@ char const *const *QSGOpaqueTextureMaterialShader::attributeNames() const
void QSGOpaqueTextureMaterialShader::initialize()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
m_matrix_id = program()->uniformLocation("qt_Matrix");
#endif
}
@@ -95,7 +95,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa
t->setHorizontalWrapMode(tx->horizontalWrapMode());
t->setVerticalWrapMode(tx->verticalWrapMode());
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
bool npotSupported = const_cast<QOpenGLContext *>(state.context())
->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat);
if (!npotSupported) {
@@ -115,7 +115,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa
t->bind();
else
t->updateBindOptions();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (state.isMatrixDirty())
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
#endif
@@ -379,7 +379,7 @@ QSGMaterialShader *QSGTextureMaterial::createShader() const
QSGTextureMaterialShader::QSGTextureMaterialShader()
: QSGOpaqueTextureMaterialShader()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/texture.frag"));
#endif
}
@@ -387,7 +387,7 @@ QSGTextureMaterialShader::QSGTextureMaterialShader()
void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (state.isOpacityDirty())
program()->setUniformValue(m_opacity_id, state.opacity());
#endif
@@ -397,7 +397,7 @@ void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial
void QSGTextureMaterialShader::initialize()
{
QSGOpaqueTextureMaterialShader::initialize();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
m_opacity_id = program()->uniformLocation("opacity");
#endif
}
diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
index 847ec289d8..8c305d7fd4 100644
--- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qsgvertexcolormaterial.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <qopenglshaderprogram.h>
#endif
QT_BEGIN_NAMESPACE
@@ -55,7 +55,7 @@ public:
private:
virtual void initialize();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
int m_matrix_id;
int m_opacity_id;
#endif
@@ -66,7 +66,7 @@ QSGMaterialType QSGVertexColorMaterialShader::type;
QSGVertexColorMaterialShader::QSGVertexColorMaterialShader()
: QSGMaterialShader()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/vertexcolor.vert"));
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/vertexcolor.frag"));
#endif
@@ -74,7 +74,7 @@ QSGVertexColorMaterialShader::QSGVertexColorMaterialShader()
void QSGVertexColorMaterialShader::updateState(const RenderState &state, QSGMaterial * /*newEffect*/, QSGMaterial *)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (state.isOpacityDirty())
program()->setUniformValue(m_opacity_id, state.opacity());
@@ -93,7 +93,7 @@ char const *const *QSGVertexColorMaterialShader::attributeNames() const
void QSGVertexColorMaterialShader::initialize()
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
m_matrix_id = program()->uniformLocation("matrix");
m_opacity_id = program()->uniformLocation("opacity");
#endif
diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h
index d7aaa988a9..a3ced4c21b 100644
--- a/src/quick/util/qquickanimatorjob_p.h
+++ b/src/quick/util/qquickanimatorjob_p.h
@@ -290,7 +290,7 @@ public:
private:
QSGOpacityNode *m_opacityNode;
};
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimatorJob : public QQuickAnimatorJob
{
public:
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index 7692cc79f9..5a723e4432 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -783,7 +783,7 @@ public:
return new QQuickApplication(parent);
}
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
QInputMethod *inputMethod()
{
QInputMethod *im = qGuiApp->inputMethod();
diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h
index 66ed212722..d2fa935ad4 100644
--- a/src/quick/util/qquickprofiler_p.h
+++ b/src/quick/util/qquickprofiler_p.h
@@ -152,7 +152,6 @@ private:
template<uint size>
struct TimingData {
qint64 values[size][s_numSceneGraphTimings + 1];
- int offsets[size];
};
QThreadStorage<TimingData<NumRenderThreadFrameTypes> > renderThreadTimings;
@@ -167,15 +166,6 @@ public:
else
return guiThreadTimings.values[type - NumRenderThreadFrameTypes];
}
-
- template<SceneGraphFrameType type>
- int &offset()
- {
- if (type < NumRenderThreadFrameTypes)
- return renderThreadTimings.localData().offsets[type];
- else
- return guiThreadTimings.offsets[type - NumRenderThreadFrameTypes];
- }
};
class Q_QUICK_PRIVATE_EXPORT QQuickProfiler : public QObject, public QQmlProfilerDefinitions {
@@ -187,6 +177,59 @@ public:
RenderThread
};
+ enum SceneGraphContextStage {
+ SceneGraphContextStart,
+ SceneGraphContextMaterialCompile
+ };
+
+ enum SceneGraphRendererStage {
+ SceneGraphRendererStart,
+ SceneGraphRendererPreprocess,
+ SceneGraphRendererUpdate,
+ SceneGraphRendererBinding,
+ SceneGraphRendererRender
+ };
+
+ enum SceneGraphAdaptationLayerStage {
+ SceneGraphAdaptationLayerStart,
+ SceneGraphAdaptationLayerGlyphRender,
+ SceneGraphAdaptationLayerGlyphStore
+ };
+
+ enum SceneGraphRenderLoopStage {
+ SceneGraphRenderLoopStart,
+ SceneGraphRenderLoopSync,
+ SceneGraphRenderLoopRender,
+ SceneGraphRenderLoopSwap
+ };
+
+ enum SceneGraphPolishStage {
+ SceneGraphPolishStart,
+ SceneGraphPolishPolish
+ };
+
+ enum SceneGraphPolishAndSyncStage {
+ SceneGraphPolishAndSyncStart,
+ SceneGraphPolishAndSyncPolish,
+ SceneGraphPolishAndSyncWait,
+ SceneGraphPolishAndSyncSync,
+ SceneGraphPolishAndSyncAnimations
+ };
+
+ enum SceneGraphTexturePrepareStage {
+ SceneGraphTexturePrepareStart,
+ SceneGraphTexturePrepareBind,
+ SceneGraphTexturePrepareConvert,
+ SceneGraphTexturePrepareSwizzle,
+ SceneGraphTexturePrepareUpload,
+ SceneGraphTexturePrepareMipmap
+ };
+
+ enum SceneGraphTextureDeletionStage {
+ SceneGraphTextureDeletionStart,
+ SceneGraphTextureDeletionDelete
+ };
+
template<EventType DetailType, InputEventType InputType>
static void inputEvent(int x, int y = 0)
{
@@ -209,7 +252,6 @@ public:
static void startSceneGraphFrame()
{
startSceneGraphFrame<FrameType1>();
- s_instance->m_sceneGraphData.offset<FrameType2>() = 0;
s_instance->m_sceneGraphData.timings<FrameType2>()[0] =
s_instance->m_sceneGraphData.timings<FrameType1>()[0];
}
@@ -217,50 +259,45 @@ public:
template<SceneGraphFrameType FrameType>
static void startSceneGraphFrame()
{
- s_instance->m_sceneGraphData.offset<FrameType>() = 0;
s_instance->m_sceneGraphData.timings<FrameType>()[0] = s_instance->timestamp();
}
template<SceneGraphFrameType FrameType>
- static void recordSceneGraphTimestamp()
+ static void recordSceneGraphTimestamp(uint position)
{
- s_instance->m_sceneGraphData.timings<FrameType>()
- [++s_instance->m_sceneGraphData.offset<FrameType>()] = s_instance->timestamp();
+ s_instance->m_sceneGraphData.timings<FrameType>()[position] = s_instance->timestamp();
}
template<SceneGraphFrameType FrameType, uint Skip>
- static void skipSceneGraphTimestamps()
+ static void skipSceneGraphTimestamps(uint position)
{
qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>();
- const qint64 last = timings[s_instance->m_sceneGraphData.offset<FrameType>()];
+ const qint64 last = timings[position];
for (uint i = 0; i < Skip; ++i)
- timings[++s_instance->m_sceneGraphData.offset<FrameType>()] = last;
+ timings[++position] = last;
}
template<SceneGraphFrameType FrameType, bool Record>
- static void reportSceneGraphFrame(quint64 payload = ~0)
+ static void reportSceneGraphFrame(uint position, quint64 payload = ~0)
{
qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>();
- int &offset = s_instance->m_sceneGraphData.offset<FrameType>();
if (Record)
- timings[++offset] = s_instance->timestamp();
+ timings[position] = s_instance->timestamp();
s_instance->processMessage(QQuickProfilerData(
- timings[offset], 1 << SceneGraphFrame, 1 << FrameType,
- offset > 0 ? timings[1] - timings[0] : payload,
- offset > 1 ? timings[2] - timings[1] : payload,
- offset > 2 ? timings[3] - timings[2] : payload,
- offset > 3 ? timings[4] - timings[3] : payload,
- offset > 4 ? timings[5] - timings[4] : payload));
+ timings[position], 1 << SceneGraphFrame, 1 << FrameType,
+ position > 0 ? timings[1] - timings[0] : payload,
+ position > 1 ? timings[2] - timings[1] : payload,
+ position > 2 ? timings[3] - timings[2] : payload,
+ position > 3 ? timings[4] - timings[3] : payload,
+ position > 4 ? timings[5] - timings[4] : payload));
}
template<SceneGraphFrameType FrameType, bool Record, SceneGraphFrameType SwitchTo>
- static void reportSceneGraphFrame(quint64 payload = ~0)
+ static void reportSceneGraphFrame(uint position, quint64 payload = ~0)
{
- reportSceneGraphFrame<FrameType, Record>(payload);
- s_instance->m_sceneGraphData.offset<SwitchTo>() = 0;
+ reportSceneGraphFrame<FrameType, Record>(position, payload);
s_instance->m_sceneGraphData.timings<SwitchTo>()[0] =
- s_instance->m_sceneGraphData.timings<FrameType>()
- [s_instance->m_sceneGraphData.offset<FrameType>()];
+ s_instance->m_sceneGraphData.timings<FrameType>()[position];
}
template<PixmapEventType PixmapState>
@@ -326,38 +363,52 @@ protected:
#define Q_QUICK_PROFILE(feature, Method)\
Q_QUICK_PROFILE_IF_ENABLED(feature, QQuickProfiler::Method)
+// Record current timestamp for \a Type at position 0.
#define Q_QUICK_SG_PROFILE_START(Type)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
(QQuickProfiler::startSceneGraphFrame<Type>()))
-#define Q_QUICK_SG_PROFILE_RECORD(Type)\
+// Record current timestamp for \a Type at \a position.
+#define Q_QUICK_SG_PROFILE_RECORD(Type, position)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::recordSceneGraphTimestamp<Type>()))
+ (QQuickProfiler::recordSceneGraphTimestamp<Type>(position)))
-#define Q_QUICK_SG_PROFILE_SKIP(Type, Skip)\
+// Use the timestamp for \a Type at position \a position and repeat it \a Skip times in subsequent
+// positions.
+#define Q_QUICK_SG_PROFILE_SKIP(Type, position, Skip)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::skipSceneGraphTimestamps<Type, Skip>()))
+ (QQuickProfiler::skipSceneGraphTimestamps<Type, Skip>(position)))
+// Record current timestamp for both \a Type1 and \a Type2 at position 0.
#define Q_QUICK_SG_PROFILE_START_SYNCHRONIZED(Type1, Type2)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
(QQuickProfiler::startSceneGraphFrame<Type1, Type2>()))
-#define Q_QUICK_SG_PROFILE_SWITCH(Type1, Type2) \
+// report \a Type1, using the current timestamp at \a position, and switch to \a Typ2, using
+// the current timestamp at position 0.
+#define Q_QUICK_SG_PROFILE_SWITCH(Type1, Type2, position)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::reportSceneGraphFrame<Type1, true, Type2>()))
+ (QQuickProfiler::reportSceneGraphFrame<Type1, true, Type2>(\
+ position)))
-#define Q_QUICK_SG_PROFILE_REPORT(Type)\
+// report \a Type, using data points 0 to \a position, including \a position.
+#define Q_QUICK_SG_PROFILE_REPORT(Type, position)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::reportSceneGraphFrame<Type, false>()))
+ (QQuickProfiler::reportSceneGraphFrame<Type, false>(position)))
-#define Q_QUICK_SG_PROFILE_END(Type)\
+// report \a Type, using data points 0 to \a position, including \a position, and setting the
+// timestamp at \a position to the current one.
+#define Q_QUICK_SG_PROFILE_END(Type, position)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::reportSceneGraphFrame<Type, true>()))
+ (QQuickProfiler::reportSceneGraphFrame<Type, true>(position)))
-#define Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(Type, Payload)\
+// report \a Type, using data points 0 to \a position, including \a position, and setting the
+// timestamp at \a position to the current one. Remaining data points up to position 5 are filled
+// with \a Payload.
+#define Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(Type, position, Payload)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::reportSceneGraphFrame<Type, true>(Payload)))
-
+ (QQuickProfiler::reportSceneGraphFrame<Type, true>(position,\
+ Payload)))
#define Q_QUICK_INPUT_PROFILE(Type, DetailType, A, B)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileInputEvents,\
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index 4dfeb7cc4a..fafa2edd0b 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -455,14 +455,14 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions()
QQmlBinding *newBinding = 0;
if (e.id != QQmlBinding::Invalid) {
QV4::Scope scope(QQmlEnginePrivate::getV4Engine(qmlEngine(this)));
- QV4::ScopedValue function(scope, QV4::FunctionObject::createQmlFunction(context, object(), d->compilationUnit->runtimeFunctions.at(e.id)));
+ QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(scope.engine->rootContext(), context, object()));
newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core,
- function, object(), context);
+ d->compilationUnit->runtimeFunctions.at(e.id), object(), context, qmlContext);
}
// QQmlBinding *newBinding = e.id != QQmlBinding::Invalid ? QQmlBinding::createBinding(e.id, object(), qmlContext(this)) : 0;
if (!newBinding)
newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core,
- e.expression, object(), context, e.url.toString(), e.line, e.column);
+ e.expression, object(), context, e.url.toString(), e.line);
if (d->isExplicit) {
// in this case, we don't want to assign a binding, per se,
@@ -629,7 +629,7 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString
auto prop = d->property(name);
QQmlBinding *newBinding = QQmlBinding::create(
&QQmlPropertyPrivate::get(prop)->core, expression, object(),
- qmlContext(this));
+ QQmlContextData::get(qmlContext(this)));
newBinding->setTarget(prop);
QQmlPropertyPrivate::setBinding(newBinding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor);
}
@@ -651,7 +651,7 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString
auto prop = d->property(name);
QQmlBinding *newBinding = QQmlBinding::create(
&QQmlPropertyPrivate::get(prop)->core, expression, object(),
- qmlContext(this));
+ QQmlContextData::get(qmlContext(this)));
newBinding->setTarget(prop);
QQmlPropertyPrivate::setBinding(newBinding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor);
} else {
@@ -664,7 +664,7 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString
QQmlBinding *newBinding = QQmlBinding::create(
&QQmlPropertyPrivate::get(action.property)->core, expression,
- object(), qmlContext(this));
+ object(), QQmlContextData::get(qmlContext(this)));
if (d->isExplicit) {
// don't assign the binding, merely evaluate the expression.
// XXX TODO: add a static QQmlJavaScriptExpression::evaluate(QString)
diff --git a/src/quick/util/qquickstate_p_p.h b/src/quick/util/qquickstate_p_p.h
index af97390efb..eba1dabecf 100644
--- a/src/quick/util/qquickstate_p_p.h
+++ b/src/quick/util/qquickstate_p_p.h
@@ -217,7 +217,7 @@ public:
setObject(static_cast<QQuickStateOperation *>(obj));
}
QList<OperationGuard> *list;
- void objectDestroyed(QQuickStateOperation *) {
+ void objectDestroyed(QQuickStateOperation *) override {
// we assume priv will always be destroyed after objectDestroyed calls
list->removeOne(*this);
}
diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp
index cb586d1565..77dae0d001 100644
--- a/src/quick/util/qquickutilmodule.cpp
+++ b/src/quick/util/qquickutilmodule.cpp
@@ -67,7 +67,7 @@ Q_DECLARE_METATYPE(QKeySequence::StandardKey)
void QQuickUtilModule::defineModule()
{
-#ifndef QT_NO_IM
+#if QT_CONFIG(im)
qmlRegisterUncreatableType<QInputMethod>("QtQuick",2,0,"InputMethod",
QInputMethod::tr("InputMethod is an abstract class"));
#endif
@@ -94,7 +94,7 @@ void QQuickUtilModule::defineModule()
qmlRegisterType<QQuickTransition>("QtQuick",2,0,"Transition");
qmlRegisterType<QQuickVector3dAnimation>("QtQuick",2,0,"Vector3dAnimation");
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
qmlRegisterType<QValidator>();
qmlRegisterType<QQuickIntValidator>("QtQuick",2,0,"IntValidator");
qmlRegisterType<QQuickDoubleValidator>("QtQuick",2,0,"DoubleValidator");
diff --git a/src/quick/util/qquickvalidator.cpp b/src/quick/util/qquickvalidator.cpp
index 67cb6a6c05..015a376603 100644
--- a/src/quick/util/qquickvalidator.cpp
+++ b/src/quick/util/qquickvalidator.cpp
@@ -41,7 +41,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
/*!
\qmltype IntValidator
@@ -221,7 +221,7 @@ void QQuickDoubleValidator::resetLocaleName()
By default, this property contains a regular expression with the pattern .* that matches any string.
*/
-#endif // QT_NO_VALIDATOR
+#endif // validator
QT_END_NAMESPACE
diff --git a/src/quick/util/qquickvalidator_p.h b/src/quick/util/qquickvalidator_p.h
index 97adfb742a..ba188e947a 100644
--- a/src/quick/util/qquickvalidator_p.h
+++ b/src/quick/util/qquickvalidator_p.h
@@ -56,7 +56,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
class Q_AUTOTEST_EXPORT QQuickIntValidator : public QIntValidator
{
Q_OBJECT
@@ -90,7 +90,7 @@ Q_SIGNALS:
QT_END_NAMESPACE
-#ifndef QT_NO_VALIDATOR
+#if QT_CONFIG(validator)
QML_DECLARE_TYPE(QValidator)
QML_DECLARE_TYPE(QQuickIntValidator)
QML_DECLARE_TYPE(QQuickDoubleValidator)