Skip to content
Draft
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
35 changes: 34 additions & 1 deletion meshroom/ui/qml/Homepage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ Page {
Layout.fillWidth: true
Layout.fillHeight: true

// Reset project selection when switching tabs
onCurrentTabChanged: {
if (currentTab === 1) {
gridView.selectedIndex = -1
}
}

ListView {
id: pipelinesListView
visible: tabPanel.currentTab === 0
Expand Down Expand Up @@ -280,13 +287,23 @@ Page {
cellHeight: cellWidth
anchors.margins: 10

// Property to track which project is currently selected
property int selectedIndex: -1

model: {
// Request latest thumbnail paths
if (mainStack.currentItem instanceof Homepage)
MeshroomApp.updateRecentProjectFilesThumbnails()
return [{"path": null, "thumbnail": null}].concat(MeshroomApp.recentProjectFiles)
}

// Reset selection when model changes if index is out of bounds
onModelChanged: {
if (selectedIndex >= count) {
selectedIndex = -1
}
}

// Update grid item when corresponding thumbnail is computed
Connections {
target: ThumbnailCache
Expand Down Expand Up @@ -332,6 +349,14 @@ Page {
font.pointSize: 24

text: modelData["path"] ? (modelData["thumbnail"] ? "" : MaterialIcons.description) : MaterialIcons.folder_open

// Add visual highlighting when this project is selected
background: Rectangle {
color: projectDelegate.hovered ? Qt.darker(projectDelegate.palette.base, 0.6) : "transparent"
border.width: gridView.selectedIndex === index ? 2 : 0
border.color: gridView.selectedIndex === index ? "#ff0000" : "transparent"
radius: 4
}

MouseArea {
anchors.fill: parent
Expand All @@ -340,6 +365,9 @@ Page {

onClicked: function(mouse) {

// Set the selected index to highlight this project
gridView.selectedIndex = index

if (mouse.button === Qt.RightButton) {

if (!modelData["path"]) { return }
Expand Down Expand Up @@ -375,7 +403,8 @@ Page {

MenuItem {
text: "Open"
onTriggered: {
onTriggered: {
gridView.selectedIndex = index
if (_reconstruction.load(modelData["path"])) {
mainStack.push("Application.qml")
MeshroomApp.addRecentProjectFile(modelData["path"])
Expand All @@ -386,6 +415,10 @@ Page {
MenuItem {
text: "Delete"
onTriggered: {
// Clear selection if deleting the selected item
if (gridView.selectedIndex === index) {
gridView.selectedIndex = -1
}
MeshroomApp.removeRecentProjectFile(modelData["path"])
}
}
Expand Down