assuming it is the same in Qt 6.2 as in Qt 5.15
main app icon:
// main.cpp
// path to image of .qrc file
app.setWindowIcon(QIcon(":/images/logo_square.png"));
for the interactive app icon (e.g. on Ubuntu in the top right corner, on Windows bottom right corner):
// main.qml
SystemTrayIcon {
id: appIconWithContextMenu
visible: true
// url to file inside of .qrc
icon.source: "qrc:/images/logo_square.png"
tooltip: "My App Name"
menu: Menu {
MenuItem {
text: qsTr("Quit")
onTriggered: Qt.quit()
}
MenuItem {
text: qsTr("Some Action")
onTriggered: {
// e.g. trigger a synchronization feature or anything else
}
}
}
}