diff options
102 files changed, 1041 insertions, 570 deletions
diff --git a/.qmake.conf b/.qmake.conf index 28e9cfd9ba..7fcbf65fc2 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) CONFIG += qt_example_installs CONFIG += warning_clean -MODULE_VERSION = 5.4.0 +MODULE_VERSION = 5.5.0 diff --git a/src/qml/debugger/qqmlprofilerdefinitions_p.h b/src/qml/debugger/qqmlprofilerdefinitions_p.h index e8ee98433d..713134f394 100644 --- a/src/qml/debugger/qqmlprofilerdefinitions_p.h +++ b/src/qml/debugger/qqmlprofilerdefinitions_p.h @@ -107,18 +107,20 @@ struct QQmlProfilerDefinitions { }; enum SceneGraphFrameType { - SceneGraphRendererFrame, - SceneGraphAdaptationLayerFrame, - SceneGraphContextFrame, - SceneGraphRenderLoopFrame, - SceneGraphTexturePrepare, - SceneGraphTextureDeletion, - SceneGraphPolishAndSync, - SceneGraphWindowsRenderShow, - SceneGraphWindowsAnimations, - SceneGraphPolishFrame, - - MaximumSceneGraphFrameType + SceneGraphRendererFrame, // Render Thread + SceneGraphAdaptationLayerFrame, // Render Thread + SceneGraphContextFrame, // Render Thread + SceneGraphRenderLoopFrame, // Render Thread + SceneGraphTexturePrepare, // Render Thread + SceneGraphTextureDeletion, // Render Thread + SceneGraphPolishAndSync, // GUI Thread + SceneGraphWindowsRenderShow, // Unused + SceneGraphWindowsAnimations, // GUI Thread + SceneGraphPolishFrame, // GUI Thread + + MaximumSceneGraphFrameType, + NumRenderThreadFrameTypes = SceneGraphPolishAndSync, + NumGUIThreadFrameTypes = MaximumSceneGraphFrameType - NumRenderThreadFrameTypes }; typedef QV4::Profiling::MemoryType MemoryType; diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 26fe659616..cabb76db48 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -76,8 +76,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, const QString &handlerName, const QString ¶meterString) : QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable), - m_target(target), m_index(index), + m_target(target), m_extra(new ExtraData(handlerName, parameterString, expression, fileName, line, column)) { setExpressionFunctionValid(false); @@ -88,9 +88,9 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QV4::ValueRef &function) : QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable), + m_index(index), m_v8function(function), m_target(target), - m_index(index), m_extra(0) { setExpressionFunctionValid(true); @@ -101,8 +101,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, QV4::Function *runtimeFunction) : QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable), - m_target(target), m_index(index), + m_target(target), m_extra(0) { setExpressionFunctionValid(true); diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h index b9f519a920..d2fec2afc8 100644 --- a/src/qml/qml/qqmlboundsignal_p.h +++ b/src/qml/qml/qqmlboundsignal_p.h @@ -98,10 +98,10 @@ private: bool invalidParameterName() const { return m_extra.flag2(); } void setInvalidParameterName(bool v) { m_extra.setFlag2Value(v); } + int m_index; QV4::PersistentValue m_v8function; QObject *m_target; - int m_index; // only needed when !expressionFunctionValid() struct ExtraData { diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index e374e471e3..233dd9c239 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -55,6 +55,7 @@ #include <QtCore/qxmlstream.h> #include <QtCore/qstack.h> #include <QtCore/qdebug.h> +#include <QtCore/qbuffer.h> #include <private/qv4objectproto_p.h> #include <private/qv4scopedvalue_p.h> @@ -1255,16 +1256,23 @@ void QQmlXMLHttpRequest::requestFromUrl(const QUrl &url) } } - if (m_method == QLatin1String("GET")) + if (m_method == QLatin1String("GET")) { m_network = networkAccessManager()->get(request); - else if (m_method == QLatin1String("HEAD")) + } else if (m_method == QLatin1String("HEAD")) { m_network = networkAccessManager()->head(request); - else if (m_method == QLatin1String("POST")) + } else if (m_method == QLatin1String("POST")) { m_network = networkAccessManager()->post(request, m_data); - else if (m_method == QLatin1String("PUT")) + } else if (m_method == QLatin1String("PUT")) { m_network = networkAccessManager()->put(request, m_data); - else if (m_method == QLatin1String("DELETE")) + } else if (m_method == QLatin1String("DELETE")) { m_network = networkAccessManager()->deleteResource(request); + } else if (m_method == QLatin1String("OPTIONS")) { + QBuffer *buffer = new QBuffer; + buffer->setData(m_data); + buffer->open(QIODevice::ReadOnly); + m_network = networkAccessManager()->sendCustomRequest(request, QByteArrayLiteral("OPTIONS"), buffer); + buffer->setParent(m_network); + } QObject::connect(m_network, SIGNAL(readyRead()), this, SLOT(readyRead())); @@ -1730,7 +1738,8 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_open(CallContext *ctx) method != QLatin1String("PUT") && method != QLatin1String("HEAD") && method != QLatin1String("POST") && - method != QLatin1String("DELETE")) + method != QLatin1String("DELETE") && + method != QLatin1String("OPTIONS")) V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Unsupported HTTP method type"); // Argument 1 - URL diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h index b3509a5e58..e490bdf9c3 100644 --- a/src/quick/items/context2d/qquickcanvasitem_p.h +++ b/src/quick/items/context2d/qquickcanvasitem_p.h @@ -162,12 +162,12 @@ private Q_SLOTS: void invalidateSceneGraph(); protected: - void componentComplete(); - void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &); - void updatePolish(); - QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - void releaseResources(); + void componentComplete() Q_DECL_OVERRIDE; + void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &) Q_DECL_OVERRIDE; + void updatePolish() Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void releaseResources() Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(QQuickCanvasItem) Q_INVOKABLE void delayedCreate(); diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp index a52f1c8cd2..eac5e2cef8 100644 --- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp +++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp @@ -93,7 +93,7 @@ namespace { } void paint(QPainter *p) const { p->fillRect(m_rect, m_brush); } - QRectF boundingRect() const { return m_rect; } + QRectF boundingRect() const Q_DECL_OVERRIDE { return m_rect; } private: QRectF m_rect; @@ -110,7 +110,7 @@ namespace { } void paint(QPainter *p) const { p->fillPath(m_path, m_brush); } - QRectF boundingRect() const { return m_path.boundingRect(); } + QRectF boundingRect() const Q_DECL_OVERRIDE { return m_path.boundingRect(); } private: QPainterPath m_path; @@ -128,7 +128,7 @@ namespace { void paint(QPainter *p) const { p->strokePath(m_path, m_pen); } - QRectF boundingRect() const + QRectF boundingRect() const Q_DECL_OVERRIDE { qreal d = qMax(qreal(1), m_pen.widthF()); return m_path.boundingRect().adjusted(-d, -d, d, d); @@ -150,7 +150,7 @@ namespace { void paint(QPainter *p) const { p->drawImage(m_offset, m_image); } - QRectF boundingRect() const { return QRectF(m_image.rect()).translated(m_offset); } + QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(m_image.rect()).translated(m_offset); } private: QImage m_image; diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index 0ec0d5e460..3f0ebab6f3 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -294,7 +294,7 @@ bool QQuickAccessibleAttached::ignored() const void QQuickAccessibleAttached::setIgnored(bool ignored) { - if (m_ignored != ignored) { + if (this->ignored() != ignored) { item()->d_func()->isAccessible = !ignored; emit ignoredChanged(); } diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index 00659dc07a..270360895d 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -213,7 +213,6 @@ private: QAccessible::State m_state; QString m_name; QString m_description; - bool m_ignored; public: using QObject::property; diff --git a/src/quick/items/qquickanchors_p_p.h b/src/quick/items/qquickanchors_p_p.h index d07b4369f5..cd5f32c266 100644 --- a/src/quick/items/qquickanchors_p_p.h +++ b/src/quick/items/qquickanchors_p_p.h @@ -126,8 +126,8 @@ public: void updateMe(); // QQuickItemGeometryListener interface - void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &); - QQuickAnchorsPrivate *anchorPrivate() { return this; } + void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE; + QQuickAnchorsPrivate *anchorPrivate() Q_DECL_OVERRIDE { return this; } bool checkHValid() const; bool checkVValid() const; diff --git a/src/quick/items/qquickanimatedimage_p.h b/src/quick/items/qquickanimatedimage_p.h index 789f56e6f7..d04cbdf851 100644 --- a/src/quick/items/qquickanimatedimage_p.h +++ b/src/quick/items/qquickanimatedimage_p.h @@ -71,7 +71,7 @@ public: int frameCount() const; // Extends QQuickImage's src property - virtual void setSource(const QUrl&); + void setSource(const QUrl&) Q_DECL_OVERRIDE; virtual QSize sourceSize(); Q_SIGNALS: @@ -86,8 +86,8 @@ private Q_SLOTS: void playingStatusChanged(); protected: - virtual void load(); - void componentComplete(); + void load() Q_DECL_OVERRIDE; + void componentComplete() Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QQuickAnimatedImage) diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index f1201cf549..f144345b6c 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -54,9 +54,9 @@ class QQuickAnimatedSpriteMaterial : public QSGMaterial public: QQuickAnimatedSpriteMaterial(); ~QQuickAnimatedSpriteMaterial(); - virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; } - virtual QSGMaterialShader *createShader() const; - virtual int compare(const QSGMaterial *other) const + QSGMaterialType *type() const Q_DECL_OVERRIDE { static QSGMaterialType type; return &type; } + QSGMaterialShader *createShader() const Q_DECL_OVERRIDE; + int compare(const QSGMaterial *other) const Q_DECL_OVERRIDE { return this - static_cast<const QQuickAnimatedSpriteMaterial *>(other); } @@ -100,7 +100,7 @@ public: setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/items/shaders/sprite.frag")); } - virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) + void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) Q_DECL_OVERRIDE { QQuickAnimatedSpriteMaterial *m = static_cast<QQuickAnimatedSpriteMaterial *>(newEffect); m->texture->bind(); @@ -113,14 +113,14 @@ public: program()->setUniformValue(m_matrix_id, state.combinedMatrix()); } - virtual void initialize() { + void initialize() Q_DECL_OVERRIDE { m_matrix_id = program()->uniformLocation("qt_Matrix"); m_opacity_id = program()->uniformLocation("qt_Opacity"); m_animData_id = program()->uniformLocation("animData"); m_animPos_id = program()->uniformLocation("animPos"); } - virtual char const *const *attributeNames() const { + char const *const *attributeNames() const Q_DECL_OVERRIDE { static const char *attr[] = { "vPos", "vTex", @@ -388,8 +388,8 @@ void QQuickAnimatedSprite::advance(int frames) //TODO-C: May not work when running - only when paused m_curFrame += frames; while (m_curFrame < 0) - m_curFrame += m_sprite->frames(); - m_curFrame = m_curFrame % m_sprite->frames(); + m_curFrame += m_spriteEngine->maxFrames(); + m_curFrame = m_curFrame % m_spriteEngine->maxFrames(); emit currentFrameChanged(m_curFrame); } @@ -529,7 +529,6 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode() indices[5] = 2; - m_timestamp.start(); m_node = new QSGGeometryNode(); m_node->setGeometry(g); m_node->setMaterial(m_material); @@ -574,43 +573,47 @@ void QQuickAnimatedSprite::prepareNextFrame() int timeInt = m_timestamp.elapsed() + m_pauseOffset; qreal time = timeInt / 1000.; - double frameAt; //double just for modf + int frameAt; qreal progress = 0.0; int lastFrame = m_curFrame; - if (!m_paused) { + if (m_running && !m_paused) { + const int nColumns = int(m_sheetSize.width()) / m_spriteEngine->spriteWidth(); //Advance State (keeps time for psuedostates) m_spriteEngine->updateSprites(timeInt); //Advance AnimatedSprite qreal animT = m_spriteEngine->spriteStart()/1000.0; - qreal frameCount = m_spriteEngine->spriteFrames(); - qreal frameDuration = m_spriteEngine->spriteDuration()/frameCount; + const int frameCountInRow = m_spriteEngine->spriteFrames(); + const qreal frameDuration = m_spriteEngine->spriteDuration()/frameCountInRow; if (frameDuration > 0) { qreal frame = (time - animT)/(frameDuration / 1000.0); bool lastLoop = m_loops > 0 && m_curLoop == m_loops-1; //don't visually interpolate for the last frame of the last loop - qreal max = lastLoop ? frameCount - qreal(1.0) : frameCount; - frame = qBound(qreal(0.0), frame, max); - progress = modf(frame,&frameAt); - if (m_curFrame > frameAt) //went around + const int max = lastLoop ? frameCountInRow - 1 : frameCountInRow; + frame = qBound(qreal(0.0), frame, qreal(max)); + double intpart; + progress = modf(frame,&intpart); + frameAt = (int)intpart; + const int rowIndex = m_spriteEngine->spriteY()/frameHeight(); + const int newFrame = rowIndex * nColumns + frameAt; + if (m_curFrame > newFrame) //went around m_curLoop++; - m_curFrame = frameAt; + m_curFrame = newFrame; } else { m_curFrame++; - if (m_curFrame >= frameCount){ + if (m_curFrame >= m_spriteEngine->maxFrames()) { // maxFrames: total number of frames including all rows m_curFrame = 0; m_curLoop++; - m_spriteEngine->advance(); } - frameAt = m_curFrame; + frameAt = m_curFrame % nColumns; + if (frameAt == 0) + m_spriteEngine->advance(); progress = 0; } if (m_loops > 0 && m_curLoop >= m_loops) { frameAt = 0; - if (m_running) { - m_running = false; - emit runningChanged(false); - } + m_running = false; + emit runningChanged(false); } } else { frameAt = m_curFrame; diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index 0bc2c65b7c..546d239034 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -343,8 +343,8 @@ private Q_SLOTS: protected: void reset(); - void componentComplete(); - QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + void componentComplete() Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; private: bool isCurrentFrameChangedConnected(); void prepareNextFrame(); diff --git a/src/quick/items/qquickborderimage_p.h b/src/quick/items/qquickborderimage_p.h index 1d0898115d..a33098d3b1 100644 --- a/src/quick/items/qquickborderimage_p.h +++ b/src/quick/items/qquickborderimage_p.h @@ -66,7 +66,7 @@ public: TileMode verticalTileMode() const; void setVerticalTileMode(TileMode); - void setSource(const QUrl &url); + void setSource(const QUrl &url) Q_DECL_OVERRIDE; Q_SIGNALS: void horizontalTileModeChanged(); @@ -74,16 +74,16 @@ Q_SIGNALS: void sourceSizeChanged(); protected: - virtual void load(); - virtual void pixmapChange(); - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + void load() Q_DECL_OVERRIDE; + void pixmapChange() Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; private: void setGridScaledImage(const QQuickGridScaledImage& sci); private Q_SLOTS: void doUpdate(); - void requestFinished(); + void requestFinished() Q_DECL_OVERRIDE; void sciRequestFinished(); private: diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 5641c323ab..e49347351c 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -71,7 +71,7 @@ public: { } - void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &); + void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE; void itemParentChanged(QQuickItem *, QQuickItem *parent); void updatePosition(); void restartDrag(); diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h index a0c985ddf7..35a5f3c880 100644 --- a/src/quick/items/qquickdroparea_p.h +++ b/src/quick/items/qquickdroparea_p.h @@ -160,10 +160,10 @@ Q_SIGNALS: void dropped(QQuickDropEvent *drop); protected: - void dragMoveEvent(QDragMoveEvent *event); - void dragEnterEvent(QDragEnterEvent *event); - void dragLeaveEvent(QDragLeaveEvent *event); - void dropEvent(QDropEvent *event); + void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE; + void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE; + void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE; + void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QQuickDropArea) diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index c6b7e5a35a..c3a56ba8d8 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -180,7 +180,7 @@ public: } protected: - virtual void finished() { + void finished() Q_DECL_OVERRIDE { if (!flickable) return; axisData->move.setValue(axisData->transitionTo); diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h index c8a1ba6984..c996d18b01 100644 --- a/src/quick/items/qquickflickable_p.h +++ b/src/quick/items/qquickflickable_p.h @@ -220,14 +220,14 @@ Q_SIGNALS: void pixelAlignedChanged(); protected: - virtual bool childMouseEventFilter(QQuickItem *, QEvent *); - virtual void mousePressEvent(QMouseEvent *event); - virtual void mouseMoveEvent(QMouseEvent *event); - virtual void mouseReleaseEvent(QMouseEvent *event); + bool childMouseEventFilter(QQuickItem *, QEvent *) Q_DECL_OVERRIDE; + 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 - virtual void wheelEvent(QWheelEvent *event); + void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif - virtual void timerEvent(QTimerEvent *event); + void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; QQuickFlickableVisibleArea *visibleArea(); @@ -244,11 +244,11 @@ protected: virtual qreal maxYExtent() const; qreal vWidth() const; qreal vHeight() const; - virtual void componentComplete(); + void componentComplete() Q_DECL_OVERRIDE; virtual void viewportMoved(Qt::Orientations orient); - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - void mouseUngrabEvent(); + void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void mouseUngrabEvent() Q_DECL_OVERRIDE; bool sendMouseEvent(QQuickItem *item, QMouseEvent *event); bool xflick() const; diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h index bd8c8de168..af4a4bccbf 100644 --- a/src/quick/items/qquickflickable_p_p.h +++ b/src/quick/items/qquickflickable_p_p.h @@ -80,7 +80,7 @@ public: { Velocity(QQuickFlickablePrivate *p) : parent(p) {} - virtual void setValue(qreal v) { + void setValue(qreal v) Q_DECL_OVERRIDE { if (v != value()) { QQuickTimeLineValue::setValue(v); parent->updateVelocity(); @@ -185,7 +185,7 @@ public: qreal overShootDistance(qreal size); - void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &); + void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE; void draggingStarting(); void draggingEnding(); diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp index 1d439eef05..a68457319b 100644 --- a/src/quick/items/qquickflipable.cpp +++ b/src/quick/items/qquickflipable.cpp @@ -51,7 +51,7 @@ public: transform = t; update(); } - virtual void applyTo(QMatrix4x4 *matrix) const { + void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE { *matrix *= transform; } private: @@ -64,7 +64,7 @@ class QQuickFlipablePrivate : public QQuickItemPrivate public: QQuickFlipablePrivate() : current(QQuickFlipable::Front), front(0), back(0), sideDirty(false) {} - virtual void transformChanged(); + void transformChanged() Q_DECL_OVERRIDE; void updateSide(); void setBackTransform(); diff --git a/src/quick/items/qquickflipable_p.h b/src/quick/items/qquickflipable_p.h index 0196e35315..9648b22ef6 100644 --- a/src/quick/items/qquickflipable_p.h +++ b/src/quick/items/qquickflipable_p.h @@ -72,7 +72,7 @@ Q_SIGNALS: void sideChanged(); protected: - virtual void updatePolish(); + void updatePolish() Q_DECL_OVERRIDE; private Q_SLOTS: void retransformBack(); diff --git a/src/quick/items/qquickframebufferobject.h b/src/quick/items/qquickframebufferobject.h index f6431dc38e..3c3ae77436 100644 --- a/src/quick/items/qquickframebufferobject.h +++ b/src/quick/items/qquickframebufferobject.h @@ -80,7 +80,7 @@ public: void releaseResources() Q_DECL_OVERRIDE; protected: - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; protected: QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 72edce4339..e3af926e22 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -115,7 +115,7 @@ public: void setPosition(qreal col, qreal row, bool immediate = false) { moveTo(pointForPosition(col, row), immediate); } - bool contains(qreal x, qreal y) const { + bool contains(qreal x, qreal y) const Q_DECL_OVERRIDE { return (x >= itemX() && x < itemX() + view->cellWidth() && y >= itemY() && y < itemY() + view->cellHeight()); } @@ -152,13 +152,13 @@ class QQuickGridViewPrivate : public QQuickItemViewPrivate Q_DECLARE_PUBLIC(QQuickGridView) public: - virtual Qt::Orientation layoutOrientation() const; - virtual bool isContentFlowReversed() const; + Qt::Orientation layoutOrientation() const Q_DECL_OVERRIDE; + bool isContentFlowReversed() const Q_DECL_OVERRIDE; - virtual qreal positionAt(int index) const; - virtual qreal endPositionAt(int index) const; - virtual qreal originPosition() const; - virtual qreal lastPosition() const; + qreal positionAt(int index) const Q_DECL_OVERRIDE; + qreal endPositionAt(int index) const Q_DECL_OVERRIDE; + qreal originPosition() const Q_DECL_OVERRIDE; + qreal lastPosition() const Q_DECL_OVERRIDE; qreal rowSize() const; qreal colSize() const; @@ -172,41 +172,41 @@ public: void resetColumns(); - virtual bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer); - virtual bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo); - - virtual FxViewItem *newViewItem(int index, QQuickItem *item); - virtual void initializeViewItem(FxViewItem *item); - virtual void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer); - virtual void repositionPackageItemAt(QQuickItem *item, int index); - virtual void resetFirstItemPosition(qreal pos = 0.0); - virtual void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible); - - virtual void createHighlight(); - virtual void updateHighlight(); - virtual void resetHighlightPosition(); - - virtual void setPosition(qreal pos); - virtual void layoutVisibleItems(int fromModelIndex = 0); - virtual bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView); - virtual void translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult); - virtual bool needsRefillForAddedOrRemovedIndex(int index) const; - - virtual qreal headerSize() const; - virtual qreal footerSize() const; - virtual bool showHeaderForIndex(int index) const; - virtual bool showFooterForIndex(int index) const; - virtual void updateHeader(); - virtual void updateFooter(); - - virtual void changedVisibleIndex(int newIndex); - virtual void initializeCurrentItem(); - - virtual void updateViewport(); - virtual void fixupPosition(); - virtual void fixup(AxisData &data, qreal minExtent, qreal maxExtent); - virtual bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, - QQuickTimeLineCallback::Callback fixupCallback, qreal velocity); + bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) Q_DECL_OVERRIDE; + bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) Q_DECL_OVERRIDE; + + FxViewItem *newViewItem(int index, QQuickItem *item) Q_DECL_OVERRIDE; + void initializeViewItem(FxViewItem *item) Q_DECL_OVERRIDE; + void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) Q_DECL_OVERRIDE; + void repositionPackageItemAt(QQuickItem *item, int index) Q_DECL_OVERRIDE; + void resetFirstItemPosition(qreal pos = 0.0) Q_DECL_OVERRIDE; + void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) Q_DECL_OVERRIDE; + + void createHighlight() Q_DECL_OVERRIDE; + void updateHighlight() Q_DECL_OVERRIDE; + void resetHighlightPosition() Q_DECL_OVERRIDE; + + void setPosition(qreal pos) Q_DECL_OVERRIDE; + void layoutVisibleItems(int fromModelIndex = 0) Q_DECL_OVERRIDE; + bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) Q_DECL_OVERRIDE; + void translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) Q_DECL_OVERRIDE; + bool needsRefillForAddedOrRemovedIndex(int index) const Q_DECL_OVERRIDE; + + qreal headerSize() const Q_DECL_OVERRIDE; + qreal footerSize() const Q_DECL_OVERRIDE; + bool showHeaderForIndex(int index) const Q_DECL_OVERRIDE; + bool showFooterForIndex(int index) const Q_DECL_OVERRIDE; + void updateHeader() Q_DECL_OVERRIDE; + void updateFooter() Q_DECL_OVERRIDE; + + void changedVisibleIndex(int newIndex) Q_DECL_OVERRIDE; + void initializeCurrentItem() Q_DECL_OVERRIDE; + + void updateViewport() Q_DECL_OVERRIDE; + void fixupPosition() Q_DECL_OVERRIDE; + void fixup(AxisData &data, qreal minExtent, qreal maxExtent) Q_DECL_OVERRIDE; + bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, + QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) Q_DECL_OVERRIDE; QQuickGridView::Flow flow; qreal cellWidth; diff --git a/src/quick/items/qquickgridview_p.h b/src/quick/items/qquickgridview_p.h index 7468a49ac1..b835b0a070 100644 --- a/src/quick/items/qquickgridview_p.h +++ b/src/quick/items/qquickgridview_p.h @@ -65,8 +65,8 @@ public: QQuickGridView(QQuickItem *parent=0); ~QQuickGridView(); - virtual void setHighlightFollowsCurrentItem(bool); - virtual void setHighlightMoveDuration(int); + void setHighlightFollowsCurrentItem(bool) Q_DECL_OVERRIDE; + void setHighlightMoveDuration(int) Q_DECL_OVERRIDE; Flow flow() const; void setFlow(Flow); @@ -97,10 +97,10 @@ Q_SIGNALS: void snapModeChanged(); protected: - virtual void viewportMoved(Qt::Orientations); - virtual void keyPressEvent(QKeyEvent *); - virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - virtual void initItem(int index, QObject *item); + void viewportMoved(Qt::Orientations) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void initItem(int index, QObject *item) Q_DECL_OVERRIDE; }; class QQuickGridViewAttached : public QQuickItemViewAttached diff --git a/src/quick/items/qquickimage_p.h b/src/quick/items/qquickimage_p.h index b359ff779d..eef5c3901d 100644 --- a/src/quick/items/qquickimage_p.h +++ b/src/quick/items/qquickimage_p.h @@ -73,7 +73,7 @@ public: qreal paintedWidth() const; qreal paintedHeight() const; - QRectF boundingRect() const; + QRectF boundingRect() const Q_DECL_OVERRIDE; HAlignment horizontalAlignment() const; void setHorizontalAlignment(HAlignment align); @@ -81,8 +81,8 @@ public: VAlignment verticalAlignment() const; void setVerticalAlignment(VAlignment align); - bool isTextureProvider() const { return true; } - QSGTextureProvider *textureProvider() const; + bool isTextureProvider() const Q_DECL_OVERRIDE { return true; } + QSGTextureProvider *textureProvider() const Q_DECL_OVERRIDE; bool mipmap() const; void setMipmap(bool use); @@ -99,12 +99,12 @@ private Q_SLOTS: protected: QQuickImage(QQuickImagePrivate &dd, QQuickItem *parent); - void pixmapChange(); + void pixmapChange() Q_DECL_OVERRIDE; void updatePaintedGeometry(); void releaseResources() Q_DECL_OVERRIDE; - virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QQuickImage) diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h index 4446268a2b..860cb2e670 100644 --- a/src/quick/items/qquickimagebase_p.h +++ b/src/quick/items/qquickimagebase_p.h @@ -91,7 +91,7 @@ Q_SIGNALS: protected: virtual void load(); - virtual void componentComplete(); + void componentComplete() Q_DECL_OVERRIDE; virtual void pixmapChange(); QQuickImageBase(QQuickImageBasePrivate &dd, QQuickItem *parent); diff --git a/src/quick/items/qquickimplicitsizeitem_p_p.h b/src/quick/items/qquickimplicitsizeitem_p_p.h index cdf768cbd9..c34e3424b0 100644 --- a/src/quick/items/qquickimplicitsizeitem_p_p.h +++ b/src/quick/items/qquickimplicitsizeitem_p_p.h @@ -60,8 +60,8 @@ public: { } - virtual void implicitWidthChanged(); - virtual void implicitHeightChanged(); + void implicitWidthChanged() Q_DECL_OVERRIDE; + void implicitHeightChanged() Q_DECL_OVERRIDE; }; QT_END_NAMESPACE diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index c17f6a6a7d..e93e8c1439 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -376,7 +376,7 @@ Q_SIGNALS: void implicitHeightChanged(); protected: - virtual bool event(QEvent *); + bool event(QEvent *) Q_DECL_OVERRIDE; bool isComponentComplete() const; virtual void itemChange(ItemChange, const ItemChangeData &); diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 3e1c880db1..a88a23820f 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -92,10 +92,10 @@ public: void complete(); protected: - void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); - void itemDestroyed(QQuickItem *item); - void itemChildAdded(QQuickItem *, QQuickItem *); - void itemChildRemoved(QQuickItem *, QQuickItem *); + void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE; + void itemChildAdded(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE; + void itemChildRemoved(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE; //void itemVisibilityChanged(QQuickItem *item) private: @@ -178,11 +178,11 @@ public: QQuickShaderEffectSource *effectSource() const { return m_effectSource; } - void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &); - void itemOpacityChanged(QQuickItem *); - void itemParentChanged(QQuickItem *, QQuickItem *); - void itemSiblingOrderChanged(QQuickItem *); - void itemVisibilityChanged(QQuickItem *); + void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE; + void itemOpacityChanged(QQuickItem *) Q_DECL_OVERRIDE; + void itemParentChanged(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE; + void itemSiblingOrderChanged(QQuickItem *) Q_DECL_OVERRIDE; + void itemVisibilityChanged(QQuickItem *) Q_DECL_OVERRIDE; void updateMatrix(); void updateGeometry(); @@ -681,8 +681,8 @@ Q_SIGNALS: void priorityChanged(); private: - virtual void keyPressed(QKeyEvent *event, bool post); - virtual void keyReleased(QKeyEvent *event, bool post); + void keyPressed(QKeyEvent *event, bool post) Q_DECL_OVERRIDE; + void keyReleased(QKeyEvent *event, bool post) Q_DECL_OVERRIDE; void setFocusNavigation(QQuickItem *currentItem, const char *dir, Qt::FocusReason reason = Qt::OtherFocusReason); }; @@ -765,7 +765,7 @@ public: return QQmlListProperty<QQuickItem>(this, d->targets); } - virtual void componentComplete(); + void componentComplete() Q_DECL_OVERRIDE; static QQuickKeysAttached *qmlAttachedProperties(QObject *); @@ -816,11 +816,11 @@ Q_SIGNALS: void volumeDownPressed(QQuickKeyEvent *event); private: - virtual void keyPressed(QKeyEvent *event, bool post); - virtual void keyReleased(QKeyEvent *event, bool post); + void keyPressed(QKeyEvent *event, bool post) Q_DECL_OVERRIDE; + void keyReleased(QKeyEvent *event, bool post) Q_DECL_OVERRIDE; #ifndef QT_NO_IM - virtual void inputMethodEvent(QInputMethodEvent *, bool post); - virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + void inputMethodEvent(QInputMethodEvent *, bool post) Q_DECL_OVERRIDE; + QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE; #endif const QByteArray keyToSignal(int key); diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index c7c40980dc..810b487e3a 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -210,7 +210,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act //### reverse should probably apply on a per-action basis bool reverse; QList<QQuickParentChange *> pc; - virtual void doAction() + void doAction() Q_DECL_OVERRIDE { for (int ii = 0; ii < actions.count(); ++ii) { const QQuickStateAction &action = actions.at(ii); diff --git a/src/quick/items/qquickitemanimation_p.h b/src/quick/items/qquickitemanimation_p.h index d16c9f8107..a1bc4b6bdf 100644 --- a/src/quick/items/qquickitemanimation_p.h +++ b/src/quick/items/qquickitemanimation_p.h @@ -69,10 +69,10 @@ Q_SIGNALS: void viaChanged(); protected: - virtual QAbstractAnimationJob* transition(QQuickStateActions &actions, + QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0); + QObject *defaultTarget = 0) Q_DECL_OVERRIDE; }; class QQuickAnchorAnimationPrivate; @@ -101,10 +101,10 @@ Q_SIGNALS: void easingChanged(const QEasingCurve&); protected: - virtual QAbstractAnimationJob* transition(QQuickStateActions &actions, + QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0); + QObject *defaultTarget = 0) Q_DECL_OVERRIDE; }; class QQuickItem; @@ -166,10 +166,10 @@ public: void setEndRotation(qreal); protected: - virtual QAbstractAnimationJob* transition(QQuickStateActions &actions, + QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0); + QObject *defaultTarget = 0) Q_DECL_OVERRIDE; Q_SIGNALS: void durationChanged(int); void easingChanged(const QEasingCurve &); diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h index 89c3bec465..3e7acdd26c 100644 --- a/src/quick/items/qquickitemview_p.h +++ b/src/quick/items/qquickitemview_p.h @@ -208,10 +208,10 @@ public: Q_INVOKABLE void positionViewAtEnd(); Q_REVISION(1) Q_INVOKABLE void forceLayout(); - virtual void setContentX(qreal pos); - virtual void setContentY(qreal pos); - virtual qreal originX() const; - virtual qreal originY() const; + void setContentX(qreal pos) Q_DECL_OVERRIDE; + void setContentY(qreal pos) Q_DECL_OVERRIDE; + qreal originX() const Q_DECL_OVERRIDE; + qreal originY() const Q_DECL_OVERRIDE; Q_SIGNALS: void modelChanged(); @@ -252,13 +252,13 @@ Q_SIGNALS: void highlightMoveDurationChanged(); protected: - virtual void updatePolish(); - virtual void componentComplete(); - virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - virtual qreal minYExtent() const; - virtual qreal maxYExtent() const; - virtual qreal minXExtent() const; - virtual qreal maxXExtent() const; + void updatePolish() Q_DECL_OVERRIDE; + void componentComplete() Q_DECL_OVERRIDE; + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + qreal minYExtent() const Q_DECL_OVERRIDE; + qreal maxYExtent() const Q_DECL_OVERRIDE; + qreal minXExtent() const Q_DECL_OVERRIDE; + qreal maxXExtent() const Q_DECL_OVERRIDE; protected Q_SLOTS: void destroyRemoved(); diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h index 76fc326367..b053b1ea6e 100644 --- a/src/quick/items/qquickitemview_p_p.h +++ b/src/quick/items/qquickitemview_p_p.h @@ -181,7 +181,7 @@ public: virtual void animationFinished(QAbstractAnimationJob *); void refill(); void refill(qreal from, qreal to); - void mirrorChange(); + void mirrorChange() Q_DECL_OVERRIDE; FxViewItem *createItem(int modelIndex, bool asynchronous = false); virtual bool releaseItem(FxViewItem *item); @@ -211,7 +211,7 @@ public: void prepareVisibleItemTransitions(); void prepareRemoveTransitions(QHash<QQmlChangeSet::MoveKey, FxViewItem *> *removedItems); bool prepareNonVisibleItemTransition(FxViewItem *item, const QRectF &viewBounds); - virtual void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item); + void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) Q_DECL_OVERRIDE; int findMoveKeyIndex(QQmlChangeSet::MoveKey key, const QVector<QQmlChangeSet::Change> &changes) const; @@ -353,7 +353,7 @@ protected: virtual void updateSectionCriteria() {} virtual void updateSections() {} - virtual void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); + void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; }; diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index 41ee9bb1f2..9c14133cbd 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -57,7 +57,7 @@ public: bool *m_wasDeleted; protected: - virtual void finished(); + void finished() Q_DECL_OVERRIDE; }; diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index d381fe2030..851204ccde 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -59,49 +59,49 @@ class QQuickListViewPrivate : public QQuickItemViewPrivate public: static QQuickListViewPrivate* get(QQuickListView *item) { return item->d_func(); } - virtual Qt::Orientation layoutOrientation() const; - virtual bool isContentFlowReversed() const; + Qt::Orientation layoutOrientation() const Q_DECL_OVERRIDE; + bool isContentFlowReversed() const Q_DECL_OVERRIDE; bool isRightToLeft() const; bool isBottomToTop() const; - virtual qreal positionAt(int index) const; - virtual qreal endPositionAt(int index) const; - virtual qreal originPosition() const; - virtual qreal lastPosition() const; + qreal positionAt(int index) const Q_DECL_OVERRIDE; + qreal endPositionAt(int index) const Q_DECL_OVERRIDE; + qreal originPosition() const Q_DECL_OVERRIDE; + qreal lastPosition() const Q_DECL_OVERRIDE; FxViewItem *itemBefore(int modelIndex) const; QString sectionAt(int modelIndex); qreal snapPosAt(qreal pos); FxViewItem *snapItemAt(qreal pos); - virtual void init(); - virtual void clear(); + void init() Q_DECL_OVERRIDE; + void clear() Q_DECL_OVERRIDE; - virtual bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer); - virtual bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo); - virtual void visibleItemsChanged(); + bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) Q_DECL_OVERRIDE; + bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) Q_DECL_OVERRIDE; + void visibleItemsChanged() Q_DECL_OVERRIDE; - virtual FxViewItem *newViewItem(int index, QQuickItem *item); - virtual void initializeViewItem(FxViewItem *item); - virtual bool releaseItem(FxViewItem *item); - virtual void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer); - virtual void repositionPackageItemAt(QQuickItem *item, int index); - virtual void resetFirstItemPosition(qreal pos = 0.0); - virtual void adjustFirstItem(qreal forwards, qreal backwards, int); - virtual void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult); + FxViewItem *newViewItem(int index, QQuickItem *item) Q_DECL_OVERRIDE; + void initializeViewItem(FxViewItem *item) Q_DECL_OVERRIDE; + bool releaseItem(FxViewItem *item) Q_DECL_OVERRIDE; + void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) Q_DECL_OVERRIDE; + void repositionPackageItemAt(QQuickItem *item, int index) Q_DECL_OVERRIDE; + void resetFirstItemPosition(qreal pos = 0.0) Q_DECL_OVERRIDE; + void adjustFirstItem(qreal forwards, qreal backwards, int) Q_DECL_OVERRIDE; + void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult) Q_DECL_OVERRIDE; - virtual void createHighlight(); - virtual void updateHighlight(); - virtual void resetHighlightPosition(); + void createHighlight() Q_DECL_OVERRIDE; + void updateHighlight() Q_DECL_OVERRIDE; + void resetHighlightPosition() Q_DECL_OVERRIDE; - virtual void setPosition(qreal pos); - virtual void layoutVisibleItems(int fromModelIndex = 0); + void setPosition(qreal pos) Q_DECL_OVERRIDE; + void layoutVisibleItems(int fromModelIndex = 0) Q_DECL_OVERRIDE; - virtual bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView); - virtual void translateAndTransitionItemsAfter(int afterIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult); + bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) Q_DECL_OVERRIDE; + void translateAndTransitionItemsAfter(int afterIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) Q_DECL_OVERRIDE; - virtual void updateSectionCriteria(); - virtual void updateSections(); + void updateSectionCriteria() Q_DECL_OVERRIDE; + void updateSections() Q_DECL_OVERRIDE; QQuickItem *getSectionItem(const QString §ion); void releaseSectionItem(QQuickItem *item); void releaseSectionItems(); @@ -109,25 +109,25 @@ public: void updateCurrentSection(); void updateStickySections(); - virtual qreal headerSize() const; - virtual qreal footerSize() const; - virtual bool showHeaderForIndex(int index) const; - virtual bool showFooterForIndex(int index) const; - virtual void updateHeader(); - virtual void updateFooter(); + qreal headerSize() const Q_DECL_OVERRIDE; + qreal footerSize() const Q_DECL_OVERRIDE; + bool showHeaderForIndex(int index) const Q_DECL_OVERRIDE; + bool showFooterForIndex(int index) const Q_DECL_OVERRIDE; + void updateHeader() Q_DECL_OVERRIDE; + void updateFooter() Q_DECL_OVERRIDE; bool hasStickyHeader() const; bool hasStickyFooter() const; - virtual void changedVisibleIndex(int newIndex); - virtual void initializeCurrentItem(); + void changedVisibleIndex(int newIndex) Q_DECL_OVERRIDE; + void initializeCurrentItem() Q_DECL_OVERRIDE; void updateAverage(); - void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); - virtual void fixupPosition(); - virtual void fixup(AxisData &data, qreal minExtent, qreal maxExtent); - virtual bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, - QQuickTimeLineCallback::Callback fixupCallback, qreal velocity); + void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void fixupPosition() Q_DECL_OVERRIDE; + void fixup(AxisData &data, qreal minExtent, qreal maxExtent) Q_DECL_OVERRIDE; + bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, + QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) Q_DECL_OVERRIDE; QQuickListView::Orientation orient; qreal visiblePos; @@ -319,7 +319,7 @@ public: else item->setWidth(size); } - bool contains(qreal x, qreal y) const { + bool contains(qreal x, qreal y) const Q_DECL_OVERRIDE { return (x >= itemX() && x < itemX() + item->width() && y >= itemY() && y < itemY() + item->height()); } diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h index a02fba258e..2801879b0f 100644 --- a/src/quick/items/qquicklistview_p.h +++ b/src/quick/items/qquicklistview_p.h @@ -126,7 +126,7 @@ public: QQuickViewSection *sectionCriteria(); QString currentSection() const; - virtual void setHighlightFollowsCurrentItem(bool); + void setHighlightFollowsCurrentItem(bool) Q_DECL_OVERRIDE; qreal highlightMoveVelocity() const; void setHighlightMoveVelocity(qreal); @@ -137,7 +137,7 @@ public: int highlightResizeDuration() const; void setHighlightResizeDuration(int); - virtual void setHighlightMoveDuration(int); + void setHighlightMoveDuration(int) Q_DECL_OVERRIDE; enum SnapMode { NoSnap, SnapToItem, SnapOneItem }; SnapMode snapMode() const; @@ -169,10 +169,10 @@ Q_SIGNALS: Q_REVISION(2) void footerPositioningChanged(); protected: - virtual void viewportMoved(Qt::Orientations orient); - virtual void keyPressEvent(QKeyEvent *); - virtual void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry); - virtual void initItem(int index, QObject *item); + void viewportMoved(Qt::Orientations orient) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void initItem(int index, QObject *item) Q_DECL_OVERRIDE; }; class QQuickListViewAttached : public QQuickItemViewAttached diff --git a/src/quick/items/qquickloader_p.h b/src/quick/items/qquickloader_p.h index 3e0cba5865..640897d507 100644 --- a/src/quick/items/qquickloader_p.h +++ b/src/quick/items/qquickloader_p.h @@ -88,8 +88,8 @@ Q_SIGNALS: void asynchronousChanged(); protected: - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - void componentComplete(); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void componentComplete() Q_DECL_OVERRIDE; private: void setSource(const QUrl &sourceUrl, bool needsClear); diff --git a/src/quick/items/qquickloader_p_p.h b/src/quick/items/qquickloader_p_p.h index cae42a79ad..15e144855c 100644 --- a/src/quick/items/qquickloader_p_p.h +++ b/src/quick/items/qquickloader_p_p.h @@ -62,8 +62,8 @@ public: QQuickLoaderIncubator(QQuickLoaderPrivate *l, IncubationMode mode) : QQmlIncubator(mode), loader(l) {} protected: - virtual void statusChanged(Status); - virtual void setInitialState(QObject *); + void statusChanged(Status) Q_DECL_OVERRIDE; + void setInitialState(QObject *) Q_DECL_OVERRIDE; private: QQuickLoaderPrivate *loader; @@ -78,9 +78,9 @@ public: QQuickLoaderPrivate(); ~QQuickLoaderPrivate(); - void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); - void itemImplicitWidthChanged(QQuickItem *); - void itemImplicitHeightChanged(QQuickItem *); + void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void itemImplicitWidthChanged(QQuickItem *) Q_DECL_OVERRIDE; + void itemImplicitHeightChanged(QQuickItem *) Q_DECL_OVERRIDE; void clear(); void initResize(); void load(); @@ -91,8 +91,8 @@ public: QUrl resolveSourceUrl(QQmlV4Function *args); QV4::ReturnedValue extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error); - virtual qreal getImplicitWidth() const; - virtual qreal getImplicitHeight() const; + qreal getImplicitWidth() const Q_DECL_OVERRIDE; + qreal getImplicitHeight() const Q_DECL_OVERRIDE; QUrl source; QQuickItem *item; diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index 6d3e607d08..a1569548c9 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -228,13 +228,13 @@ Q_SIGNALS: void mouseEnabledChanged(); protected: - void touchEvent(QTouchEvent *); - bool childMouseEventFilter(QQuickItem *i, QEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseUngrabEvent(); - void touchUngrabEvent(); + void touchEvent(QTouchEvent *) Q_DECL_OVERRIDE; + bool childMouseEventFilter(QQuickItem *i, QEvent *event) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseUngrabEvent() Q_DECL_OVERRIDE; + void touchUngrabEvent() Q_DECL_OVERRIDE; void addTouchPrototype(QQuickTouchPoint* prototype); void addTouchPoint(const QTouchEvent::TouchPoint *p); @@ -248,10 +248,10 @@ protected: bool sendMouseEvent(QMouseEvent *event); bool shouldFilter(QEvent *event); void grabGesture(); - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; #ifdef Q_OS_OSX - void hoverEnterEvent(QHoverEvent *event); - void hoverLeaveEvent(QHoverEvent *event); + void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE; + void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; void setTouchEventsEnabled(bool enable); #endif diff --git a/src/quick/items/qquickpainteditem.h b/src/quick/items/qquickpainteditem.h index b5e04694bf..fc14574a8d 100644 --- a/src/quick/items/qquickpainteditem.h +++ b/src/quick/items/qquickpainteditem.h @@ -107,7 +107,7 @@ Q_SIGNALS: protected: QQuickPaintedItem(QQuickPaintedItemPrivate &dd, QQuickItem *parent = 0); - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; void releaseResources() Q_DECL_OVERRIDE; private Q_SLOTS: diff --git a/src/quick/items/qquickpathview_p.h b/src/quick/items/qquickpathview_p.h index 74ee4908b2..e57557204e 100644 --- a/src/quick/items/qquickpathview_p.h +++ b/src/quick/items/qquickpathview_p.h @@ -193,14 +193,14 @@ Q_SIGNALS: void cacheItemCountChanged(); protected: - virtual void updatePolish(); - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *); + void updatePolish() Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; bool sendMouseEvent(QMouseEvent *event); - bool childMouseEventFilter(QQuickItem *, QEvent *); - void mouseUngrabEvent(); - void componentComplete(); + bool childMouseEventFilter(QQuickItem *, QEvent *) Q_DECL_OVERRIDE; + void mouseUngrabEvent() Q_DECL_OVERRIDE; + void componentComplete() Q_DECL_OVERRIDE; private Q_SLOTS: void refill(); diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h index cd52dd10bb..7c0e651b69 100644 --- a/src/quick/items/qquickpathview_p_p.h +++ b/src/quick/items/qquickpathview_p_p.h @@ -69,7 +69,7 @@ public: void init(); - void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) { + void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE { if ((newGeometry.size() != oldGeometry.size()) && (!highlightItem || item != highlightItem)) { if (QQuickPathViewAttached *att = attached(item)) diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h index b82db035e5..28db59fb55 100644 --- a/src/quick/items/qquickpincharea_p.h +++ b/src/quick/items/qquickpincharea_p.h @@ -268,15 +268,15 @@ Q_SIGNALS: void pinchFinished(QQuickPinchEvent *pinch); protected: - virtual bool childMouseEventFilter(QQuickItem *i, QEvent *e); - virtual void touchEvent(QTouchEvent *event); + bool childMouseEventFilter(QQuickItem *i, QEvent *e) Q_DECL_OVERRIDE; + void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE; - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - virtual void itemChange(ItemChange change, const ItemChangeData& value); + void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void itemChange(ItemChange change, const ItemChangeData& value) Q_DECL_OVERRIDE; #ifdef Q_OS_OSX - void hoverEnterEvent(QHoverEvent *event); - void hoverLeaveEvent(QHoverEvent *event); + void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE; + void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; void setTouchEventsEnabled(bool enable); #endif diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h index 7df4ee3b9a..164ea86c71 100644 --- a/src/quick/items/qquickpositioners_p.h +++ b/src/quick/items/qquickpositioners_p.h @@ -110,10 +110,10 @@ public: protected: QQuickBasePositioner(QQuickBasePositionerPrivate &dd, PositionerType at, QQuickItem *parent); - virtual void componentComplete(); - virtual void itemChange(ItemChange, const ItemChangeData &); + void componentComplete() Q_DECL_OVERRIDE; + void itemChange(ItemChange, const ItemChangeData &) Q_DECL_OVERRIDE; - virtual void updatePolish(); + void updatePolish() Q_DECL_OVERRIDE; Q_SIGNALS: void spacingChanged(); @@ -173,8 +173,8 @@ public: QQuickColumn(QQuickItem *parent=0); protected: - virtual void doPositioning(QSizeF *contentSize); - virtual void reportConflictingAnchors(); + void doPositioning(QSizeF *contentSize) Q_DECL_OVERRIDE; + void reportConflictingAnchors() Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QQuickColumn) }; @@ -197,8 +197,8 @@ Q_SIGNALS: void effectiveLayoutDirectionChanged(); protected: - virtual void doPositioning(QSizeF *contentSize); - virtual void reportConflictingAnchors(); + void doPositioning(QSizeF *contentSize) Q_DECL_OVERRIDE; + void reportConflictingAnchors() Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QQuickRow) Q_DECLARE_PRIVATE(QQuickRow) @@ -274,8 +274,8 @@ Q_SIGNALS: Q_REVISION(1) void verticalAlignmentChanged(VAlignment alignment); protected: - virtual void doPositioning(QSizeF *contentSize); - virtual void reportConflictingAnchors(); + void doPositioning(QSizeF *contentSize) Q_DECL_OVERRIDE; + void reportConflictingAnchors() Q_DECL_OVERRIDE; private: int m_rows; @@ -316,8 +316,8 @@ Q_SIGNALS: void effectiveLayoutDirectionChanged(); protected: - virtual void doPositioning(QSizeF *contentSize); - virtual void reportConflictingAnchors(); + void doPositioning(QSizeF *contentSize) Q_DECL_OVERRIDE; + void reportConflictingAnchors() Q_DECL_OVERRIDE; protected: QQuickFlow(QQuickFlowPrivate &dd, QQuickItem *parent); private: diff --git a/src/quick/items/qquickpositioners_p_p.h b/src/quick/items/qquickpositioners_p_p.h index e77997d4e9..cdcb09cf49 100644 --- a/src/quick/items/qquickpositioners_p_p.h +++ b/src/quick/items/qquickpositioners_p_p.h @@ -98,7 +98,7 @@ public: Qt::LayoutDirection layoutDirection; - void mirrorChange() { + void mirrorChange() Q_DECL_OVERRIDE { effectiveLayoutDirectionChange(); } bool isLeftToRight() const { @@ -108,24 +108,24 @@ public: return effectiveLayoutMirror ? layoutDirection == Qt::RightToLeft : layoutDirection == Qt::LeftToRight; } - virtual void itemSiblingOrderChanged(QQuickItem* other) + void itemSiblingOrderChanged(QQuickItem* other) Q_DECL_OVERRIDE { Q_UNUSED(other); setPositioningDirty(); } - void itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &oldGeometry) + void itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE { if (newGeometry.size() != oldGeometry.size()) setPositioningDirty(); } - virtual void itemVisibilityChanged(QQuickItem *) + void itemVisibilityChanged(QQuickItem *) Q_DECL_OVERRIDE { setPositioningDirty(); } - void itemDestroyed(QQuickItem *item) + void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE { Q_Q(QQuickBasePositioner); int index = q->positionedItems.find(QQuickBasePositioner::PositionedItem(item)); diff --git a/src/quick/items/qquickrectangle_p.h b/src/quick/items/qquickrectangle_p.h index 2e9eabd1d5..18922630f8 100644 --- a/src/quick/items/qquickrectangle_p.h +++ b/src/quick/items/qquickrectangle_p.h @@ -153,7 +153,7 @@ Q_SIGNALS: void radiusChanged(); protected: - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; private Q_SLOTS: void doUpdate(); diff --git a/src/quick/items/qquickrepeater_p.h b/src/quick/items/qquickrepeater_p.h index 159520a89d..d1ca686e78 100644 --- a/src/quick/items/qquickrepeater_p.h +++ b/src/quick/items/qquickrepeater_p.h @@ -77,8 +77,8 @@ private: void regenerate(); protected: - virtual void componentComplete(); - void itemChange(ItemChange change, const ItemChangeData &value); + void componentComplete() Q_DECL_OVERRIDE; + void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE; private Q_SLOTS: void createdItem(int index, QObject *item); diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 99e88a653d..8c5da9e5d5 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -136,7 +136,7 @@ public: QString parseLog(); - virtual bool event(QEvent *); + bool event(QEvent *) Q_DECL_OVERRIDE; Q_SIGNALS: void fragmentShaderChanged(); @@ -149,10 +149,10 @@ Q_SIGNALS: void supportsAtlasTexturesChanged(); protected: - virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); - virtual void componentComplete(); - virtual void itemChange(ItemChange change, const ItemChangeData &value); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; + void componentComplete() Q_DECL_OVERRIDE; + void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE; private Q_SLOTS: void updateGeometry(); diff --git a/src/quick/items/qquickshadereffectmesh_p.h b/src/quick/items/qquickshadereffectmesh_p.h index 5bcf633fa3..684f8461d8 100644 --- a/src/quick/items/qquickshadereffectmesh_p.h +++ b/src/quick/items/qquickshadereffectmesh_p.h @@ -69,8 +69,8 @@ class QQuickGridMesh : public QQuickShaderEffectMesh Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged) public: QQuickGridMesh(QObject *parent = 0); - virtual QSGGeometry *updateGeometry(QSGGeometry *geometry, const QVector<QByteArray> &attributes, const QRectF &srcRect, const QRectF &rect); - virtual QString log() const { return m_log; } + QSGGeometry *updateGeometry(QSGGeometry *geometry, const QVector<QByteArray> &attributes, const QRectF &srcRect, const QRectF &rect) Q_DECL_OVERRIDE; + QString log() const Q_DECL_OVERRIDE { return m_log; } void setResolution(const QSize &res); QSize resolution() const; diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp index 43220a0e29..df379b8a3b 100644 --- a/src/quick/items/qquickshadereffectnode.cpp +++ b/src/quick/items/qquickshadereffectnode.cpp @@ -45,16 +45,16 @@ class QQuickCustomMaterialShader : public QSGMaterialShader { public: QQuickCustomMaterialShader(const QQuickShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes); - virtual void deactivate(); - virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect); - virtual char const *const *attributeNames() const; + void deactivate() Q_DECL_OVERRIDE; + void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) Q_DECL_OVERRIDE; + char const *const *attributeNames() const Q_DECL_OVERRIDE; protected: friend class QQuickShaderEffectNode; - virtual void compile(); - virtual const char *vertexShader() const; - virtual const char *fragmentShader() const; + void compile() Q_DECL_OVERRIDE; + const char *vertexShader() const Q_DECL_OVERRIDE; + const char *fragmentShader() const Q_DECL_OVERRIDE; const QQuickShaderEffectMaterialKey m_key; QVector<QByteArray> m_attributes; diff --git a/src/quick/items/qquickshadereffectnode_p.h b/src/quick/items/qquickshadereffectnode_p.h index fc7c643aea..507db337aa 100644 --- a/src/quick/items/qquickshadereffectnode_p.h +++ b/src/quick/items/qquickshadereffectnode_p.h @@ -87,9 +87,9 @@ public: }; explicit QQuickShaderEffectMaterial(QQuickShaderEffectNode *node = 0); - virtual QSGMaterialType *type() const; - virtual QSGMaterialShader *createShader() const; - virtual int compare(const QSGMaterial *other) const; + QSGMaterialType *type() const Q_DECL_OVERRIDE; + QSGMaterialShader *createShader() const Q_DECL_OVERRIDE; + int compare(const QSGMaterial *other) const Q_DECL_OVERRIDE; QVector<QByteArray> attributes; QVector<UniformData> uniforms[QQuickShaderEffectMaterialKey::ShaderTypeCount]; @@ -129,7 +129,7 @@ public: QQuickShaderEffectNode(); virtual ~QQuickShaderEffectNode(); - virtual void preprocess(); + void preprocess() Q_DECL_OVERRIDE; Q_SIGNALS: void logAndStatusChanged(const QString &, int status); diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h index 69e65f927f..7add0b1033 100644 --- a/src/quick/items/qquickshadereffectsource_p.h +++ b/src/quick/items/qquickshadereffectsource_p.h @@ -112,8 +112,8 @@ public: bool recursive() const; void setRecursive(bool enabled); - bool isTextureProvider() const { return true; } - QSGTextureProvider *textureProvider() const; + bool isTextureProvider() const Q_DECL_OVERRIDE { return true; } + QSGTextureProvider *textureProvider() const Q_DECL_OVERRIDE; Q_INVOKABLE void scheduleUpdate(); @@ -135,11 +135,11 @@ private Q_SLOTS: void invalidateSceneGraph(); protected: - virtual void releaseResources(); - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + void releaseResources() Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; - virtual void itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect); - virtual void itemChange(ItemChange change, const ItemChangeData &value); + void itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect) Q_DECL_OVERRIDE; + void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE; private: void ensureTexture(); diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h index 1bd625001d..a38a284201 100644 --- a/src/quick/items/qquicksprite_p.h +++ b/src/quick/items/qquicksprite_p.h @@ -138,7 +138,7 @@ public: return m_frameDurationVariation; } - int variedDuration() const; + int variedDuration() const Q_DECL_OVERRIDE; bool frameSync() const { diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index 645830c014..7a48beeda4 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -201,10 +201,12 @@ int QQuickSpriteEngine::spriteFrames(int sprite) extra = (m_sprites[state]->m_generatedCount - 1) - extra; - if (extra == m_sprites[state]->m_generatedCount - 1)//last state - return m_sprites[state]->frames() % m_sprites[state]->m_framesPerRow; - else - return m_sprites[state]->m_framesPerRow; + if (extra == m_sprites[state]->m_generatedCount - 1) {//last state + const int framesRemaining = m_sprites[state]->frames() % m_sprites[state]->m_framesPerRow; + if (framesRemaining > 0) + return framesRemaining; + } + return m_sprites[state]->m_framesPerRow; } int QQuickSpriteEngine::spriteDuration(int sprite)//Full duration, not per frame @@ -219,10 +221,12 @@ int QQuickSpriteEngine::spriteDuration(int sprite)//Full duration, not per frame if (m_sprites[state]->reverse()) extra = (m_sprites[state]->m_generatedCount - 1) - extra; - if (extra == m_sprites[state]->m_generatedCount - 1)//last state - return m_duration[sprite] % rowDuration; - else - return rowDuration; + if (extra == m_sprites[state]->m_generatedCount - 1) {//last state + const int durationRemaining = m_duration[sprite] % rowDuration; + if (durationRemaining > 0) + return durationRemaining; + } + return rowDuration; } int QQuickSpriteEngine::spriteY(int sprite) @@ -508,7 +512,9 @@ void QQuickStochasticEngine::start(int index, int state) else m_startTimes[index] = 0; m_goals[index] = -1; + m_addAdvance = false; restart(index); + m_addAdvance = true; } void QQuickStochasticEngine::stop(int index) diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h index 1705ab3ee3..227041f181 100644 --- a/src/quick/items/qquickspriteengine_p.h +++ b/src/quick/items/qquickspriteengine_p.h @@ -268,8 +268,8 @@ public: int spriteCount();//Like state count int maxFrames(); - virtual void restart(int index=0); - virtual void advance(int index=0); + void restart(int index=0) Q_DECL_OVERRIDE; + void advance(int index=0) Q_DECL_OVERRIDE; //Similar API to QQuickPixmap for async loading convenience bool isNull() { return status() == QQuickPixmap::Null; } diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp index 0be6486bf0..0d19a8aa83 100644 --- a/src/quick/items/qquickspritesequence.cpp +++ b/src/quick/items/qquickspritesequence.cpp @@ -53,9 +53,9 @@ class QQuickSpriteSequenceMaterial : public QSGMaterial public: QQuickSpriteSequenceMaterial(); ~QQuickSpriteSequenceMaterial(); - virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; } - virtual QSGMaterialShader *createShader() const; - virtual int compare(const QSGMaterial *other) const + QSGMaterialType *type() const Q_DECL_OVERRIDE{ static QSGMaterialType type; return &type; } + QSGMaterialShader *createShader() const Q_DECL_OVERRIDE; + int compare(const QSGMaterial *other) const Q_DECL_OVERRIDE { return this - static_cast<const QQuickSpriteSequenceMaterial *>(other); } @@ -99,7 +99,7 @@ public: setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/items/shaders/sprite.frag")); } - virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) + void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) Q_DECL_OVERRIDE { QQuickSpriteSequenceMaterial *m = static_cast<QQuickSpriteSequenceMaterial *>(newEffect); m->texture->bind(); @@ -112,14 +112,14 @@ public: program()->setUniformValue(m_matrix_id, state.combinedMatrix()); } - virtual void initialize() { + void initialize() Q_DECL_OVERRIDE { m_matrix_id = program()->uniformLocation("qt_Matrix"); m_opacity_id = program()->uniformLocation("qt_Opacity"); m_animData_id = program()->uniformLocation("animData"); m_animPos_id = program()->uniformLocation("animPos"); } - virtual char const *const *attributeNames() const { + char const *const *attributeNames() const Q_DECL_OVERRIDE { static const char *attr[] = { "vPos", "vTex", diff --git a/src/quick/items/qquickspritesequence_p.h b/src/quick/items/qquickspritesequence_p.h index a32f5ead4f..3c22d8772c 100644 --- a/src/quick/items/qquickspritesequence_p.h +++ b/src/quick/items/qquickspritesequence_p.h @@ -114,7 +114,7 @@ private Q_SLOTS: protected: void reset(); - QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; private: void prepareNextFrame(); QSGGeometryNode* buildNode(); diff --git a/src/quick/items/qquickstateoperations_p.h b/src/quick/items/qquickstateoperations_p.h index 79facf2445..a9e4be1e20 100644 --- a/src/quick/items/qquickstateoperations_p.h +++ b/src/quick/items/qquickstateoperations_p.h @@ -93,17 +93,17 @@ public: void setRotation(QQmlScriptString rotation); bool rotationIsSet() const; - virtual ActionList actions(); + ActionList actions() Q_DECL_OVERRIDE; - virtual void saveOriginals(); + void saveOriginals() Q_DECL_OVERRIDE; //virtual void copyOriginals(QQuickStateActionEvent*); - virtual void execute(Reason reason = ActualChange); - virtual bool isReversable(); - virtual void reverse(Reason reason = ActualChange); - virtual EventType type() const; - virtual bool override(QQuickStateActionEvent*other); - virtual void rewind(); - virtual void saveCurrentValues(); + void execute(Reason reason = ActualChange) Q_DECL_OVERRIDE; + bool isReversable() Q_DECL_OVERRIDE; + void reverse(Reason reason = ActualChange) Q_DECL_OVERRIDE; + EventType type() const Q_DECL_OVERRIDE; + bool override(QQuickStateActionEvent*other) Q_DECL_OVERRIDE; + void rewind() Q_DECL_OVERRIDE; + void saveCurrentValues() Q_DECL_OVERRIDE; }; class QQuickAnchorChanges; @@ -173,28 +173,28 @@ public: QQuickAnchorChanges(QObject *parent=0); ~QQuickAnchorChanges(); - virtual ActionList actions(); + ActionList actions() Q_DECL_OVERRIDE; QQuickAnchorSet *anchors(); QQuickItem *object() const; void setObject(QQuickItem *); - virtual void execute(Reason reason = ActualChange); - virtual bool isReversable(); - virtual void reverse(Reason reason = ActualChange); - virtual EventType type() const; - virtual bool override(QQuickStateActionEvent*other); - virtual bool changesBindings(); - virtual void saveOriginals(); - virtual bool needsCopy() { return true; } - virtual void copyOriginals(QQuickStateActionEvent*); - virtual void clearBindings(); - virtual void rewind(); - virtual void saveCurrentValues(); + void execute(Reason reason = ActualChange) Q_DECL_OVERRIDE; + bool isReversable() Q_DECL_OVERRIDE; + void reverse(Reason reason = ActualChange) Q_DECL_OVERRIDE; + EventType type() const Q_DECL_OVERRIDE; + bool override(QQuickStateActionEvent*other) Q_DECL_OVERRIDE; + bool changesBindings() Q_DECL_OVERRIDE; + void saveOriginals() Q_DECL_OVERRIDE; + bool needsCopy() Q_DECL_OVERRIDE { return true; } + void copyOriginals(QQuickStateActionEvent*) Q_DECL_OVERRIDE; + void clearBindings() Q_DECL_OVERRIDE; + void rewind() Q_DECL_OVERRIDE; + void saveCurrentValues() Q_DECL_OVERRIDE; QList<QQuickStateAction> additionalActions(); - virtual void saveTargetValues(); + void saveTargetValues() Q_DECL_OVERRIDE; }; QT_END_NAMESPACE diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h index c9f64d3fab..bc1a5198e8 100644 --- a/src/quick/items/qquicktext_p.h +++ b/src/quick/items/qquicktext_p.h @@ -186,15 +186,15 @@ public: FontSizeMode fontSizeMode() const; void setFontSizeMode(FontSizeMode mode); - virtual void componentComplete(); + void componentComplete() Q_DECL_OVERRIDE; int resourcesLoading() const; // mainly for testing qreal contentWidth() const; qreal contentHeight() const; - QRectF boundingRect() const; - QRectF clipRect() const; + QRectF boundingRect() const Q_DECL_OVERRIDE; + QRectF clipRect() const Q_DECL_OVERRIDE; Q_INVOKABLE void doLayout(); RenderType renderType() const; @@ -233,18 +233,18 @@ Q_SIGNALS: void renderTypeChanged(); protected: - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - virtual void itemChange(ItemChange change, const ItemChangeData &value); - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); - - void updatePolish(); - - void hoverEnterEvent(QHoverEvent *event); - void hoverMoveEvent(QHoverEvent *event); - void hoverLeaveEvent(QHoverEvent *event); + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE; + void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; + + void updatePolish() Q_DECL_OVERRIDE; + + void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE; + void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; + void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; private Q_SLOTS: void q_imagesLoaded(); diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h index 022c2ac9d5..04a78f9c21 100644 --- a/src/quick/items/qquicktext_p_p.h +++ b/src/quick/items/qquicktext_p_p.h @@ -72,7 +72,7 @@ public: void updateLayout(); bool determineHorizontalAlignment(); bool setHAlign(QQuickText::HAlignment, bool forceAlign = false); - void mirrorChange(); + void mirrorChange() Q_DECL_OVERRIDE; bool isLineLaidOutConnected(); void setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height); @@ -154,8 +154,8 @@ public: static const QChar elideChar; - virtual qreal getImplicitWidth() const; - virtual qreal getImplicitHeight() const; + qreal getImplicitWidth() const Q_DECL_OVERRIDE; + qreal getImplicitHeight() const Q_DECL_OVERRIDE; void ensureDoc(); diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h index d0af4a1cc9..2fe083f1d2 100644 --- a/src/quick/items/qquicktextcontrol_p.h +++ b/src/quick/items/qquicktextcontrol_p.h @@ -162,9 +162,9 @@ public: bool cursorOn() const; protected: - virtual void timerEvent(QTimerEvent *e); + void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE; - virtual bool event(QEvent *e); + bool event(QEvent *e) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QQuickTextControl) diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index 54e6dd229a..262dc04445 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -211,7 +211,7 @@ public: bool canUndo() const; bool canRedo() const; - virtual void componentComplete(); + void componentComplete() Q_DECL_OVERRIDE; /* FROM EDIT */ void setReadOnly(bool); @@ -220,7 +220,7 @@ public: QRectF cursorRectangle() const; #ifndef QT_NO_IM - QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE; Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; #endif @@ -236,8 +236,8 @@ public: Q_INVOKABLE void moveCursorSelection(int pos); Q_INVOKABLE void moveCursorSelection(int pos, SelectionMode mode); - QRectF boundingRect() const; - QRectF clipRect() const; + QRectF boundingRect() const Q_DECL_OVERRIDE; + QRectF clipRect() const Q_DECL_OVERRIDE; #ifndef QT_NO_IM bool isInputMethodComposing() const; @@ -332,28 +332,28 @@ private: void updateTotalLines(); protected: - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); + void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) Q_DECL_OVERRIDE; - bool event(QEvent *); - void keyPressEvent(QKeyEvent *); - void keyReleaseEvent(QKeyEvent *); - void focusInEvent(QFocusEvent *event); - void focusOutEvent(QFocusEvent *event); + bool event(QEvent *) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE; + void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE; - void hoverEnterEvent(QHoverEvent *event); - void hoverMoveEvent(QHoverEvent *event); - void hoverLeaveEvent(QHoverEvent *event); + void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE; + void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; + void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; // mouse filter? - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + 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 - void inputMethodEvent(QInputMethodEvent *e); + void inputMethodEvent(QInputMethodEvent *e) Q_DECL_OVERRIDE; #endif - QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData); + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) Q_DECL_OVERRIDE; friend class QQuickTextUtil; friend class QQuickTextDocument; diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h index ffad3ebdcf..41a5107ccf 100644 --- a/src/quick/items/qquicktextedit_p_p.h +++ b/src/quick/items/qquicktextedit_p_p.h @@ -117,8 +117,8 @@ public: void relayoutDocument(); bool determineHorizontalAlignment(); bool setHAlign(QQuickTextEdit::HAlignment, bool forceAlign = false); - void mirrorChange(); - qreal getImplicitWidth() const; + void mirrorChange() Q_DECL_OVERRIDE; + qreal getImplicitWidth() const Q_DECL_OVERRIDE; Qt::LayoutDirection textDirection(const QString &text) const; bool isLinkHoveredConnected(); diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index 4b94530587..ad2c579001 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -106,7 +106,7 @@ public: QQuickTextInput(QQuickItem * parent=0); ~QQuickTextInput(); - void componentComplete(); + void componentComplete() Q_DECL_OVERRIDE; enum EchoMode {//To match QLineEdit::EchoMode Normal, @@ -245,12 +245,12 @@ public: bool hasAcceptableInput() const; #ifndef QT_NO_IM - QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE; Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; #endif - QRectF boundingRect() const; - QRectF clipRect() const; + QRectF boundingRect() const Q_DECL_OVERRIDE; + QRectF clipRect() const Q_DECL_OVERRIDE; bool canPaste() const; @@ -315,23 +315,23 @@ Q_SIGNALS: void renderTypeChanged(); protected: - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent* ev); + void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) Q_DECL_OVERRIDE; + + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + 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 - void inputMethodEvent(QInputMethodEvent *); + void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE; #endif - void mouseUngrabEvent(); - bool event(QEvent *e); - void focusOutEvent(QFocusEvent *event); - void focusInEvent(QFocusEvent *event); - void timerEvent(QTimerEvent *event); - QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data); + void mouseUngrabEvent() Q_DECL_OVERRIDE; + bool event(QEvent *e) Q_DECL_OVERRIDE; + void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE; + void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE; public Q_SLOTS: void selectAll(); diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h index 7d9f3ff9ce..9339bf9a30 100644 --- a/src/quick/items/qquicktextinput_p_p.h +++ b/src/quick/items/qquicktextinput_p_p.h @@ -145,7 +145,7 @@ public: void updateVerticalScroll(); bool determineHorizontalAlignment(); bool setHAlign(QQuickTextInput::HAlignment, bool forceAlign = false); - void mirrorChange(); + void mirrorChange() Q_DECL_OVERRIDE; bool sendMouseEventToInputContext(QMouseEvent *event); #ifndef QT_NO_IM Qt::InputMethodHints effectiveInputMethodHints() const; @@ -418,7 +418,7 @@ public: void updateLayout(); void updateBaselineOffset(); - qreal getImplicitWidth() const; + qreal getImplicitWidth() const Q_DECL_OVERRIDE; private: void removeSelectedText(); diff --git a/src/quick/items/qquicktranslate_p.h b/src/quick/items/qquicktranslate_p.h index ca49349f74..f95e13ac35 100644 --- a/src/quick/items/qquicktranslate_p.h +++ b/src/quick/items/qquicktranslate_p.h @@ -58,7 +58,7 @@ public: qreal y() const; void setY(qreal); - void applyTo(QMatrix4x4 *matrix) const; + void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE; Q_SIGNALS: void xChanged(); @@ -94,7 +94,7 @@ public: qreal zScale() const; void setZScale(qreal); - void applyTo(QMatrix4x4 *matrix) const; + void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE; Q_SIGNALS: void originChanged(); @@ -129,7 +129,7 @@ public: void setAxis(const QVector3D &axis); void setAxis(Qt::Axis axis); - void applyTo(QMatrix4x4 *matrix) const; + void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE; Q_SIGNALS: void originChanged(); @@ -153,7 +153,7 @@ public: QMatrix4x4 matrix() const; void setMatrix(const QMatrix4x4& matrix); - void applyTo(QMatrix4x4 *matrix) const; + void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE; Q_SIGNALS: void matrixChanged(); diff --git a/src/quick/items/qquickview.h b/src/quick/items/qquickview.h index d8017782aa..337d987243 100644 --- a/src/quick/items/qquickview.h +++ b/src/quick/items/qquickview.h @@ -90,14 +90,14 @@ private Q_SLOTS: void continueExecute(); protected: - virtual void resizeEvent(QResizeEvent *); - virtual void timerEvent(QTimerEvent*); - - virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); - virtual void mousePressEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void mouseMoveEvent(QMouseEvent *); + void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent*) Q_DECL_OVERRIDE; + + void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QQuickView) Q_DECLARE_PRIVATE(QQuickView) diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h index 2d3323a59c..54f60c87f0 100644 --- a/src/quick/items/qquickview_p.h +++ b/src/quick/items/qquickview_p.h @@ -71,7 +71,7 @@ public: ~QQuickViewPrivate(); void execute(); - void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); + void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; void initResize(); void updateSize(); void setRootObject(QObject *); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 7b300c9ab6..5548017ddc 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -143,7 +143,7 @@ public slots: void animationStopped() { incubate(); } protected: - virtual void incubatingObjectCountChanged(int count) + void incubatingObjectCountChanged(int count) Q_DECL_OVERRIDE { if (count && !m_renderLoop->interleaveIncubation()) incubateAgain(); @@ -2926,6 +2926,15 @@ QOpenGLContext *QQuickWindow::openglContext() const } /*! + Returns true if the scene graph has been initialized; otherwise returns false. + */ +bool QQuickWindow::isSceneGraphInitialized() const +{ + Q_D(const QQuickWindow); + return d->context != 0 && d->context->isValid(); +} + +/*! \fn void QQuickWindow::frameSwapped() This signal is emitted when the frame buffers have been swapped. diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index b52d6b807e..8d75a4767c 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -115,7 +115,7 @@ public: QQmlIncubationController *incubationController() const; #ifndef QT_NO_ACCESSIBILITY - virtual QAccessibleInterface *accessibleRoot() const; + QAccessibleInterface *accessibleRoot() const Q_DECL_OVERRIDE; #endif // Scene graph specific functions @@ -139,6 +139,7 @@ public: bool isPersistentSceneGraph() const; QOpenGLContext *openglContext() const; + bool isSceneGraphInitialized() const; void scheduleRenderJob(QRunnable *job, RenderStage schedule); @@ -167,25 +168,25 @@ public Q_SLOTS: protected: QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent = 0); - virtual void exposeEvent(QExposeEvent *); - virtual void resizeEvent(QResizeEvent *); + void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; - virtual void showEvent(QShowEvent *); - virtual void hideEvent(QHideEvent *); + void showEvent(QShowEvent *) Q_DECL_OVERRIDE; + void hideEvent(QHideEvent *) Q_DECL_OVERRIDE; // TODO Qt 6: reimplement QWindow::closeEvent to emit closing - virtual void focusInEvent(QFocusEvent *); - virtual void focusOutEvent(QFocusEvent *); + void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE; + void focusOutEvent(QFocusEvent *) Q_DECL_OVERRIDE; - virtual bool event(QEvent *); - virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); - virtual void mousePressEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void mouseDoubleClickEvent(QMouseEvent *); - virtual void mouseMoveEvent(QMouseEvent *); + bool event(QEvent *) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; #ifndef QT_NO_WHEELEVENT - virtual void wheelEvent(QWheelEvent *); + void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; #endif private Q_SLOTS: diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index 371abd163b..bf41bc136f 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -89,7 +89,7 @@ Q_SIGNALS: void visibilityChanged(QWindow::Visibility visibility); protected: - void classBegin() { + void classBegin() Q_DECL_OVERRIDE { QQmlEngine* e = qmlEngine(this); //Give QQuickView behavior when created from QML with QQmlApplicationEngine if (QCoreApplication::instance()->property("__qml_using_qqmlapplicationengine") == QVariant(true)) { @@ -105,7 +105,7 @@ protected: } } - void componentComplete() { + void componentComplete() Q_DECL_OVERRIDE { m_complete = true; if (transientParent() && !transientParent()->isVisible()) { connect(transientParent(), &QQuickWindow::visibleChanged, this, diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index ce331cc883..ac45cf70db 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -128,8 +128,9 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material) if (shader) return shader; - if (QSG_LOG_TIME_COMPILATION().isDebugEnabled() || QQuickProfiler::profilingSceneGraph()) + if (QSG_LOG_TIME_COMPILATION().isDebugEnabled()) qsg_renderer_timer.start(); + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphContextFrame); QSGMaterialShader *s = material->createShader(); QOpenGLContext *ctx = QOpenGLContext::currentContext(); @@ -159,8 +160,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material) qCDebug(QSG_LOG_TIME_COMPILATION, "shader compiled in %dms", (int) qsg_renderer_timer.elapsed()); - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphContextFrame, ( - qsg_renderer_timer.nsecsElapsed())); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame); rewrittenShaders[type] = shader; return shader; @@ -173,8 +173,9 @@ ShaderManager::Shader *ShaderManager::prepareMaterialNoRewrite(QSGMaterial *mate if (shader) return shader; - if (QSG_LOG_TIME_COMPILATION().isDebugEnabled() || QQuickProfiler::profilingSceneGraph()) + if (QSG_LOG_TIME_COMPILATION().isDebugEnabled()) qsg_renderer_timer.start(); + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphContextFrame); QSGMaterialShader *s = static_cast<QSGMaterialShader *>(material->createShader()); context->compile(s, material); @@ -190,8 +191,7 @@ 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(QQuickProfiler::SceneGraphContextFrame, ( - qsg_renderer_timer.nsecsElapsed())); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame); return shader; } diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index dd089425f6..ce86408434 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -176,10 +176,11 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) m_is_rendering = true; - bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled() || - QQuickProfiler::profilingSceneGraph(); + bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled(); if (profileFrames) frameTimer.start(); + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphRendererFrame); + qint64 bindTime = 0; qint64 renderTime = 0; @@ -189,6 +190,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) bindable.bind(); if (profileFrames) bindTime = frameTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame); // Sanity check that attribute registers are disabled if (qsg_sanity_check) { @@ -206,6 +208,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) render(); if (profileFrames) renderTime = frameTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRendererFrame); m_is_rendering = false; m_changed_emitted = false; @@ -218,13 +221,6 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) int((updatePassTime - preprocessTime) / 1000000), int((bindTime - updatePassTime) / 1000000), int((renderTime - bindTime) / 1000000)); - - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphRendererFrame, ( - preprocessTime, - updatePassTime - preprocessTime, - bindTime - updatePassTime, - renderTime - bindTime)); - } /*! @@ -273,15 +269,16 @@ void QSGRenderer::preprocess() } } - bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled()|| - QQuickProfiler::profilingSceneGraph(); + bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled(); if (profileFrames) preprocessTime = frameTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame); nodeUpdater()->updateStates(root); if (profileFrames) updatePassTime = frameTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame); } void QSGRenderer::addNodesToPreprocess(QSGNode *node) diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index 80234d54f5..e0b96a45b6 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -153,10 +153,10 @@ void QSGDistanceFieldGlyphCache::update() if (m_pendingGlyphs.isEmpty()) return; - bool profileFrames = QSG_LOG_TIME_GLYPH().isDebugEnabled() || - QQuickProfiler::profilingSceneGraph(); + bool profileFrames = QSG_LOG_TIME_GLYPH().isDebugEnabled(); if (profileFrames) qsg_render_timer.start(); + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphAdaptationLayerFrame); QList<QDistanceField> distanceFields; for (int i = 0; i < m_pendingGlyphs.size(); ++i) { @@ -169,6 +169,7 @@ void QSGDistanceFieldGlyphCache::update() int count = m_pendingGlyphs.size(); if (profileFrames) renderTime = qsg_render_timer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphAdaptationLayerFrame); m_pendingGlyphs.reset(); @@ -183,10 +184,8 @@ void QSGDistanceFieldGlyphCache::update() int(renderTime / 1000000), int((now - (renderTime / 1000000)))); } - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphAdaptationLayerFrame, ( - count, - renderTime, - qsg_render_timer.nsecsElapsed() - renderTime)); + Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(QQuickProfiler::SceneGraphAdaptationLayerFrame, + (qint64)count); } void QSGDistanceFieldGlyphCache::setGlyphsPosition(const QList<GlyphPosition> &glyphs) diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 83b221a8cc..b87ab3686f 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -378,6 +378,7 @@ void QSGContext::renderContextInitialized(QSGRenderContext *renderContext) QByteArray all; foreach (const QByteArray &e, exts) all += ' ' + e; qCDebug(QSG_LOG_INFO) << "GL_EXTENSIONS: " << all.constData(); qCDebug(QSG_LOG_INFO) << "Max Texture Size: " << renderContext->maxTextureSize(); + qCDebug(QSG_LOG_INFO) << "Debug context: " << format.testOption(QSurfaceFormat::DebugContext); } d->mutex.unlock(); @@ -468,8 +469,11 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const QSurfaceFormat format = QSurfaceFormat::defaultFormat(); static bool useDepth = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER"); static bool useStencil = qEnvironmentVariableIsEmpty("QSG_NO_STENCIL_BUFFER"); + static bool enableDebug = qEnvironmentVariableIsSet("QSG_OPENGL_DEBUG"); format.setDepthBufferSize(useDepth ? 24 : 0); format.setStencilBufferSize(useStencil ? 8 : 0); + if (enableDebug) + format.setOption(QSurfaceFormat::DebugContext); if (QQuickWindow::hasDefaultAlphaBuffer()) format.setAlphaBufferSize(8); format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 184b8248d5..91788d82d4 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -93,7 +93,7 @@ public: QOpenGLContext *openglContext() const { return m_gl; } QSGContext *sceneGraphContext() const { return m_sg; } - bool isValid() const { return m_gl; } + virtual bool isValid() const { return m_gl; } virtual void initialize(QOpenGLContext *context); virtual void invalidate(); diff --git a/src/quick/scenegraph/qsgdefaultlayer.cpp b/src/quick/scenegraph/qsgdefaultlayer.cpp index 450a9fbee0..2d114aebd5 100644 --- a/src/quick/scenegraph/qsgdefaultlayer.cpp +++ b/src/quick/scenegraph/qsgdefaultlayer.cpp @@ -57,7 +57,7 @@ namespace public: BindableFbo(QOpenGLFramebufferObject *fbo, QSGDepthStencilBuffer *depthStencil); virtual ~BindableFbo(); - virtual void bind() const; + void bind() const Q_DECL_OVERRIDE; private: QOpenGLFramebufferObject *m_fbo; QSGDepthStencilBuffer *m_depthStencil; diff --git a/src/quick/scenegraph/qsgdefaultlayer_p.h b/src/quick/scenegraph/qsgdefaultlayer_p.h index 44c74d7cfd..0615045d60 100644 --- a/src/quick/scenegraph/qsgdefaultlayer_p.h +++ b/src/quick/scenegraph/qsgdefaultlayer_p.h @@ -54,7 +54,7 @@ public: QSGDefaultLayer(QSGRenderContext *context); ~QSGDefaultLayer(); - virtual bool updateTexture(); + bool updateTexture() Q_DECL_OVERRIDE; // The item's "paint node", not effect node. QSGNode *item() const { return m_item; } diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index cd92d12d43..6381c3160f 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -331,17 +331,17 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) } QElapsedTimer renderTimer; qint64 renderTime = 0, syncTime = 0, polishTime = 0; - bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled() || - QQuickProfiler::profilingSceneGraph(); + bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled(); if (profileFrames) renderTimer.start(); + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame); cd->polishItems(); - if (profileFrames) { + if (profileFrames) polishTime = renderTimer.nsecsElapsed(); - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphPolishFrame, (polishTime)); - } + Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame, + QQuickProfiler::SceneGraphRenderLoopFrame); emit window->afterAnimating(); @@ -349,11 +349,13 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) if (profileFrames) syncTime = renderTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); cd->renderSceneGraph(window->size()); if (profileFrames) renderTime = renderTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); if (data.grabOnly) { grabContent = qt_gl_read_framebuffer(window->size() * window->devicePixelRatio(), false, false); @@ -368,6 +370,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) qint64 swapTime = 0; if (profileFrames) swapTime = renderTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame); if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled()) { static QTime lastFrameTime = QTime::currentTime(); @@ -382,11 +385,6 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) lastFrameTime = QTime::currentTime(); } - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphRenderLoopFrame, ( - syncTime - polishTime, - renderTime - syncTime, - swapTime - renderTime)); - // Might have been set during syncSceneGraph() if (data.updatePending) maybeUpdate(window); diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index ff32ccb358..29bee67f69 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -531,12 +531,12 @@ void QSGRenderThread::sync(bool inExpose) void QSGRenderThread::syncAndRender() { - bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled() || - QQuickProfiler::profilingSceneGraph(); + bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled(); if (profileFrames) { sinceLastTime = threadTimer.nsecsElapsed(); threadTimer.start(); } + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphRenderLoopFrame); QElapsedTimer waitTimer; waitTimer.start(); @@ -563,6 +563,7 @@ void QSGRenderThread::syncAndRender() if (profileFrames) syncTime = threadTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- rendering started"; @@ -581,9 +582,11 @@ void QSGRenderThread::syncAndRender() d->renderSceneGraph(windowSize); if (profileFrames) renderTime = threadTimer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); gl->swapBuffers(window); d->fireFrameSwapped(); } else { + Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame, 1); qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- window not ready, skipping render"; } @@ -608,10 +611,7 @@ void QSGRenderThread::syncAndRender() int(threadTimer.elapsed() - renderTime / 1000000)); - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphRenderLoopFrame, ( - syncTime, - renderTime - syncTime, - threadTimer.nsecsElapsed() - renderTime)); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame); } @@ -1100,16 +1100,17 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose) qint64 polishTime = 0; qint64 waitTime = 0; qint64 syncTime = 0; - bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled() || - QQuickProfiler::profilingSceneGraph(); + bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled(); if (profileFrames) timer.start(); + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishAndSync); QQuickWindowPrivate *d = QQuickWindowPrivate::get(window); d->polishItems(); if (profileFrames) polishTime = timer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync); w->updateDuringSync = false; @@ -1124,6 +1125,7 @@ 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); w->thread->waitCondition.wait(&w->thread->mutex); m_lockedForSync = false; w->thread->mutex.unlock(); @@ -1131,6 +1133,7 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose) if (profileFrames) syncTime = timer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync); killTimer(w->timerId); w->timerId = 0; @@ -1154,11 +1157,7 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose) << ", animations=" << (timer.nsecsElapsed() - syncTime) / 1000000 << " - (on Gui thread) " << window; - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphPolishAndSync, ( - polishTime, - waitTime - polishTime, - syncTime - waitTime, - timer.nsecsElapsed() - syncTime)); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync); } QSGThreadedRenderLoop::Window *QSGThreadedRenderLoop::windowForTimer(int timerId) const diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 10eba74607..11e3376af5 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -53,10 +53,14 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_ #define RLDEBUG(x) qCDebug(QSG_LOG_RENDERLOOP) << x; static QElapsedTimer qsg_render_timer; -#define QSG_RENDER_TIMING_SAMPLE(sampleName) \ +#define QSG_LOG_TIME_SAMPLE(sampleName) \ qint64 sampleName = 0; \ - if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled() || QQuickProfiler::profilingSceneGraph()) \ - sampleName = qsg_render_timer.nsecsElapsed() + if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled()) \ + sampleName = qsg_render_timer.nsecsElapsed(); \ + +#define QSG_RENDER_TIMING_SAMPLE(frameType, sampleName) \ + QSG_LOG_TIME_SAMPLE(sampleName) \ + Q_QUICK_SG_PROFILE_RECORD(frameType); QSGWindowsRenderLoop::QSGWindowsRenderLoop() @@ -346,7 +350,8 @@ void QSGWindowsRenderLoop::render() if (m_animationDriver->isRunning()) { RLDEBUG("advancing animations"); - QSG_RENDER_TIMING_SAMPLE(time_start); + QSG_LOG_TIME_SAMPLE(time_start); + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphWindowsAnimations); m_animationDriver->advance(); RLDEBUG("animations advanced"); @@ -354,8 +359,7 @@ void QSGWindowsRenderLoop::render() "animations ticked in %dms", int((qsg_render_timer.nsecsElapsed() - time_start)/1000000)); - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphWindowsAnimations, ( - qsg_render_timer.nsecsElapsed() - time_start)); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphWindowsAnimations); // It is not given that animations triggered another maybeUpdate() // and thus another render pass, so to keep things running, @@ -390,27 +394,28 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window) if (!windowData(window)) return; - QSG_RENDER_TIMING_SAMPLE(time_start); + QSG_LOG_TIME_SAMPLE(time_start); + Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame); RLDEBUG(" - polishing"); d->polishItems(); - QSG_RENDER_TIMING_SAMPLE(time_polished); - - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphPolishFrame, (time_polished - time_start)); + QSG_LOG_TIME_SAMPLE(time_polished); + Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame, + QQuickProfiler::SceneGraphRenderLoopFrame); emit window->afterAnimating(); RLDEBUG(" - syncing"); d->syncSceneGraph(); - QSG_RENDER_TIMING_SAMPLE(time_synced); + QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced); RLDEBUG(" - rendering"); d->renderSceneGraph(window->size()); - QSG_RENDER_TIMING_SAMPLE(time_rendered); + QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_rendered); RLDEBUG(" - swapping"); m_gl->swapBuffers(window); - QSG_RENDER_TIMING_SAMPLE(time_swapped); + QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_swapped); RLDEBUG(" - frameDone"); d->fireFrameSwapped(); @@ -423,10 +428,7 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window) << ", swap=" << (time_swapped - time_rendered) / 1000000 << " - " << window; - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphRenderLoopFrame, ( - time_synced - time_polished, - time_rendered - time_synced, - time_swapped - time_rendered)); + Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphRenderLoopFrame); } QT_END_NAMESPACE diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index 5edcb5d67a..cb82d721ca 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -377,10 +377,12 @@ void Atlas::bind(QSGTexture::Filtering filtering) // Upload all pending images.. for (int i=0; i<m_pending_uploads.size(); ++i) { - bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled() || - QQuickProfiler::profilingSceneGraph(); + 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); if (m_externalFormat == GL_BGRA && !m_use_bgra_fallback) { @@ -393,12 +395,10 @@ void Atlas::bind(QSGTexture::Filtering filtering) << "ms (" << m_pending_uploads.at(i)->image().width() << "x" << m_pending_uploads.at(i)->image().height() << ")"; - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphTexturePrepare, ( - 0, // bind (not relevant) - 0, // convert (not relevant) - 0, // swizzle (not relevant) - qsg_renderer_timer.nsecsElapsed(), // (upload all of the above) - 0)); // mipmap (not used ever...) + // 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); } GLenum f = filtering == QSGTexture::Nearest ? GL_NEAREST : GL_LINEAR; diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index fc5050014e..673323baa2 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -633,10 +633,12 @@ void QSGPlainTexture::bind() m_dirty_texture = false; - bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled() || - QQuickProfiler::profilingSceneGraph(); + bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled(); if (profileFrames) qsg_renderer_timer.start(); + Q_QUICK_SG_PROFILE_START_SYNCHRONIZED(QQuickProfiler::SceneGraphTexturePrepare, + QQuickProfiler::SceneGraphTextureDeletion); + if (m_image.isNull()) { if (m_texture_id && m_owns_texture) { @@ -645,8 +647,7 @@ void QSGPlainTexture::bind() (int) qsg_renderer_timer.elapsed(), m_texture_size.width(), m_texture_size.height()); - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphTextureDeletion, ( - qsg_renderer_timer.nsecsElapsed())); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTextureDeletion); } m_texture_id = 0; m_texture_size = QSize(); @@ -662,6 +663,7 @@ void QSGPlainTexture::bind() qint64 bindTime = 0; if (profileFrames) bindTime = qsg_renderer_timer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare); // ### TODO: check for out-of-memory situations... @@ -692,6 +694,7 @@ void QSGPlainTexture::bind() qint64 convertTime = 0; if (profileFrames) convertTime = qsg_renderer_timer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare); updateBindOptions(m_dirty_bind_options); @@ -734,12 +737,14 @@ void QSGPlainTexture::bind() qint64 swizzleTime = 0; if (profileFrames) swizzleTime = qsg_renderer_timer.nsecsElapsed(); + Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare); 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); if (mipmapFiltering() != QSGTexture::None) { funcs->glGenerateMipmap(GL_TEXTURE_2D); @@ -762,13 +767,7 @@ void QSGPlainTexture::bind() int((mipmapTime - uploadTime)/1000000), m_texture_size != m_image.size() ? " (scaled to GL_MAX_TEXTURE_SIZE)" : ""); } - - Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphTexturePrepare, ( - bindTime, - convertTime - bindTime, - swizzleTime - convertTime, - uploadTime - swizzleTime, - qsg_renderer_timer.nsecsElapsed() - uploadTime)); + Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTexturePrepare); m_texture_rect = QRectF(0, 0, 1, 1); diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp index 3a84bf6219..be24ebe76d 100644 --- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp @@ -99,9 +99,12 @@ void QSGVertexColorMaterialShader::initialize() The geometry to be rendered with vertex color must have the following layout. Attribute position 0 must contain vertices. Attribute position 1 must contain colors, a tuple of 4 values with RGBA layout. Both floats in the range of 0 to 1 and unsigned bytes in - the range 0 to 255 are valid for the color values. The - QSGGeometry::defaultAttributes_ColoredPoint2D() constructs an attribute set - compatible with this material. + the range 0 to 255 are valid for the color values. + + \note The rendering pipeline expects pixels with premultiplied alpha. + + QSGGeometry::defaultAttributes_ColoredPoint2D() can be used to construct an attribute + set that is compatible with this material. The vertex color material respects both current opacity and current matrix when updating it's rendering state. diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 22ed9b7486..a2a8ef03c7 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -831,8 +831,10 @@ void QQuickPixmapStore::unreferencePixmap(QQuickPixmapData *data) shrinkCache(-1); // Shrink the cache in case it has become larger than cache_limit - if (m_timerId == -1 && m_unreferencedPixmaps && !m_destroying) + if (m_timerId == -1 && m_unreferencedPixmaps + && !m_destroying && !QCoreApplication::closingDown()) { m_timerId = startTimer(CACHE_EXPIRE_TIME * 1000); + } } void QQuickPixmapStore::referencePixmap(QQuickPixmapData *data) diff --git a/src/quick/util/qquickprofiler.cpp b/src/quick/util/qquickprofiler.cpp index 3b34b7550b..c4441ed5dd 100644 --- a/src/quick/util/qquickprofiler.cpp +++ b/src/quick/util/qquickprofiler.cpp @@ -80,7 +80,7 @@ void QQuickProfilerData::toByteArrays(QList<QByteArray> &messages) const // RendererFrame: preprocessTime, updateTime, bindingTime, renderTime case QQuickProfiler::SceneGraphRendererFrame: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break; // AdaptationLayerFrame: glyphCount (which is an integer), glyphRenderTime, glyphStoreTime - case QQuickProfiler::SceneGraphAdaptationLayerFrame: ds << subtime_1 << subtime_2 << subtime_3; break; + case QQuickProfiler::SceneGraphAdaptationLayerFrame: ds << subtime_3 << subtime_1 << subtime_2; break; // ContextFrame: compiling material time case QQuickProfiler::SceneGraphContextFrame: ds << subtime_1; break; // RenderLoop: syncTime, renderTime, swapTime diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h index 62e23cd393..ea37558741 100644 --- a/src/quick/util/qquickprofiler_p.h +++ b/src/quick/util/qquickprofiler_p.h @@ -51,6 +51,7 @@ #include <QUrl> #include <QSize> #include <QMutex> +#include <QThreadStorage> QT_BEGIN_NAMESPACE @@ -63,9 +64,38 @@ QT_BEGIN_NAMESPACE #define Q_QUICK_PROFILE(feature, Method)\ Q_QUICK_PROFILE_IF_ENABLED(feature, QQuickProfiler::Method) -#define Q_QUICK_SG_PROFILE(Type, Params)\ +#define Q_QUICK_SG_PROFILE_START(Type)\ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\ - (QQuickProfiler::sceneGraphFrame<Type> Params)) + (QQuickProfiler::startSceneGraphFrame<Type>())) + +#define Q_QUICK_SG_PROFILE_RECORD(Type)\ + Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\ + (QQuickProfiler::recordSceneGraphTimestamp<Type>())) + +#define Q_QUICK_SG_PROFILE_SKIP(Type, Skip)\ + Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\ + (QQuickProfiler::skipSceneGraphTimestamps<Type, Skip>())) + +#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) \ + Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\ + (QQuickProfiler::reportSceneGraphFrame<Type1, true, Type2>())) + +#define Q_QUICK_SG_PROFILE_REPORT(Type)\ + Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\ + (QQuickProfiler::reportSceneGraphFrame<Type, false>())) + +#define Q_QUICK_SG_PROFILE_END(Type)\ + Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\ + (QQuickProfiler::reportSceneGraphFrame<Type, true>())) + +#define Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(Type, Payload)\ + Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\ + (QQuickProfiler::reportSceneGraphFrame<Type, true>(Payload))) + #define Q_QUICK_INPUT_PROFILE(Method)\ Q_QUICK_PROFILE(QQuickProfiler::ProfileInputEvents, Method) @@ -136,6 +166,39 @@ struct Q_AUTOTEST_EXPORT QQuickProfilerData Q_DECLARE_TYPEINFO(QQuickProfilerData, Q_MOVABLE_TYPE); +class QQuickProfilerSceneGraphData : public QQmlProfilerDefinitions { +private: + static const uint s_numSceneGraphTimings = 5; + + template<uint size> + struct TimingData { + qint64 values[size][s_numSceneGraphTimings + 1]; + int offsets[size]; + }; + + QThreadStorage<TimingData<NumRenderThreadFrameTypes> > renderThreadTimings; + TimingData<NumGUIThreadFrameTypes> guiThreadTimings; + +public: + template<SceneGraphFrameType type> + qint64 *timings() + { + if (type < NumRenderThreadFrameTypes) + return renderThreadTimings.localData().values[type]; + 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 QQmlAbstractProfilerAdapter { Q_OBJECT public: @@ -163,12 +226,62 @@ public: } } + template<SceneGraphFrameType FrameType1, SceneGraphFrameType FrameType2> + 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]; + } + template<SceneGraphFrameType FrameType> - static void sceneGraphFrame(qint64 value1, qint64 value2 = -1, qint64 value3 = -1, - qint64 value4 = -1, qint64 value5 = -1) + 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() + { + s_instance->m_sceneGraphData.timings<FrameType>() + [++s_instance->m_sceneGraphData.offset<FrameType>()] = s_instance->timestamp(); + } + + template<SceneGraphFrameType FrameType, uint Skip> + static void skipSceneGraphTimestamps() + { + qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>(); + const qint64 last = timings[s_instance->m_sceneGraphData.offset<FrameType>()]; + for (uint i = 0; i < Skip; ++i) + timings[++s_instance->m_sceneGraphData.offset<FrameType>()] = last; + } + + template<SceneGraphFrameType FrameType, bool Record> + static void reportSceneGraphFrame(quint64 payload = -1) + { + qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>(); + int &offset = s_instance->m_sceneGraphData.offset<FrameType>(); + if (Record) + timings[++offset] = 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)); + } + + template<SceneGraphFrameType FrameType, bool Record, SceneGraphFrameType SwitchTo> + static void reportSceneGraphFrame(quint64 payload = -1) { - s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), 1 << SceneGraphFrame, - 1 << FrameType, value1, value2, value3, value4, value5)); + reportSceneGraphFrame<FrameType, Record>(payload); + s_instance->m_sceneGraphData.offset<SwitchTo>() = 0; + s_instance->m_sceneGraphData.timings<SwitchTo>()[0] = + s_instance->m_sceneGraphData.timings<FrameType>() + [s_instance->m_sceneGraphData.offset<FrameType>()]; } template<PixmapEventType PixmapState> @@ -215,6 +328,7 @@ protected: QMutex m_dataMutex; QElapsedTimer m_timer; QVarLengthArray<QQuickProfilerData> m_data; + QQuickProfilerSceneGraphData m_sceneGraphData; QQuickProfiler(QQmlProfilerService *service); diff --git a/src/quickwidgets/qquickwidget.h b/src/quickwidgets/qquickwidget.h index 530a523470..87f688c11a 100644 --- a/src/quickwidgets/qquickwidget.h +++ b/src/quickwidgets/qquickwidget.h @@ -99,6 +99,7 @@ Q_SIGNALS: void sceneGraphError(QQuickWindow::SceneGraphError error, const QString &message); private Q_SLOTS: + // ### Qt 6: make these truly private slots through Q_PRIVATE_SLOT void continueExecute(); void createFramebufferObject(); void destroyFramebufferObject(); diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.10.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.10.expect new file mode 100644 index 0000000000..b099ed205e --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.10.expect @@ -0,0 +1,10 @@ +OPTIONS /testdocument.html HTTP/1.1 +Accept-Language: en-US,* +Content-Type: text/plain;charset=UTF-8 +Content-Length: 12 +Connection: Keep-Alive +Accept-Encoding: gzip, deflate +User-Agent: Mozilla/5.0 +Host: 127.0.0.1:14445 + +My Sent Data
\ No newline at end of file diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.2.reply b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.2.reply new file mode 100644 index 0000000000..b4f5ecd429 --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.2.reply @@ -0,0 +1,3 @@ +HTTP/1.1 200 OK +Allow: GET,HEAD,POST,OPTIONS,TRACE +Content-Length: 0 diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.8.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.8.expect new file mode 100644 index 0000000000..8462c40ba1 --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.8.expect @@ -0,0 +1,7 @@ +OPTIONS / HTTP/1.1 +Content-Length: 0 +Connection: Keep-Alive +Accept-Encoding: gzip, deflate +Accept-Language: en-US,* +User-Agent: Mozilla/5.0 +Host: 127.0.0.1:14445 diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.8.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.8.qml new file mode 100644 index 0000000000..bda5871a18 --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.8.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 + +QtObject { + property string url + + property bool dataOK: false + property bool headerOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("OPTIONS", url); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + headerOK = (x.getResponseHeader("Allow") == "GET,HEAD,POST,OPTIONS,TRACE"); + } else if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == ""); + } + } + + x.send(); + } +} diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.9.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.9.expect new file mode 100644 index 0000000000..02af8c99b8 --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.9.expect @@ -0,0 +1,7 @@ +OPTIONS /testdocument.html HTTP/1.1 +Content-Length: 0 +Connection: Keep-Alive +Accept-Encoding: gzip, deflate +Accept-Language: en-US,* +User-Agent: Mozilla/5.0 +Host: 127.0.0.1:14445 diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.9.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.9.qml new file mode 100644 index 0000000000..834916f96c --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.9.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 + +QtObject { + property string url + + property bool dataOK: false + property bool headerOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("OPTIONS", url); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + headerOK = (x.getResponseHeader("Allow") == "GET,HEAD,POST,OPTIONS,TRACE"); + } else if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == ""); + } + } + + x.send("My Sent Data"); + } +} diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp index 9267c187bb..441893a853 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp +++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp @@ -73,6 +73,8 @@ private slots: void send_ignoreData(); void send_withdata(); void send_withdata_data(); + void send_options(); + void send_options_data(); void abort(); void abort_unsent(); void abort_opened(); @@ -552,6 +554,47 @@ void tst_qqmlxmlhttprequest::send_withdata_data() QTest::newRow("Correct content-type - no charset") << "send_data.1.expect" << "send_data.7.qml"; } +void tst_qqmlxmlhttprequest::send_options() +{ + QFETCH(QString, url_suffix); + QFETCH(QString, file_expected); + QFETCH(QString, file_qml); + QFETCH(QString, file_reply); + + TestHTTPServer server; + QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString())); + QVERIFY(server.wait(testFileUrl(file_expected), + testFileUrl(file_reply), + testFileUrl("testdocument.html"))); + + QQmlComponent component(&engine, testFileUrl(file_qml)); + QScopedPointer<QObject> object(component.beginCreate(engine.rootContext())); + QVERIFY(!object.isNull()); + QString url = "http://127.0.0.1:14445"; + if (url_suffix != "/") + url.append("/"); + if (!url_suffix.isEmpty()) + url.append(url_suffix); + object->setProperty("url", url); + component.completeCreate(); + + QTRY_VERIFY(object->property("dataOK").toBool()); + QTRY_VERIFY(object->property("headerOK").toBool()); +} + +void tst_qqmlxmlhttprequest::send_options_data() +{ + QTest::addColumn<QString>("url_suffix"); + QTest::addColumn<QString>("file_expected"); + QTest::addColumn<QString>("file_qml"); + QTest::addColumn<QString>("file_reply"); + + QTest::newRow("OPTIONS (no data, no resource, no path)") << "" << "send_data.8.expect" << "send_data.8.qml" << "send_data.2.reply"; + QTest::newRow("OPTIONS (no data, no resource, path- \"/\")") << "/" << "send_data.8.expect" << "send_data.8.qml" << "send_data.2.reply"; + QTest::newRow("OPTIONS (no data, with resource)") << "testdocument.html" << "send_data.9.expect" << "send_data.8.qml" << "send_data.2.reply"; + QTest::newRow("OPTIONS (with data)") << "testdocument.html" << "send_data.10.expect" << "send_data.9.qml" << "send_data.2.reply"; +} + // Test abort() has no effect in unsent state void tst_qqmlxmlhttprequest::abort_unsent() { diff --git a/tests/auto/quick/qquickanimatedsprite/data/largeAnimation.qml b/tests/auto/quick/qquickanimatedsprite/data/largeAnimation.qml new file mode 100644 index 0000000000..adcbaeb74f --- /dev/null +++ b/tests/auto/quick/qquickanimatedsprite/data/largeAnimation.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + color: "white" + width: 512 + height: 320 + + AnimatedSprite { + anchors.centerIn: parent + objectName: "sprite" + source: "image://test/largeAnimation.png" + frameCount: 40 + loops: 3 + frameSync: true + running: false + width: 512 + height: 64 + frameWidth: 512 + frameHeight: 64 + + } +} diff --git a/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro b/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro index dd56991812..3e47844feb 100644 --- a/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro +++ b/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro @@ -12,3 +12,6 @@ CONFIG += parallel_test QT += core-private gui-private qml-private quick-private network testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +OTHER_FILES += \ + data/largeAnimation.qml diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index b1b02d5d69..ed97123644 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -35,6 +35,7 @@ #include <QtQuick/qquickview.h> #include <private/qabstractanimation_p.h> #include <private/qquickanimatedsprite_p.h> +#include <QtGui/qpainter.h> class tst_qquickanimatedsprite : public QQmlDataTest { @@ -47,6 +48,8 @@ private slots: void test_properties(); void test_runningChangedSignal(); void test_frameChangedSignal(); + void test_largeAnimation_data(); + void test_largeAnimation(); }; void tst_qquickanimatedsprite::initTestCase() @@ -103,31 +106,159 @@ void tst_qquickanimatedsprite::test_runningChangedSignal() delete window; } +template <typename T> +static bool isWithinRange(T min, T value, T max) +{ + Q_ASSERT(min < max); + return min <= value && value <= max; +} + void tst_qquickanimatedsprite::test_frameChangedSignal() { QQuickView *window = new QQuickView(0); window->setSource(testFileUrl("frameChange.qml")); window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window)); QVERIFY(window->rootObject()); QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); + QSignalSpy frameChangedSpy(sprite, SIGNAL(currentFrameChanged(int))); QVERIFY(sprite); + QVERIFY(QTest::qWaitForWindowExposed(window)); QVERIFY(!sprite->running()); QVERIFY(!sprite->paused()); QCOMPARE(sprite->loops(), 3); QCOMPARE(sprite->frameCount(), 6); + QCOMPARE(frameChangedSpy.count(), 0); - QSignalSpy frameChangedSpy(sprite, SIGNAL(currentFrameChanged(int))); + frameChangedSpy.clear(); sprite->setRunning(true); - QTRY_COMPARE(frameChangedSpy.count(), 3*6); QTRY_VERIFY(!sprite->running()); + QCOMPARE(frameChangedSpy.count(), 3*6 + 1); + + int prevFrame = -1; + int loopCounter = 0; + int maxFrame = 0; + while (!frameChangedSpy.isEmpty()) { + QList<QVariant> args = frameChangedSpy.takeFirst(); + int frame = args.first().toInt(); + if (frame < prevFrame) { + ++loopCounter; + } else { + QVERIFY(frame > prevFrame); + } + maxFrame = qMax(frame, maxFrame); + prevFrame = frame; + } + QCOMPARE(loopCounter, 3); + + delete window; +} + +void tst_qquickanimatedsprite::test_largeAnimation_data() +{ + QTest::addColumn<bool>("frameSync"); + + QTest::newRow("frameSync") << true; + QTest::newRow("no_frameSync") << false; + +} + +class AnimationImageProvider : public QQuickImageProvider +{ +public: + AnimationImageProvider() + : QQuickImageProvider(QQuickImageProvider::Pixmap) + { + } + + QPixmap requestPixmap(const QString &/*id*/, QSize *size, const QSize &requestedSize) + { + if (requestedSize.isValid()) + qWarning() << "requestPixmap called with requestedSize of" << requestedSize; + // 40 frames. + const int nFrames = 40; // 40 is good for texture max width of 4096, 64 is good for 16384 + + const int frameWidth = 512; + const int frameHeight = 64; + + const QSize pixSize(frameWidth, nFrames * frameHeight); + QPixmap pixmap(pixSize); + pixmap.fill(); + for (int i = 0; i < nFrames; ++i) { + QImage frame(frameWidth, frameHeight, QImage::Format_ARGB32_Premultiplied); + frame.fill(Qt::white); + QPainter p1(&frame); + p1.setRenderHint(QPainter::Antialiasing, true); + QRect r(0,0, frameWidth, frameHeight); + p1.setBrush(QBrush(Qt::red, Qt::SolidPattern)); + p1.drawPie(r, i*360*16/nFrames, 90*16); + p1.drawText(r, QString::number(i)); + p1.end(); + + QPainter p2(&pixmap); + p2.drawImage(0, i * frameHeight, frame); + } + + if (size) + *size = pixSize; + return pixmap; + } +}; + +void tst_qquickanimatedsprite::test_largeAnimation() +{ + QFETCH(bool, frameSync); + + QQuickView *window = new QQuickView(0); + window->engine()->addImageProvider(QLatin1String("test"), new AnimationImageProvider); + window->setSource(testFileUrl("largeAnimation.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QVERIFY(window->rootObject()); + QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); + + QVERIFY(sprite); + + QVERIFY(!sprite->running()); + QVERIFY(!sprite->paused()); + QCOMPARE(sprite->loops(), 3); + QCOMPARE(sprite->frameCount(), 40); + sprite->setProperty("frameSync", frameSync); + if (!frameSync) + sprite->setProperty("frameDuration", 30); + + QSignalSpy frameChangedSpy(sprite, SIGNAL(currentFrameChanged(int))); + sprite->setRunning(true); + QTRY_VERIFY_WITH_TIMEOUT(!sprite->running(), 100000 /* make sure we wait until its done*/ ); + if (frameSync) + QVERIFY(isWithinRange(3*40, frameChangedSpy.count(), 3*40 + 1)); + int prevFrame = -1; + int loopCounter = 0; + int maxFrame = 0; + while (!frameChangedSpy.isEmpty()) { + QList<QVariant> args = frameChangedSpy.takeFirst(); + int frame = args.first().toInt(); + if (frame < prevFrame) { + ++loopCounter; + } else { + QVERIFY(frame > prevFrame); + } + maxFrame = qMax(frame, maxFrame); + prevFrame = frame; + } + int maxTextureSize; + ::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); + maxTextureSize /= 512; + QVERIFY(maxFrame > maxTextureSize); // make sure we go beyond the texture width limitation + QCOMPARE(loopCounter, sprite->loops()); delete window; } + QTEST_MAIN(tst_qquickanimatedsprite) #include "tst_qquickanimatedsprite.moc" diff --git a/tests/auto/quick/qquickgridview/data/resizegrid.qml b/tests/auto/quick/qquickgridview/data/resizegrid.qml index 7ea2f120e8..75f1d77f10 100644 --- a/tests/auto/quick/qquickgridview/data/resizegrid.qml +++ b/tests/auto/quick/qquickgridview/data/resizegrid.qml @@ -2,6 +2,8 @@ import QtQuick 2.0 Rectangle { id: root + width: 260 + height: 320 Component { id: myDelegate diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index b65aad543d..33008a9d1b 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -3707,6 +3707,7 @@ void tst_QQuickGridView::resizeGrid() ctxt->setContextProperty("testRightToLeft", layoutDirection == Qt::RightToLeft); ctxt->setContextProperty("testBottomToTop", verticalLayoutDirection == QQuickGridView::BottomToTop); window->setSource(testFileUrl("resizegrid.qml")); + QQuickViewTestUtil::centerOnScreen(window, window->size()); window->show(); qApp->processEvents(); diff --git a/tests/benchmarks/qml/compilation/data/BoomBlock.qml b/tests/benchmarks/qml/compilation/data/BoomBlock.qml index e351b8a227..68cf805088 100644 --- a/tests/benchmarks/qml/compilation/data/BoomBlock.qml +++ b/tests/benchmarks/qml/compilation/data/BoomBlock.qml @@ -32,18 +32,22 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 1.0 +import QtQuick.Particles 2.0 Item { id: block property bool dying: false property bool spawned: false property int type: 0 - property int targetX: 0 - property int targetY: 0 + property ParticleSystem particleSystem - SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 } - SpringFollow on y { to: targetY; spring: 2; damping: 0.2 } + Behavior on x { + enabled: spawned; + SpringAnimation{ spring: 2; damping: 0.2 } + } + Behavior on y { + SpringAnimation{ spring: 2; damping: 0.2 } + } Image { id: img @@ -60,26 +64,28 @@ Item { Behavior on opacity { NumberAnimation { duration: 200 } } anchors.fill: parent } - - Particles { + Emitter { id: particles - - width: 1; height: 1 - anchors.centerIn: parent - - emissionRate: 0 - lifeSpan: 700; lifeSpanDeviation: 600 - angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation: 30 - source: { + system: particleSystem + group: { if(type == 0){ - "pics/redStar.png"; + "red"; } else if (type == 1) { - "pics/blueStar.png"; + "blue"; } else { - "pics/greenStar.png"; + "green"; } } + anchors.fill: parent + + velocity: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60} + shape: EllipseShape{fill:true} + enabled: false; + lifeSpan: 700; lifeSpanVariation: 100 + emitRate: 1000 + maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number) + size: 28 + endSize: 14 } states: [ @@ -90,7 +96,7 @@ Item { State { name: "DeathState"; when: dying == true - StateChangeScript { script: particles.burst(50); } + StateChangeScript { script: particles.pulse(0.1); } PropertyChanges { target: img; opacity: 0 } StateChangeScript { script: block.destroy(1000); } } diff --git a/tests/benchmarks/qml/compilation/tst_compilation.cpp b/tests/benchmarks/qml/compilation/tst_compilation.cpp index 3a03972ee6..5c7a8ff58c 100644 --- a/tests/benchmarks/qml/compilation/tst_compilation.cpp +++ b/tests/benchmarks/qml/compilation/tst_compilation.cpp @@ -84,7 +84,7 @@ void tst_compilation::boomblock() QBENCHMARK { QQmlComponent c(&engine); c.setData(data, QUrl()); -// QVERIFY(c.isReady()); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); } } |