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

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

View file

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