From 4c065b497e63832cf610cc06d67a7b40965154fb Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 6 Jan 2015 19:29:08 +0100 Subject: qmltime: Remove widgets dependency. To do this easily while retaining the meaning of the -parent flag, we add a private export to QQuickView so that we can set the root object. Change-Id: Iabb2b998816a6fdfcc8417f679c96f04910b8202 Reviewed-by: Simon Hausmann Reviewed-by: Shawn Rutledge Reviewed-by: Michael Brasser --- src/quick/items/qquickview_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h index 6f970f959d..71b39f5b0f 100644 --- a/src/quick/items/qquickview_p.h +++ b/src/quick/items/qquickview_p.h @@ -70,7 +70,7 @@ class QQmlError; class QQuickItem; class QQmlComponent; -class QQuickViewPrivate : public QQuickWindowPrivate, +class Q_QUICK_PRIVATE_EXPORT QQuickViewPrivate : public QQuickWindowPrivate, public QQuickItemChangeListener { Q_DECLARE_PUBLIC(QQuickView) -- cgit v1.2.3 From fe10cee6265f068bf0da03895c0c7c5680dc36a5 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 22 Mar 2016 10:46:10 +0100 Subject: Fix Image.Pad on high DPI Take device pixel ratio into account (pixWidth and pixHeight are scaled) while calculating source and target rects for QQuickImage::Pad. Change-Id: I4a8b4fc305d0af93921bca900c683927d6bfd0e3 Task-number: QTBUG-52043 Reviewed-by: Mitch Curtis Reviewed-by: Robin Burchell --- src/quick/items/qquickimage.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 20f4551af9..1e28af03c6 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -691,17 +691,17 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) break; case Pad: - qreal w = qMin(qreal(d->pix.width()), width()); - qreal h = qMin(qreal(d->pix.height()), height()); - qreal x = (d->pix.width() > width()) ? -xOffset : 0; - qreal y = (d->pix.height() > height()) ? -yOffset : 0; + qreal w = qMin(qreal(pixWidth), width()); + qreal h = qMin(qreal(pixHeight), height()); + qreal x = (pixWidth > width()) ? -xOffset : 0; + qreal y = (pixHeight > height()) ? -yOffset : 0; targetRect = QRectF(x + xOffset, y + yOffset, w, h); sourceRect = QRectF(x, y, w, h); break; }; - qreal nsWidth = (hWrap == QSGTexture::Repeat) ? d->pix.width() / d->devicePixelRatio : d->pix.width(); - qreal nsHeight = (vWrap == QSGTexture::Repeat) ? d->pix.height() / d->devicePixelRatio : d->pix.height(); + qreal nsWidth = (hWrap == QSGTexture::Repeat || d->fillMode == Pad) ? d->pix.width() / d->devicePixelRatio : d->pix.width(); + qreal nsHeight = (vWrap == QSGTexture::Repeat || d->fillMode == Pad) ? d->pix.height() / d->devicePixelRatio : d->pix.height(); QRectF nsrect(sourceRect.x() / nsWidth, sourceRect.y() / nsHeight, sourceRect.width() / nsWidth, -- cgit v1.2.3 From cef27bf90cbb8d4e6f36f6b77fa5efb361e01ad2 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 29 Mar 2016 14:40:23 +0200 Subject: Fix crash in hasAtlasTexture Check for the QSGTextureProvider not being 0 before asking for its texture, we are doing the same in the loop of QQuickShaderEffectMaterial::compare so it was forgotten to do it here. Valgrind trace of the crash i get without it ==26317== Invalid read of size 8 ==26317== at 0x652B73A: hasAtlasTexture(QVector const&) (qquickshadereffectnode.cpp:49) ==26317== by 0x652BABC: QQuickShaderEffectMaterial::compare(QSGMaterial const*) const (qquickshadereffectnode.cpp:396) ==26317== by 0x63D1BF6: QSGBatchRenderer::Renderer::prepareOpaqueBatches() (qsgbatchrenderer.cpp:1525) ==26317== by 0x63DE7A7: QSGBatchRenderer::Renderer::render() (qsgbatchrenderer.cpp:2611) ==26317== by 0x63E9D3E: QSGRenderer::renderScene(QSGBindable const&) (qsgrenderer.cpp:208) ==26317== by 0x63EA58A: QSGRenderer::renderScene(unsigned int) (qsgrenderer.cpp:168) ==26317== by 0x63FAA7D: QSGRenderContext::renderNextFrame(QSGRenderer*, unsigned int) (qsgcontext.cpp:558) ==26317== by 0x644540A: QQuickWindowPrivate::renderSceneGraph(QSize const&) (qquickwindow.cpp:383) ==26317== by 0x641541A: QSGGuiThreadRenderLoop::renderWindow(QQuickWindow*) (qsgrenderloop.cpp:378) ==26317== by 0x6416520: QSGGuiThreadRenderLoop::event(QEvent*) (qsgrenderloop.cpp:474) ==26317== by 0x605F488: QCoreApplication::notify(QObject*, QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.5.1) ==26317== by 0x605F5BA: QCoreApplication::notifyInternal(QObject*, QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.5.1) ==26317== Address 0x0 is not stack'd, malloc'd or (recently) free'd Change-Id: I3b07450438d98910fbbff9f8b7a3d9d851ed4e5d Reviewed-by: Michael Brasser --- src/quick/items/qquickshadereffectnode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp index 954aa6c67b..95537fdefc 100644 --- a/src/quick/items/qquickshadereffectnode.cpp +++ b/src/quick/items/qquickshadereffectnode.cpp @@ -46,7 +46,7 @@ static bool hasAtlasTexture(const QVector &textureProvider { for (int i = 0; i < textureProviders.size(); ++i) { QSGTextureProvider *t = textureProviders.at(i); - if (t->texture() && t->texture()->isAtlasTexture()) + if (t && t->texture() && t->texture()->isAtlasTexture()) return true; } return false; -- cgit v1.2.3 From 07f2ce1827243a61f763801200987ddc85fb817b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 29 Mar 2016 21:56:46 +0200 Subject: Move Qt Quick resources under the :/qt-project.org/ directory Change-Id: I7c7745264ff66b7db042e19f6d44124fa78bb86c Reviewed-by: Robin Burchell Reviewed-by: Laszlo Agocs --- src/quick/items/items.qrc | 2 +- src/quick/items/qquickanimatedsprite.cpp | 4 ++-- src/quick/items/qquickshadereffect.cpp | 4 ++-- src/quick/items/qquickshadereffectnode.cpp | 4 ++-- src/quick/items/qquickspritesequence.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/items.qrc b/src/quick/items/items.qrc index 671d8acdbb..99f9b5224f 100644 --- a/src/quick/items/items.qrc +++ b/src/quick/items/items.qrc @@ -1,5 +1,5 @@ - + shaders/sprite.frag shaders/sprite.vert shaders/shadereffect.vert diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index d7f3f4f83b..44b5ff1e45 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -96,8 +96,8 @@ public: AnimatedSpriteMaterialData() : QSGMaterialShader() { - setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/items/shaders/sprite.vert")); - setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/items/shaders/sprite.frag")); + setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/items/shaders/sprite.vert")); + setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/items/shaders/sprite.frag")); } void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) Q_DECL_OVERRIDE diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 6cb9216955..47c67e0e1c 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -1027,12 +1027,12 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa Key s = m_common.source; QSGShaderSourceBuilder builder; if (s.sourceCode[Key::FragmentShader].isEmpty()) { - builder.appendSourceFile(QStringLiteral(":/items/shaders/shadereffect.frag")); + builder.appendSourceFile(QStringLiteral(":/qt-project.org/items/shaders/shadereffect.frag")); s.sourceCode[Key::FragmentShader] = builder.source(); builder.clear(); } if (s.sourceCode[Key::VertexShader].isEmpty()) { - builder.appendSourceFile(QStringLiteral(":/items/shaders/shadereffect.vert")); + builder.appendSourceFile(QStringLiteral(":/qt-project.org/items/shaders/shadereffect.vert")); s.sourceCode[Key::VertexShader] = builder.source(); } s.className = metaObject()->className(); diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp index 95537fdefc..df030d15a7 100644 --- a/src/quick/items/qquickshadereffectnode.cpp +++ b/src/quick/items/qquickshadereffectnode.cpp @@ -299,8 +299,8 @@ void QQuickCustomMaterialShader::compile() QSGShaderSourceBuilder::initializeProgramFromFiles( program(), - QStringLiteral(":/items/shaders/shadereffectfallback.vert"), - QStringLiteral(":/items/shaders/shadereffectfallback.frag")); + QStringLiteral(":/qt-project.org/items/shaders/shadereffectfallback.vert"), + QStringLiteral(":/qt-project.org/items/shaders/shadereffectfallback.frag")); #ifndef QT_NO_DEBUG for (int i = 0; i < attrCount; ++i) { diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp index 854582e58e..6327328f8a 100644 --- a/src/quick/items/qquickspritesequence.cpp +++ b/src/quick/items/qquickspritesequence.cpp @@ -95,8 +95,8 @@ public: SpriteSequenceMaterialData() : QSGMaterialShader() { - setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/items/shaders/sprite.vert")); - setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/items/shaders/sprite.frag")); + setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/items/shaders/sprite.vert")); + setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/items/shaders/sprite.frag")); } void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) Q_DECL_OVERRIDE -- cgit v1.2.3