fix tray menu loading
This commit is contained in:
@@ -475,6 +475,8 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
id: actionRow
|
||||||
|
property NotifServer.Notif notif: groupHeader.modelData
|
||||||
spacing: 2
|
spacing: 2
|
||||||
// visible: groupColumn.isExpanded ? ( groupHeader.modelData.actions.length > 1 ? true : false ) : ( groupColumn.notifications.length === 1 ? ( groupHeader.modelData.actions.length > 1 ? true : false ) : false )
|
// visible: groupColumn.isExpanded ? ( groupHeader.modelData.actions.length > 1 ? true : false ) : ( groupColumn.notifications.length === 1 ? ( groupHeader.modelData.actions.length > 1 ? true : false ) : false )
|
||||||
visible: true
|
visible: true
|
||||||
@@ -482,7 +484,7 @@ PanelWindow {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: groupHeader.modelData.actions
|
model: [ ...actionRow.notif.actions ]
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: actionButton
|
id: actionButton
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -501,6 +503,7 @@ PanelWindow {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
console.log( groupHeader.modelData.actions );
|
||||||
actionButton.modelData.invoke();
|
actionButton.modelData.invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ MouseArea {
|
|||||||
required property SystemTrayItem item
|
required property SystemTrayItem item
|
||||||
required property PanelWindow bar
|
required property PanelWindow bar
|
||||||
property point globalPos
|
property point globalPos
|
||||||
|
property bool hasLoaded: false
|
||||||
|
|
||||||
implicitWidth: 22
|
implicitWidth: 22
|
||||||
|
|
||||||
@@ -54,6 +55,12 @@ MouseArea {
|
|||||||
trayMenu.trayMenu = null;
|
trayMenu.trayMenu = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFinishedLoading() {
|
||||||
|
if ( !root.hasLoaded )
|
||||||
|
trayMenu.visible = false;
|
||||||
|
root.hasLoaded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ PanelWindow {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
signal menuActionTriggered()
|
signal menuActionTriggered()
|
||||||
|
signal finishedLoading()
|
||||||
required property QsMenuHandle trayMenu
|
required property QsMenuHandle trayMenu
|
||||||
required property point trayItemRect
|
required property point trayItemRect
|
||||||
required property PanelWindow bar
|
required property PanelWindow bar
|
||||||
@@ -20,6 +21,7 @@ PanelWindow {
|
|||||||
property alias focusGrab: grab.active
|
property alias focusGrab: grab.active
|
||||||
property int entryHeight: 30
|
property int entryHeight: 30
|
||||||
property int biggestWidth: 0
|
property int biggestWidth: 0
|
||||||
|
property int menuItemCount: menuOpener.children.values.length
|
||||||
|
|
||||||
QsMenuOpener {
|
QsMenuOpener {
|
||||||
id: menuOpener
|
id: menuOpener
|
||||||
@@ -30,7 +32,7 @@ PanelWindow {
|
|||||||
// listLayout.forceLayout();
|
// listLayout.forceLayout();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
visible: false
|
visible: true
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
anchors {
|
anchors {
|
||||||
top: true
|
top: true
|
||||||
@@ -198,6 +200,7 @@ PanelWindow {
|
|||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: menuItem
|
id: menuItem
|
||||||
|
required property int index
|
||||||
required property QsMenuEntry modelData
|
required property QsMenuEntry modelData
|
||||||
property var child: QsMenuOpener {
|
property var child: QsMenuOpener {
|
||||||
menu: menuItem.modelData
|
menu: menuItem.modelData
|
||||||
@@ -218,6 +221,9 @@ PanelWindow {
|
|||||||
if ( currentWidth > biggestWidth ) {
|
if ( currentWidth > biggestWidth ) {
|
||||||
root.biggestWidth = currentWidth;
|
root.biggestWidth = currentWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( menuItem.index === menuOpener.children.values.length - 1 )
|
||||||
|
root.finishedLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
|
|||||||
Reference in New Issue
Block a user