#2 Add patches to backport fixes of QTBUG-65789 and QTBUG-67019 needed by GCompris-qt
Merged 5 years ago by rdieter. Opened 5 years ago by eclipseo.
Unknown source f28  into  f28

file modified
+12 -1
@@ -14,7 +14,7 @@

  Summary: Qt5 - QtDeclarative component

  Name:    qt5-%{qt_module}

  Version: 5.10.1

- Release: 5%{?dist}

+ Release: 6%{?dist}

  

  # See LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt, for details

  License: LGPLv2 with exceptions or GPLv3 with exceptions
@@ -51,6 +51,12 @@

  # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=792594

  Patch202: http://sources.debian.net/data/main/q/qtdeclarative-opensource-src/5.9.0~beta3-2/debian/patches/Do-not-make-lack-of-SSE2-support-on-x86-32-fatal.patch

  

+ # https://bugreports.qt.io/browse/QTBUG-65789

+ Patch203: https://github.com/qt/qtdeclarative/commit/602a6589.patch#/qtdeclarative-qtbug65789.patch

+ # https://bugreports.qt.io/browse/QTBUG-67019

+ # https://github.com/qt/qtdeclarative/commit/b1243b8c.patch without binary data

+ Patch204: qtdeclarative-qtbug67019.patch

+ 

  # filter qml provides

  %global __provides_exclude_from ^%{_qt5_archdatadir}/qml/.*\\.so$

  
@@ -113,6 +119,8 @@

  %patch201 -p0 -b .kdebug346118

  %patch202 -p1 -b .no_sse2_non_fatal

  

+ %patch203 -p1 -b .qtbug65789

+ %patch204 -p1 -b .qtbug67019

  

  %build

  %if 0%{?nosse2_hack}
@@ -238,6 +246,9 @@

  

  

  %changelog

+ * Sat Jun 30 2018 Robert-André Mauchin <zebob.m@gmail.com> - 5.10.1-6

+ - Add patches to backport fixes of QTBUG-65789 and QTBUG-67019 needed by GCompris-qt

