hide edit boxes when needed

This commit is contained in:
Marco Martin 2016-10-05 17:34:32 +02:00
parent 49cde86d37
commit efc09b0011

View file

@ -25,6 +25,7 @@ import org.kde.activities 0.1 as Activities
ColumnLayout {
PlasmaComponents.ToolButton {
id: newButton
Layout.fillWidth: true
text: i18n("New Activity...")
onClicked: {
@ -50,10 +51,15 @@ ColumnLayout {
}
}
}
ListView {
id: listView
MouseArea {
id: rootMouseArea
Layout.fillWidth: true
Layout.fillHeight: true
drag.filterChildren: true
onClicked: newEdit.visible = false
ListView {
id: listView
anchors.fill: parent
model: Activities.ActivityModel {
id: activityModel
}
@ -67,6 +73,18 @@ ColumnLayout {
visible: model.current
anchors.fill:parent
}
Connections {
target: rootMouseArea
onClicked: {
if (!delegate.contains(rootMouseArea.mapToItem(delegate, mouse.x, mouse.y))) {
edit.visible = false;
}
}
}
Connections {
target: newButton
onClicked: edit.visible = false;
}
SequentialAnimation {
id: positionAnim
property alias to: xAnim.to
@ -86,7 +104,7 @@ ColumnLayout {
}
}
width: listView.width
height: label.height
height: Math.max(label.height, label.height)
onClicked: {
listView.currentIndex = index;
activityModel.setCurrentActivity(model.id, function() {});
@ -113,6 +131,7 @@ ColumnLayout {
PlasmaComponents.Label {
id: label
text: model.name
anchors.verticalCenter: parent.verticalCenter
x: units.smallSpacing
}
PlasmaComponents.TextField {
@ -133,4 +152,5 @@ ColumnLayout {
}
}
}
}
}