1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat: Add username to tray menu

Closes: https://github.com/qTox/qTox/issues/5880
This commit is contained in:
Jimi Huotari 2019-10-26 19:56:16 +03:00
parent f252816f55
commit 3a2e798254

View File

@ -31,6 +31,7 @@
#include <QShortcut>
#include <QString>
#include <QSvgRenderer>
#include <QWidgetAction>
#include <QWindow>
#ifdef Q_OS_MAC
#include <QMenuBar>
@ -2249,7 +2250,14 @@ void Widget::onTryCreateTrayIcon()
icon = std::unique_ptr<QSystemTrayIcon>(new QSystemTrayIcon);
updateIcons();
trayMenu = new QMenu(this);
QLabel* trayUser = new QLabel(getUsername(), this);
QWidgetAction* trayUserAction = new QWidgetAction(trayMenu);
trayUser->setAlignment(Qt::AlignCenter);
trayUserAction->setDefaultWidget(trayUser);
trayMenu->addAction(trayUserAction);
trayMenu->addSeparator();
// adding activate to the top, avoids accidentally clicking quit
trayMenu->addAction(actionShow);
trayMenu->addSeparator();