mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
fix GetIcon
This commit is contained in:
@@ -3,15 +3,22 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
QIcon TrayIcon::GetIcon(TrayIcon::TrayIconStatus status) {
|
QIcon TrayIcon::GetIcon(TrayIcon::TrayIconStatus status) {
|
||||||
auto icon = QIcon::fromTheme("nekoray");
|
QPixmap pixmap;
|
||||||
auto pixmap = QPixmap("../nekoray.png");
|
|
||||||
if (!pixmap.isNull()) icon = QIcon(pixmap);
|
|
||||||
pixmap = QPixmap("./nekoray.png");
|
|
||||||
if (!pixmap.isNull()) icon = QIcon(pixmap);
|
|
||||||
|
|
||||||
if (status == TrayIconStatus::NONE) return icon;
|
// software embedded icon
|
||||||
|
auto pixmap_read = QPixmap(":/nekoray/nekoray.png");
|
||||||
|
if (!pixmap_read.isNull()) pixmap = pixmap_read;
|
||||||
|
|
||||||
|
// software pack icon
|
||||||
|
pixmap_read = QPixmap("../nekoray.png");
|
||||||
|
if (!pixmap_read.isNull()) pixmap = pixmap_read;
|
||||||
|
|
||||||
|
// user icon
|
||||||
|
pixmap_read = QPixmap("./nekoray.png");
|
||||||
|
if (!pixmap_read.isNull()) pixmap = pixmap_read;
|
||||||
|
|
||||||
|
if (status == TrayIconStatus::NONE) return pixmap;
|
||||||
|
|
||||||
pixmap = icon.pixmap(icon.availableSizes().first());
|
|
||||||
auto p = QPainter(&pixmap);
|
auto p = QPainter(&pixmap);
|
||||||
|
|
||||||
auto side = pixmap.width();
|
auto side = pixmap.width();
|
||||||
|
|||||||
Reference in New Issue
Block a user