更新扩展接口,增加菜单功能

This commit is contained in:
hewenfei 2023-06-29 10:48:27 +08:00
parent a62416550d
commit 8a1e1e6cec
2 changed files with 23 additions and 1 deletions

View File

@ -48,7 +48,7 @@ Item {
RowLayout {
anchors.fill: parent
// spacing: 5
spacing: 4
ListView {
id: extensionInfoList
@ -78,6 +78,14 @@ Item {
}
}
Loader {
id: extensionMenuLoader
visible: sourceComponent !== undefined
Layout.preferredWidth: 34
Layout.preferredHeight: 34
Layout.alignment: Qt.AlignVCenter
}
AppControls2.StyleBackground {
id: fullScreenbutton
Layout.preferredWidth: 34
@ -125,10 +133,23 @@ Item {
onLoaded: {
item.send.connect(extensionInfoList.send);
sidebarLayout.updateSidebarLayout(extensionInfoList.currentItem.extensionOptions);
updateMenu();
item.extensionMenuChanged.connect(updateMenu);
}
Keys.onTabPressed: {
extensionInfoList.focus = true
}
function updateMenu() {
if (item === null) {
return;
}
if (item.extensionMenu !== null) {
extensionMenuLoader.sourceComponent = item.extensionMenu;
} else {
extensionMenuLoader.sourceComponent = undefined;
}
}
}
}

View File

@ -2,5 +2,6 @@ import QtQuick 2.0
Item {
property var extensionData;
property Component extensionMenu: null;
signal send(var data);
}