Skip to content
This repository has been archived by the owner on Nov 25, 2023. It is now read-only.

Commit

Permalink
🐞 fix: 应用图标不显示
Browse files Browse the repository at this point in the history
fixes #17
  • Loading branch information
Hatsushigure committed Nov 3, 2023
1 parent 3a69a84 commit ebcdbbe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions HeAlarmApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "HeAlarm.h"
#include "TrayNotificationSender.h"
#include <QQmlApplicationEngine>
#include <QIcon>
#include <QPixmap>

HeAlarmApp::HeAlarmApp(int argc, char** argv) :
QGuiApplication {argc, argv}
Expand Down Expand Up @@ -35,4 +37,12 @@ void HeAlarmApp::fillAppInfo()
setApplicationVersion(HeAlarm::versionString());
setOrganizationName("初時雨");
setOrganizationDomain("Hatsushigure.github.io");
auto pix = QPixmap(":/res/Logo.png");
auto icon = QIcon();
icon.addPixmap(pix);
icon.addPixmap(pix.scaled({64, 64}, Qt::KeepAspectRatio, Qt::SmoothTransformation));
icon.addPixmap(pix.scaled({48, 48}, Qt::KeepAspectRatio, Qt::SmoothTransformation));
icon.addPixmap(pix.scaled({32, 32}, Qt::KeepAspectRatio, Qt::SmoothTransformation));
icon.addPixmap(pix.scaled({16, 16}, Qt::KeepAspectRatio, Qt::SmoothTransformation));
setWindowIcon(QIcon(pix));
}

0 comments on commit ebcdbbe

Please sign in to comment.