mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fixing tray icon visibility issue on OS X
Some quirking since Qt doesn't render SVG tray icons on OS X.
This commit is contained in:
parent
73668c8cc4
commit
a4df4125e3
|
@ -4,6 +4,8 @@
|
|||
#include <QMenu>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QBitmap>
|
||||
#include "src/misc/settings.h"
|
||||
|
||||
SystemTrayIcon::SystemTrayIcon()
|
||||
|
@ -388,6 +390,16 @@ void SystemTrayIcon::setIcon(QIcon &icon)
|
|||
#endif
|
||||
else if (backendType == SystrayBackendType::Qt)
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
// Since Qt doesn't render SVG tray icons for OSX
|
||||
// we are forced to do this sort of a workaround!
|
||||
QPixmap quirk(64, 64);
|
||||
quirk.fill(Qt::transparent);
|
||||
QPainter quirker(&quirk);
|
||||
icon.paint(&quirker, 0, 0, 64, 64);
|
||||
icon = QIcon(quirk);
|
||||
#endif
|
||||
|
||||
qtIcon->setIcon(icon);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ void Widget::updateIcons()
|
|||
if (ico.isNull())
|
||||
{
|
||||
QString color = Settings::getInstance().getLightTrayIcon() ? "light" : "dark";
|
||||
ico = QIcon(":img/taskbar/" + color + "/taskbar_" + status + ".svg");
|
||||
ico = QIcon(":/img/taskbar/" + color + "/taskbar_" + status + ".svg");
|
||||
}
|
||||
|
||||
setWindowIcon(ico);
|
||||
|
|
Loading…
Reference in New Issue
Block a user