Bug 412508 - Krita 4.2.7 fails to build with Qt 5.9
Summary: Krita 4.2.7 fails to build with Qt 5.9
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.2.7
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-01 13:54 UTC by Wolfgang Bauer
Modified: 2019-10-02 11:16 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bauer 2019-10-01 13:54:50 UTC
/home/abuild/rpmbuild/BUILD/krita-4.2.7/libs/flake/text/KoSvgTextShape.cpp:395:24: error: 'class QFontMetrics' has no member named 'horizontalAdvance'
         return metrics.horizontalAdvance(skippedChar);
                        ^~~~~~~~~~~~~~~~~

QFontMetrics::horizontalAdvance was introduced in Qt 5.11...
Comment 1 Wolfgang Bauer 2019-10-01 14:00:32 UTC
Introduced by https://cgit.kde.org/krita.git/commit/?h=krita/4.2&id=9604f0549d8b63d9e646853e9294a8cf450a96d2 .

This should fix it: (untested)
diff --git a/libs/flake/text/KoSvgTextShape.cpp b/libs/flake/text/KoSvgTextShape.cpp
index 6ad42a4..b558a44 100644
--- a/libs/flake/text/KoSvgTextShape.cpp
+++ b/libs/flake/text/KoSvgTextShape.cpp
@@ -381,7 +381,11 @@ private:
         KIS_SAFE_ASSERT_RECOVER_NOOP(skippedChar.isSpace() || !skippedChar.isPrint());
 
         QFontMetrics metrics(format.font());
+#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
         return metrics.horizontalAdvance(skippedChar);
+#else
+        return metrics.width(skippedChar);
+#endif
     }
 
     static QTextCharFormat formatForPos(int pos, const QVector<QTextLayout::FormatRange> &formats)
Comment 2 Halla Rempt 2019-10-01 14:03:56 UTC
I so wish people would build beta's... Then we would have caught this before I create the 4.2.7 tarball. I guess I'll do a 4.2.7.1 tarball now.
Comment 3 Halla Rempt 2019-10-01 14:04:16 UTC
Yes, I pushed that to the branch just now, too.
Comment 4 Wolfgang Bauer 2019-10-01 14:59:37 UTC
Confirmed, it builds fine now with 5.9.
Comment 5 Wolfgang Bauer 2019-10-01 16:11:53 UTC
The new 4.2.7.1 tarballs on download.kde.org are broken though, they only contain the translations...
Comment 6 Halla Rempt 2019-10-01 17:15:05 UTC
Argh, I shouldn't try to do releases on a long train trip. Fortunately, the tarballs weren't in the 4.2.7 folder yet, so I can recreate them and put them in the right place. Thanks for the warning!
Comment 7 Halla Rempt 2019-10-01 18:30:47 UTC
Okay, the current tarballs look good...
Comment 8 Wolfgang Bauer 2019-10-02 11:16:49 UTC
Yes, and they build fine (also with Qt 5.9).
Thank you!