feat: 嵌入应用图标(窗口图标 + Windows exe 图标)
- 使用用户提供的 icon 图片作为应用图标 - Windows: .rc + windres 嵌入 exe 图标(256px 多尺寸 ICO) - Qt: 窗口图标从 Qt 资源加载 PNG Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
6824ce1f4a
commit
27bd78bf17
@ -139,10 +139,11 @@ else()
|
||||
list(APPEND HEADERS src/core/caps_lock_voice_hotkey.h src/core/wayland_text_injector.h)
|
||||
add_compile_definitions(PLATFORM_LINUX)
|
||||
endif()
|
||||
# Windows 使用 WIN32 标志隐藏启动控制台
|
||||
# Windows 使用 WIN32 标志隐藏启动控制台,并嵌入应用图标
|
||||
if(WIN32)
|
||||
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS}
|
||||
src/ui/resources/styles/styles.qrc
|
||||
src/ui/resources/icons/icon.rc
|
||||
)
|
||||
else()
|
||||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include <QApplication>
|
||||
#include <QCloseEvent>
|
||||
#include <QStyle>
|
||||
#include <QIcon>
|
||||
|
||||
static const char* const kTag = "MainWindow";
|
||||
|
||||
@ -34,6 +35,9 @@ MainWindow::MainWindow(ConfigManager* configManager,
|
||||
setWindowTitle("Impress Voice Input");
|
||||
resize(1000, 700);
|
||||
|
||||
// 设置窗口图标
|
||||
setWindowIcon(QIcon(":/icons/app_icon.png"));
|
||||
|
||||
setupUI(sttEngine);
|
||||
setupMenuBar();
|
||||
setupStatusBar(sttEngine);
|
||||
|
||||
BIN
src/ui/resources/icons/app_icon.ico
Normal file
BIN
src/ui/resources/icons/app_icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
BIN
src/ui/resources/icons/app_icon.png
Normal file
BIN
src/ui/resources/icons/app_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 536 KiB |
1
src/ui/resources/icons/icon.rc
Normal file
1
src/ui/resources/icons/icon.rc
Normal file
@ -0,0 +1 @@
|
||||
1 ICON "app_icon.ico"
|
||||
@ -3,4 +3,7 @@
|
||||
<file>main.qss</file>
|
||||
<file>main_dark.qss</file>
|
||||
</qresource>
|
||||
<qresource prefix="/icons">
|
||||
<file alias="app_icon.png">../icons/app_icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user