mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	QML UI: press and hold for delete dive on dive list
This looks a little rough, but I think it works well. I'm sure it could be prettier, though. The next patch will just do the white space cleanup for the additional indentation level. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									69c10808af
								
							
						
					
					
						commit
						0a0d7b48e9
					
				
					 1 changed files with 50 additions and 0 deletions
				
			
		| 
						 | 
					@ -42,7 +42,23 @@ Kirigami.ScrollablePage {
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								property bool deleteButtonVisible: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								onPressAndHold: {
 | 
				
			||||||
 | 
									deleteButtonVisible = true
 | 
				
			||||||
 | 
									timer.restart()
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								Row {
 | 
				
			||||||
 | 
									width: parent.width - Kirigami.Units.gridUnit
 | 
				
			||||||
 | 
									height: childrenRect.height - Kirigami.Units.smallSpacing
 | 
				
			||||||
 | 
									spacing: horizontalPadding
 | 
				
			||||||
 | 
									add: Transition {
 | 
				
			||||||
 | 
										NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 }
 | 
				
			||||||
 | 
										NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 }
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			Item {
 | 
								Item {
 | 
				
			||||||
 | 
									id: diveListEntry
 | 
				
			||||||
				width: parent.width - Kirigami.Units.gridUnit
 | 
									width: parent.width - Kirigami.Units.gridUnit
 | 
				
			||||||
				height: childrenRect.height - Kirigami.Units.smallSpacing
 | 
									height: childrenRect.height - Kirigami.Units.smallSpacing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -113,6 +129,40 @@ Kirigami.ScrollablePage {
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								Rectangle {
 | 
				
			||||||
 | 
									visible: deleteButtonVisible
 | 
				
			||||||
 | 
									height: diveListEntry.height - Kirigami.Units.smallSpacing
 | 
				
			||||||
 | 
									width: height - 3 * Kirigami.Units.smallSpacing
 | 
				
			||||||
 | 
									color: "#FF3030"
 | 
				
			||||||
 | 
									antialiasing: true
 | 
				
			||||||
 | 
									radius: Kirigami.Units.smallSpacing
 | 
				
			||||||
 | 
									Kirigami.Icon {
 | 
				
			||||||
 | 
										anchors {
 | 
				
			||||||
 | 
											horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
 | 
											verticalCenter: parent.verticalCenter
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										source: "trash-empty"
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									MouseArea {
 | 
				
			||||||
 | 
										anchors.fill: parent
 | 
				
			||||||
 | 
										enabled: parent.visible
 | 
				
			||||||
 | 
										onClicked: {
 | 
				
			||||||
 | 
											parent.visible = false
 | 
				
			||||||
 | 
											timer.stop()
 | 
				
			||||||
 | 
											manager.deleteDive(dive.id)
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								Item {
 | 
				
			||||||
 | 
									Timer {
 | 
				
			||||||
 | 
										id: timer
 | 
				
			||||||
 | 
										interval: 4000
 | 
				
			||||||
 | 
										onTriggered: {
 | 
				
			||||||
 | 
											deleteButtonVisible = false
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue