mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Mobile: move pageIndex function to main.qml
This way it can be more easily called from other pages. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									2ef401ef5f
								
							
						
					
					
						commit
						2f0689d3b8
					
				
					 2 changed files with 9 additions and 9 deletions
				
			
		|  | @ -36,14 +36,6 @@ Kirigami.ScrollablePage { | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	function pageIndex(pageToFind) { | ||||
| 		for (var i = 0; i < pageStack.contentItem.contentChildren.length; i++) { | ||||
| 			if (pageStack.contentItem.contentChildren[i] === pageToFind) | ||||
| 				return i | ||||
| 		} | ||||
| 		return -1 | ||||
| 	} | ||||
| 
 | ||||
| 	Component { | ||||
| 		id: diveDelegate | ||||
| 		Kirigami.AbstractListItem { | ||||
|  | @ -124,7 +116,7 @@ Kirigami.ScrollablePage { | |||
| 					diveListView.currentIndex = index | ||||
| 					detailsWindow.showDiveIndex(index); | ||||
| 					// switch to detailsWindow (or push it if it's not in the stack) | ||||
| 					var i = pageIndex(detailsWindow) | ||||
| 					var i = rootItem.pageIndex(detailsWindow) | ||||
| 					if (i === -1) | ||||
| 						pageStack.push(detailsWindow) | ||||
| 					else | ||||
|  |  | |||
|  | @ -90,6 +90,14 @@ Kirigami.ApplicationWindow { | |||
| 		pageStack.push(mapPage) | ||||
| 	} | ||||
| 
 | ||||
| 	function pageIndex(pageToFind) { | ||||
| 		for (var i = 0; i < pageStack.contentItem.contentChildren.length; i++) { | ||||
| 			if (pageStack.contentItem.contentChildren[i] === pageToFind) | ||||
| 				return i | ||||
| 		} | ||||
| 		return -1 | ||||
| 	} | ||||
| 
 | ||||
| 	function startAddDive() { | ||||
| 		detailsWindow.state = "add" | ||||
| 		detailsWindow.dive_id = manager.addDive(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue