Add clickable bread crumbs.
Clicking a parent path changes the root project directory.
This commit is contained in:
@@ -48,40 +48,17 @@ SplitView {
|
||||
ColumnLayout {
|
||||
spacing: 2
|
||||
|
||||
// TODO: Make a ClideBreadCrumb element to support select parent paths as root
|
||||
Rectangle {
|
||||
color: RustColors.explorer_background
|
||||
height: 25
|
||||
width: navigationView.width
|
||||
ClideBreadCrumbs {
|
||||
id: breadCrumb
|
||||
|
||||
Text {
|
||||
id: breadCrumb
|
||||
Layout.bottomMargin: 5
|
||||
Layout.leftMargin: 15
|
||||
Layout.topMargin: 5
|
||||
path: clideTreeView.rootDirectory
|
||||
|
||||
anchors.fill: parent
|
||||
color: RustColors.explorer_text
|
||||
elide: Text.ElideLeft
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: clideTreeView.rootDirectory
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
|
||||
onSingleTapped: (eventPoint, button) => contextMenu.popup()
|
||||
}
|
||||
ClideMenu {
|
||||
id: contextMenu
|
||||
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
text: qsTr("Reset root")
|
||||
|
||||
onTriggered: {
|
||||
Logger.log("Resetting root directory: " + clideTreeView.originalRootDirectory);
|
||||
clideTreeView.rootDirectory = clideTreeView.originalRootDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
onCrumbClicked: path => {
|
||||
Logger.trace("Crumb clicked: " + path);
|
||||
clideTreeView.rootDirectory = path;
|
||||
}
|
||||
}
|
||||
ClideTreeView {
|
||||
@@ -97,7 +74,7 @@ SplitView {
|
||||
onFileClicked: path => clideEditor.filePath = path
|
||||
onRootDirectoryChanged: {
|
||||
Logger.log("Setting root directory: " + clideTreeView.rootDirectory);
|
||||
breadCrumb.text = clideTreeView.rootDirectory;
|
||||
breadCrumb.path = clideTreeView.rootDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user