Allow minimize to tray.
This commit is contained in:
parent
4383dfa5a1
commit
4b2a33493f
|
@ -41,6 +41,8 @@ ApplicationWindow {
|
||||||
|
|
||||||
Controller {
|
Controller {
|
||||||
id: matriqueController
|
id: matriqueController
|
||||||
|
|
||||||
|
onToggleWindow: window.visible ? window.hide() : window.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
Controller::Controller(QObject* parent) : QObject(parent) {
|
Controller::Controller(QObject* parent) : QObject(parent) {
|
||||||
tray->setIcon(QIcon(":/asset/img/icon.png"));
|
tray->setIcon(QIcon(":/asset/img/icon.png"));
|
||||||
tray->setToolTip("Matrique");
|
tray->setToolTip("Matrique");
|
||||||
|
trayMenu->addAction("Toggle Window", [=] { emit toggleWindow(); });
|
||||||
trayMenu->addAction("Quit", [=] { QApplication::quit(); });
|
trayMenu->addAction("Quit", [=] { QApplication::quit(); });
|
||||||
tray->setContextMenu(trayMenu);
|
tray->setContextMenu(trayMenu);
|
||||||
tray->show();
|
tray->show();
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMediaPlayer>
|
#include <QMediaPlayer>
|
||||||
|
#include <QMenu>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
using namespace QMatrixClient;
|
using namespace QMatrixClient;
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ class Controller : public QObject {
|
||||||
void homeserverChanged();
|
void homeserverChanged();
|
||||||
void busyChanged();
|
void busyChanged();
|
||||||
void errorOccured();
|
void errorOccured();
|
||||||
|
void toggleWindow();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void joinRoom(const QString& alias);
|
void joinRoom(const QString& alias);
|
||||||
|
|
|
@ -23,6 +23,8 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
app.setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
qRegisterMetaType<MatriqueRoom *>("MatriqueRoom*");
|
qRegisterMetaType<MatriqueRoom *>("MatriqueRoom*");
|
||||||
qRegisterMetaType<User *>("User*");
|
qRegisterMetaType<User *>("User*");
|
||||||
qRegisterMetaType<MessageEventType>("MessageEventType");
|
qRegisterMetaType<MessageEventType>("MessageEventType");
|
||||||
|
|
Loading…
Reference in New Issue