QGtk3Interface: Explicitly add monospace font provider
In case the current GTK3 theme has no monospace font defined, a
monospace font requested by a Qt application can trigger a GTK warning
"Theme parsing error: <data>:1:0: Expected a valid selector".
The warning is triggered by Qt requesting "{font-family: monospace;}".
In this case:
=> ensure fallback to GTK standard monospace font
=> request "* {font-family: monospace;}" to avoid the warning
Task-number: QTBUG-112896
Pick-to: 6.6 6.5
Change-Id: I24a8da62908af9b153245f53026af60e63a600d7
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
bb10
parent
72d660843b
commit
8d1304f4f2
|
|
@ -608,7 +608,8 @@ QFont QGtk3Interface::font(QPlatformTheme::Font type) const
|
|||
GtkCssProvider *cssProvider = nullptr;
|
||||
if (type == QPlatformTheme::FixedFont) {
|
||||
cssProvider = gtk_css_provider_new();
|
||||
const char *fontSpec = "{font-family: monospace;}";
|
||||
gtk_style_context_add_class (con, GTK_STYLE_CLASS_MONOSPACE);
|
||||
const char *fontSpec = "* {font-family: monospace;}";
|
||||
gtk_css_provider_load_from_data(cssProvider, fontSpec, -1, NULL);
|
||||
gtk_style_context_add_provider(con, GTK_STYLE_PROVIDER(cssProvider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||
|
|
|
|||
Loading…
Reference in New Issue