wasm: make the compositor draw the window icon

Currently the compositor draws the Qt logo by default;
check if the window has an icon and draw that instead
if set.

Fixes: QTBUG-86052
Pick-to: 6.2
Change-Id: Ia4f9c03562c15993c86cb8717f27e47ab669353d





Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Morten Johan Sørvig 2021-12-03 14:37:33 +01:00
parent ad5c5bb541
commit fd0ef140cf
2 changed files with 9 additions and 2 deletions

View File

@ -411,6 +411,8 @@ QWasmCompositor::QWasmTitleBarOptions QWasmCompositor::makeTitleBarOptions(const
if (!window->window()->title().isEmpty())
titleBarOptions.titleBarOptionsString = window->window()->title();
titleBarOptions.windowIcon = window->window()->icon();
return titleBarOptions;
}
@ -586,8 +588,12 @@ void QWasmCompositor::drawTitlebarWindow(QWasmTitleBarOptions tb, QPainter *pain
if (tb.subControls & SC_TitleBarSysMenu && tb.flags & Qt::WindowSystemMenuHint) {
ir = titlebarRect(tb, SC_TitleBarSysMenu);
pixmap = cachedPixmapFromXPM(qt_menu_xpm).scaled(QSize(10, 10));
drawItemPixmap(painter, ir, Qt::AlignCenter, pixmap);
if (!tb.windowIcon.isNull()) {
tb.windowIcon.paint(painter, ir, Qt::AlignCenter);
} else {
pixmap = cachedPixmapFromXPM(qt_menu_xpm).scaled(QSize(10, 10));
drawItemPixmap(painter, ir, Qt::AlignCenter, pixmap);
}
}
}

View File

@ -91,6 +91,7 @@ public:
QPalette palette;
QString titleBarOptionsString;
QWasmCompositor::SubControls subControls;
QIcon windowIcon;
};
struct QWasmFrameOptions {