+ 

  * Tue Apr 03 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.10.1-5

  - pull in candidate memleak fix (review#224684)

  

@@ -0,0 +1,45 @@

+ From 602a6589a1c8d52a3a1d9075528bc16d6e527818 Mon Sep 17 00:00:00 2001

+ From: Andy Shaw <andy.shaw@qt.io>

+ Date: Tue, 20 Feb 2018 06:36:59 +0100

+ Subject: [PATCH] Image: respect aspect ratio of an SVG when width or height is

+  zero

+ 

+ This amends f42f1366dcd4b070c69c9e7fe42a704ef23da14d

+ 

+ Task-number: QTBUG-65789

+ Change-Id: I1db05259f0aeb3310bbaf5ea03be52cbd243d115

+ Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>

+ ---

+  src/quick/util/qquickimageprovider.cpp           | 2 +-

+  tests/auto/quick/qquickimage/tst_qquickimage.cpp | 5 +++++

+  2 files changed, 6 insertions(+), 1 deletion(-)

+ 

+ diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp

+ index a1513336a5..4003b88d09 100644

+ --- a/src/quick/util/qquickimageprovider.cpp

+ +++ b/src/quick/util/qquickimageprovider.cpp

+ @@ -684,7 +684,7 @@ QSize QQuickImageProviderWithOptions::loadSize(const QSize &originalSize, const

+  

+      const bool preserveAspectCropOrFit = options.preserveAspectRatioCrop() || options.preserveAspectRatioFit();

+  

+ -    if (!preserveAspectCropOrFit && (format == "svg" || format == "svgz"))

+ +    if (!preserveAspectCropOrFit && (format == "svg" || format == "svgz") && !requestedSize.isEmpty())

+          return requestedSize;

+  

+      qreal ratio = 0.0;

+ diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp

+ index 783e4aab4c..ec0ec6c2b6 100644

+ --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp

+ +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp

+ @@ -418,6 +418,11 @@ void tst_qquickimage::svg()

+  

+      QCOMPARE(obj->width(), 200.0);

+      QCOMPARE(obj->height(), 200.0);

+ +    obj->setSourceSize(QSize(100,0));

+ +    QCOMPARE(obj->width(), 100.0);

+ +    // Due to aspect ratio calculations we can't get a precise

+ +    // check for all setups, so we allow a small margin of error

+ +    QVERIFY(qAbs(obj->height() - 141) < 1);

+      delete obj;

+  }

+  

@@ -0,0 +1,110 @@

+ From b1243b8c9ea0add1b7548428c8b0fcb8ee3ac71a Mon Sep 17 00:00:00 2001

+ From: Andy Shaw <andy.shaw@qt.io>

+ Date: Wed, 14 Mar 2018 09:42:03 +0100

+ Subject: [PATCH] Scale up SVG images if source size is larger than original

+  size

+ 

+ Since SVG images can be scaled up without any loss of quality then we

+ should allow this to happen even though it is not done for other image

+ formats. This restores the 5.9.x behavior for SVG images.

+ 

+ Additionally the manual test is updated to showcase an embedded image

+ inside a SVG one to indicate this is continuing to work as before too.

+ 

+ Task-number: QTBUG-67019

+ Change-Id: Ia719899937f8146e8fab50aa85adf18e2f79aa98

+ Reviewed-by: Evangelos Foutras <evangelos@foutrelis.com>

+ Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>

+ ---

+  src/quick/util/qquickimageprovider.cpp           |   9 ++++++---

+  tests/auto/quick/qquickimage/tst_qquickimage.cpp |   6 ++++++

+  tests/manual/imagehandler/embeddedimage.svg      |  10 ++++++++++

+  tests/manual/imagehandler/heart.png              | Bin 0 -> 15194 bytes

+  tests/manual/imagehandler/main.qml               |   6 +++++-

+  5 files changed, 27 insertions(+), 4 deletions(-)

+  create mode 100644 tests/manual/imagehandler/embeddedimage.svg

+  create mode 100644 tests/manual/imagehandler/heart.png

+ 

+ diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp

+ index 1a13f6395a..2bb2af4fc0 100644

+ --- a/src/quick/util/qquickimageprovider.cpp

+ +++ b/src/quick/util/qquickimageprovider.cpp

+ @@ -680,15 +680,18 @@ QSize QQuickImageProviderWithOptions::loadSize(const QSize &originalSize, const

+          return res;

+  

+      const bool preserveAspectCropOrFit = options.preserveAspectRatioCrop() || options.preserveAspectRatioFit();

+ +    const bool formatIsSvg = (format == "svg" || format == "svgz");

+  

+ -    if (!preserveAspectCropOrFit && (format == "svg" || format == "svgz") && !requestedSize.isEmpty())

+ +    if (!preserveAspectCropOrFit && formatIsSvg && !requestedSize.isEmpty())

+          return requestedSize;

+  

+      qreal ratio = 0.0;

+ -    if (requestedSize.width() && (preserveAspectCropOrFit || requestedSize.width() < originalSize.width())) {

+ +    if (requestedSize.width() && (preserveAspectCropOrFit || formatIsSvg ||

+ +                                  requestedSize.width() < originalSize.width())) {

+          ratio = qreal(requestedSize.width()) / originalSize.width();

+      }

+ -    if (requestedSize.height() && (preserveAspectCropOrFit || requestedSize.height() < originalSize.height())) {

+ +    if (requestedSize.height() && (preserveAspectCropOrFit || formatIsSvg ||

+ +                                   requestedSize.height() < originalSize.height())) {

+          qreal hr = qreal(requestedSize.height()) / originalSize.height();

+          if (ratio == 0.0)

+              ratio = hr;

+ diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp

+ index 3613ba6d87..d1f46a3912 100644

+ --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp

+ +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp

+ @@ -445,6 +445,12 @@ void tst_qquickimage::svg()

+      // Due to aspect ratio calculations we can't get a precise

+      // check for all setups, so we allow a small margin of error

+      QVERIFY(qAbs(obj->height() - 141) < 1);

+ +

+ +    // Setting it to a size bigger than the actual file, SVG formats

+ +    // can scale up although other image formats cannot

+ +    obj->setSourceSize(QSize(800,0));

+ +    QCOMPARE(obj->width(), 800.0);

+ +    QVERIFY(qAbs(obj->height() - 1131) < 1);

+      delete obj;

+  }

+  

+ diff --git a/tests/manual/imagehandler/embeddedimage.svg b/tests/manual/imagehandler/embeddedimage.svg

+ new file mode 100644

+ index 0000000000..f952640822

+ --- /dev/null

+ +++ b/tests/manual/imagehandler/embeddedimage.svg

+ @@ -0,0 +1,10 @@

+ +<?xml version="1.0"?>

+ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"

+ +     version="1.2" baseProfile="tiny">

+ +

+ +  <desc>This document has a reference to an external image</desc>

+ +

+ +  <image x="200" y="200" width="100" height="100" xlink:href="heart.png">

+ +    <title>External image</title>

+ +  </image>

+ +</svg>

+ diff --git a/tests/manual/imagehandler/main.qml b/tests/manual/imagehandler/main.qml

+ index 55e5b89cae..ec474e62ce 100644

+ --- a/tests/manual/imagehandler/main.qml

+ +++ b/tests/manual/imagehandler/main.qml

+ @@ -41,6 +41,10 @@ Window {

+          width: parent.width

+          sourceSize.height: height

+          sourceSize.width: width

+ +        MouseArea {

+ +            anchors.fill: parent

+ +            onClicked: svgImage.source = "embeddedimage.svg"

+ +        }

+      }

+      ListModel {

+          id: imageFillModeModel

+ @@ -57,7 +61,7 @@ Window {

+          height: 75

+          anchors.bottom: parent.bottom

+          Text {

+ -            text: "Click the options below to change the fill mode"

+ +            text: "Click the options below to change the fill mode.<br>Click the image to change the used image."

+              font.pointSize: 16

+          }

+  

GCompris-qt is not working as expected, missing its SVG icons as reported by the maintainer Andrea Musuruane on the mailing list:

https://lists.fedorahosted.org/archives/list/devel@lists.fedoraproject.org/thread/PSYB66PFPF5UIMV7POW23JCB5GLKON2P/

This is caused by two bugs:
- QTBUG-65789: https://bugreports.qt.io/browse/QTBUG-65789 solved by this commit https://github.com/qt/qtdeclarative/commit/602a6589
- QTBUG-67019: https://bugreports.qt.io/browse/QTBUG-67019 solved by this commit https://github.com/qt/qtdeclarative/commit/b1243b8c

This PR backports these commits to 5.10.1 in order for Gcompris-qt to work as expected. I have tested it on Fedora 28.

Pull-Request has been merged by rdieter

5 years ago