Add systray icon
This commit is contained in:
parent
ba853f589b
commit
f18b87fa24
|
@ -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:
|
||||
|
|
|
@ -4,5 +4,5 @@ QT += qml quick widgets
|
|||
|
||||
SOURCES += main.cpp
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
RESOURCES += resources.qrc
|
||||
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -3,6 +3,8 @@
|
|||
|
||||
int32_t main(int32_t argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(resources);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
|
7
main.qml
7
main.qml
|
@ -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"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -3,4 +3,7 @@
|
|||
<file>main.qml</file>
|
||||
<file>TestPanel.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/">
|
||||
<file>res/images/icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue