QmlDesigner: Fix Qt6 build

Add more QFont::Weight workarounds. The functions have to be refactored
in the future.

Change-Id: I5658a725c6c891d65f374484147d7cb5ae150980
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Marco Bubke
2021-01-21 18:28:34 +01:00
committed by Tim Jenssen
parent 3ead8f0432
commit 8443fbe3d4

View File

@@ -145,7 +145,11 @@ std::pair<QImage, QImage> ImageCacheFontCollector::createImage(
QFont font(fontFamily);
font.setStyle(rawFont.style());
font.setStyleName(rawFont.styleName());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
font.setWeight(QFont::Weight(rawFont.weight()));
#else
font.setWeight(rawFont.weight());
#endif
QImage image(size, QImage::Format_ARGB32);
image.fill(Qt::transparent);
int pixelSize(200);
@@ -207,7 +211,11 @@ QIcon ImageCacheFontCollector::createIcon(Utils::SmallStringView name,
QFont font(fontFamily);
font.setStyle(rawFont.style());
font.setStyleName(rawFont.styleName());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
font.setWeight(QFont::Weight(rawFont.weight()));
#else
font.setWeight(rawFont.weight());
#endif
for (QSize size : sizes) {
QPixmap pixmap(size);
pixmap.fill(Qt::transparent);