From 4942c25f186a840ff8ad70431a1c66312d96d987 Mon Sep 17 00:00:00 2001 From: parhelia512 <0011d3@gmail.com> Date: Tue, 30 Sep 2025 01:28:29 +0800 Subject: [PATCH] improve --- CMakeLists.txt | 4 ++++ res/EmojiFont.qrc | 5 +++++ res/Throne.qrc | 3 --- src/main.cpp | 4 +--- 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 res/EmojiFont.qrc diff --git a/CMakeLists.txt b/CMakeLists.txt index ddf13ed..ac6515a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,6 +222,10 @@ set(PROJECT_SOURCES src/dataStore/ProxyEntity.cpp ) +if (NOT APPLE AND Qt6_VERSION VERSION_GREATER_EQUAL 6.9.0) + list(APPEND PROJECT_SOURCES res/EmojiFont.qrc) +endif () + # Qt exe qt_add_executable(Throne MANUAL_FINALIZATION diff --git a/res/EmojiFont.qrc b/res/EmojiFont.qrc new file mode 100644 index 0000000..a56ba94 --- /dev/null +++ b/res/EmojiFont.qrc @@ -0,0 +1,5 @@ + + + font/NotoColorEmoji.ttf + + diff --git a/res/Throne.qrc b/res/Throne.qrc index 8ab9a23..8e43448 100644 --- a/res/Throne.qrc +++ b/res/Throne.qrc @@ -24,7 +24,4 @@ public/Tun.png dashboard-notice.html - - font/NotoColorEmoji.ttf - diff --git a/src/main.cpp b/src/main.cpp index 0436ac3..1351285 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -69,15 +69,13 @@ int main(int argc, char* argv[]) { QApplication::setQuitOnLastWindowClosed(false); QApplication a(argc, argv); -#ifndef Q_OS_MACOS +#if !defined(Q_OS_MACOS) && (QT_VERSION >= QT_VERSION_CHECK(6,9,0)) // Load the emoji fonts int fontId = QFontDatabase::addApplicationFont(":/font/notoEmoji"); if (fontId >= 0) { -#if (QT_VERSION >= QT_VERSION_CHECK(6,9,0)) QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId); QFontDatabase::setApplicationEmojiFontFamilies(fontFamilies); -#endif } else { qDebug() << "could not load noto font!";