marty bu
marty bu

Reputation: 744

SystemTrayIcon in QML

I try to use the SystemTrayIcon in QML using Qt 5.11 (Manjaro with KDE), but when i add

import Qt.labs.platform 1.1

to the QML Code (or 1.0) it doesn't show anything but instantly fails with

/path/to/project exited with code 255

Code example for empty quick project:

import QtQuick 2.11
import QtQuick.Window 2.11
import Qt.labs.platform 1.1

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

}

Upvotes: 1

Views: 807

Answers (1)

marty bu
marty bu

Reputation: 744

Problem was conflicting namespaces. Using the import like

import Qt.labs.platform 1.1 as LabsPlatform

LabsPlatform.SystemTrayIcon {

}

works just fine.

In Addition I had to include widgets and use QApplication instead of QGuiApplication.

Upvotes: 1

Related Questions