Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion framework/dockwindow/qml/Muse/Dock/DockFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ Rectangle {
QtObject {
id: prv
readonly property alias tabsModel: frameModel.tabsModel
readonly property int currentIndex: Boolean(root.frameCpp) && root.frameCpp.currentIndex >= 0 ? root.frameCpp.currentIndex : 0
readonly property int currentIndex: {
const tabCount = prv.tabsModel.numTabs // re-evaluate when tabs are added or closed
if (tabCount <= 0 || !Boolean(root.frameCpp)) {
return 0
}
return root.frameCpp.currentIndex >= 0 ? root.frameCpp.currentIndex : 0
}
}

NavigationPanel {
Expand Down
18 changes: 18 additions & 0 deletions framework/dockwindow/qml/Muse/Dock/DockTabBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,24 @@ Rectangle {
onHandleContextMenuItemRequested: function(itemId) {
root.handleContextMenuItemRequested(itemId)
}

MouseArea {
anchors.fill: parent
acceptedButtons: Qt.MiddleButton

onClicked: {
const closingCurrent = model.index === root.currentIndex
const previous = Math.max(0, model.index - 1)

model.contextMenu.handleMenuItem("command://dock/set-open")

if (closingCurrent) {
Qt.callLater(function() {
root.tabClicked(previous)
})
}
}
}
}
}

Expand Down