Click on blank part of dialog to deselect item

This commit is contained in:
David Rowe 2016-06-01 14:25:07 +12:00
parent eddfe4847a
commit 4da1c0ac4d
3 changed files with 22 additions and 3 deletions

View file

@ -79,6 +79,9 @@ ModalWindow {
fileTableModel.folder = initialFolder;
iconText = root.title !== "" ? hifi.glyphs.scriptUpload : "";
// Clear selection when click on external frame.
frameClicked.connect(function() { d.clearSelection(); });
}
Item {
@ -87,6 +90,13 @@ ModalWindow {
height: pane.height
anchors.margins: 0
MouseArea {
// Clear selection when click on internal unused area.
anchors.fill: parent
drag.target: root
onClicked: d.clearSelection()
}
Row {
id: navControls
anchors {
@ -228,6 +238,12 @@ ModalWindow {
fileTableModel.folder = homeDestination;
return true;
}
function clearSelection() {
fileTableView.selection.clear();
fileTableView.currentRow = -1;
update();
}
}
FolderListModel {
@ -392,9 +408,7 @@ ModalWindow {
rows++;
}
fileTableView.selection.clear();
fileTableView.currentRow = -1;
d.update();
d.clearSelection();
}
}

View file

@ -27,6 +27,8 @@ Frame {
readonly property int frameMarginTop: hifi.dimensions.modalDialogMargin.y + (frameContent.hasTitle ? hifi.dimensions.modalDialogTitleHeight + 10 : 0)
readonly property int frameMarginBottom: hifi.dimensions.modalDialogMargin.y
signal frameClicked();
anchors {
fill: parent
topMargin: -frameMarginTop
@ -47,6 +49,7 @@ Frame {
anchors.fill: parent
drag.target: window
enabled: window.draggable
onClicked: window.frameClicked();
}
Item {

View file

@ -22,5 +22,7 @@ Window {
property int colorScheme: hifi.colorSchemes.light
property bool draggable: false
signal frameClicked();
anchors.centerIn: draggable ? undefined : parent
}