Fix theme/icon on windows

This commit is contained in:
Laurent Montel 2024-11-21 13:28:22 +01:00
parent b4b4920036
commit 01e99c7c12
4 changed files with 22 additions and 0 deletions

View file

@ -17,6 +17,7 @@ Dependencies:
'frameworks/ktextwidgets': '@latest-kf6' 'frameworks/ktextwidgets': '@latest-kf6'
'frameworks/kwidgetsaddons': '@latest-kf6' 'frameworks/kwidgetsaddons': '@latest-kf6'
'frameworks/kxmlgui': '@latest-kf6' 'frameworks/kxmlgui': '@latest-kf6'
'frameworks/kiconthemes': '@latest-kf6'
'games/libkdegames': '@same' 'games/libkdegames': '@same'
Options: Options:

View file

@ -49,6 +49,7 @@ find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS
XmlGui XmlGui
KIO KIO
NewStuff NewStuff
IconThemes
) )
find_package(KDEGames6 6.0.0 REQUIRED) find_package(KDEGames6 6.0.0 REQUIRED)

View file

@ -67,6 +67,7 @@ target_link_libraries(kigo
KF6::DBusAddons KF6::DBusAddons
KF6::Crash KF6::Crash
KF6::I18n KF6::I18n
KF6::IconThemes
Qt6::Svg Qt6::Svg
) )

View file

@ -15,6 +15,15 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <KDBusService> #include <KDBusService>
#define HAVE_KICONTHEME __has_include(<KIconTheme>)
#if HAVE_KICONTHEME
#include <KIconTheme>
#endif
#define HAVE_STYLE_MANAGER __has_include(<KStyleManager>)
#if HAVE_STYLE_MANAGER
#include <KStyleManager>
#endif
/** /**
* This namespace collects all classes related to Kigo, the Go board game. * This namespace collects all classes related to Kigo, the Go board game.
@ -29,7 +38,17 @@ namespace Kigo { /* This is only a Doxygen stub */ }
*/ */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#if HAVE_KICONTHEME
KIconTheme::initTheme();
#endif
QApplication app(argc, argv); QApplication app(argc, argv);
#if HAVE_STYLE_MANAGER
KStyleManager::initStyle();
#else // !HAVE_STYLE_MANAGER
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
QApplication::setStyle(QStringLiteral("breeze"));
#endif // defined(Q_OS_MACOS) || defined(Q_OS_WIN)
#endif // HAVE_STYLE_MANAGER
KLocalizedString::setApplicationDomain(QByteArrayLiteral("kigo")); KLocalizedString::setApplicationDomain(QByteArrayLiteral("kigo"));