Bug 412508

Summary: Krita 4.2.7 fails to build with Qt 5.9
Product: [Applications] krita Reporter: Wolfgang Bauer <wbauer1>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR    
Version First Reported In: 4.2.7   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

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!