QML MenuSeparator show blank line but not underline
-
win10+Qt5.10.0+QML
When using SystemTrayIcon in my qml project, I want to show a series of menus, so what I need is a underline which can separate difference menu clear.
So a
MenuSeparator{} use in my code, but unexpected thing happend, it is a blank white area, not a underline.I has to look for the Qt helper file install with my QtCreator, the picture shows it seems that MenuSeparator{} works well as a underline from the "MenuSeparator QML Type" title.
Here is all my code in the 'SystemTray.qml' file:
import QtQuick 2.9 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 import Qt.labs.platform 1.0 import QtQml 2.2 SystemTrayIcon { id: tray_main visible: true tooltip: service.tooltip property ConfigureView cfg_dlg: ConfigureView{} menu: Menu { id: tray_menu MenuItem { text: qsTr("connect") checkable: true checked: configure.enable onCheckedChanged: { configure.enable = checked tray_main.iconSource = checked ? "qrc:/images/logo.ico" : "qrc:/images/logo_1.ico"; } } Menu { id: server_list title: /*qsTr(*/"server list"/*)*/ **MenuSeparator {}** MenuItem { text: qsTr("configure server...") onTriggered: { cfg_dlg.show() } } } **MenuSeparator {}** MenuItem { text: qsTr("start-up") checkable: true checked: service.startUp() onCheckedChanged: { service.setStartUp(checked) } } MenuItem { text: qsTr("quit") onTriggered: { service.stop() Qt.quit() } } ///////////////////////////////////////////////////////////////// Instantiator { model: listModel//configure.serverLists onObjectAdded: server_list.insertItem(index, object) onObjectRemoved: server_list.removeItem(object) delegate: MenuItem { checkable: true checked: configure.index == index text: remarks + "(" + ip + ":" + port + ")"//modelData onCheckedChanged: { if (checked != (configure.index == index)) {//to avoid loop first time configure.index = index } } } } } }
Is there something wrong ? could anybody help me ! Thanks for your help!
-
The bug was noticed and fixed recently: QTBUG-66642. Sorry for the inconvenience, the implementation of native platform menus for Windows is brand new in Qt 5.10. :)
-
@jpnurmi Thanks for your help !
And there is another question in the following code:
Menu { id: server_list title: /*qsTr(*/"server list"/*)*/ MenuSeparator {} MenuItem { text: qsTr("configure server...") onTriggered: { cfg_dlg.show() } } }
title: /*qsTr(*/"server list"/*)*/ //show "server list" title: qsTr("server list") //just an blank menu with no anyother word
win10+Qt5.10.0+QML
-
Ouch. :( The good news is that that one has also been fixed: QTBUG-66876