Mercurial > octave
changeset 32394:1e775db0cff5
gui: Avoid deprecation warning about non-static QFontDatabase with Qt6.
* libgui/src/gui-settings.cc (gui_settings::get_default_font_family):
QFontDatabase has only static functions in Qt6. Avoid deprecation warning by
not instantiating an object of that type with Qt6.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 08 Oct 2023 20:16:02 +0200 |
parents | cef55b4a5749 |
children | d738b7d335b5 |
files | libgui/src/gui-settings.cc |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/gui-settings.cc Sun Oct 08 19:40:59 2023 +0200 +++ b/libgui/src/gui-settings.cc Sun Oct 08 20:16:02 2023 +0200 @@ -296,14 +296,23 @@ { // Get all available fixed width fonts from the Qt font database. + QStringList fonts; + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + for (QString font : QFontDatabase::families ()) + { + if (QFontDatabase::isFixedPitch (font)) + fonts << font; + } +#else QFontDatabase font_database; - QStringList fonts; for (QString font : font_database.families ()) { if (font_database.isFixedPitch (font)) fonts << font; } +#endif QString default_family;