Add systray icon

This commit is contained in:
Stephen Shelton 2019-10-04 08:31:44 -06:00
parent ba853f589b
commit f18b87fa24
6 changed files with 14 additions and 2 deletions

View File

@ -7,7 +7,7 @@ This repository contains a cross-platform GUI for controlling and observing stat
To build, you'll need a handful of `Qt` packages available. On `Ubuntu` or similar, you can install these with:
```bash
sudo apt install qt5-default qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtquick-dialogs
sudo apt install qt5-default qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtquick-dialogs qml-module-qt-labs-platform
```
Then build and run:

View File

@ -4,5 +4,5 @@ QT += qml quick widgets
SOURCES += main.cpp
RESOURCES += qml.qrc
RESOURCES += resources.qrc

View File

@ -3,6 +3,8 @@
int32_t main(int32_t argc, char *argv[])
{
Q_INIT_RESOURCE(resources);
QApplication app(argc, argv);
QQmlApplicationEngine engine;

View File

@ -2,6 +2,7 @@ import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import Qt.labs.platform 1.1
ApplicationWindow {
title: qsTr("Hello World")
@ -10,6 +11,12 @@ ApplicationWindow {
visible: true
TestPanel {
}
SystemTrayIcon {
visible: true
icon.source: "qrc:/res/images/icon.png"
}
}

BIN
res/images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -3,4 +3,7 @@
<file>main.qml</file>
<file>TestPanel.qml</file>
</qresource>
<qresource prefix="/">
<file>res/images/icon.png</file>
</qresource>
</RCC>