forked from qt-creator/qt-creator
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:
@@ -145,7 +145,11 @@ std::pair<QImage, QImage> ImageCacheFontCollector::createImage(
|
|||||||
QFont font(fontFamily);
|
QFont font(fontFamily);
|
||||||
font.setStyle(rawFont.style());
|
font.setStyle(rawFont.style());
|
||||||
font.setStyleName(rawFont.styleName());
|
font.setStyleName(rawFont.styleName());
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
font.setWeight(QFont::Weight(rawFont.weight()));
|
||||||
|
#else
|
||||||
font.setWeight(rawFont.weight());
|
font.setWeight(rawFont.weight());
|
||||||
|
#endif
|
||||||
QImage image(size, QImage::Format_ARGB32);
|
QImage image(size, QImage::Format_ARGB32);
|
||||||
image.fill(Qt::transparent);
|
image.fill(Qt::transparent);
|
||||||
int pixelSize(200);
|
int pixelSize(200);
|
||||||
@@ -207,7 +211,11 @@ QIcon ImageCacheFontCollector::createIcon(Utils::SmallStringView name,
|
|||||||
QFont font(fontFamily);
|
QFont font(fontFamily);
|
||||||
font.setStyle(rawFont.style());
|
font.setStyle(rawFont.style());
|
||||||
font.setStyleName(rawFont.styleName());
|
font.setStyleName(rawFont.styleName());
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
font.setWeight(QFont::Weight(rawFont.weight()));
|
||||||
|
#else
|
||||||
font.setWeight(rawFont.weight());
|
font.setWeight(rawFont.weight());
|
||||||
|
#endif
|
||||||
for (QSize size : sizes) {
|
for (QSize size : sizes) {
|
||||||
QPixmap pixmap(size);
|
QPixmap pixmap(size);
|
||||||
pixmap.fill(Qt::transparent);
|
pixmap.fill(Qt::transparent);
|
||||||
|
Reference in New Issue
Block a user