mirror of
				https://invent.kde.org/plasma/layer-shell-qt.git
				synced 2025-10-31 15:55:25 -04:00 
			
		
		
		
	window: Improve how we tell the window to do layer-shell
Instead of telling it in the construction after forcing the window creation, install an event handler that sets it when we get the PlatformSurface event. It has the advantage that it will also trigger in subsequent platform surface events (e.g. after hide and show).
This commit is contained in:
		
							
								
								
									
										41
									
								
								tests/become-layershell.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								tests/become-layershell.qml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,41 @@ | ||||
| /* | ||||
|  *   SPDX-FileCopyrightText: 2025 Aleix Pol i Gonzalez <aleixpol@kde.org> | ||||
|  * | ||||
|  *   SPDX-License-Identifier: LGPL-3.0-or-later | ||||
|  */ | ||||
|  | ||||
| import QtQuick | ||||
| import QtQuick.Controls | ||||
| import org.kde.layershell 1.0 as LayerShell | ||||
|  | ||||
| Item | ||||
| { | ||||
|     Button { | ||||
|         text: "Convert" | ||||
|         anchors.centerIn: parent | ||||
|  | ||||
|         onClicked: { | ||||
|             win.LayerShell.Window.anchors = LayerShell.Window.AnchorLeft; | ||||
|             win.LayerShell.Window.layer = LayerShell.Window.LayerTop; | ||||
|             win.LayerShell.Window.exclusionZone = -1; | ||||
|             win.show() | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     Window { | ||||
|         id: win | ||||
|  | ||||
|         width: 100 | ||||
|         height: 100 | ||||
|         Rectangle { | ||||
|             anchors.fill: parent | ||||
|             color: "red" | ||||
|  | ||||
|             Text { | ||||
|                 anchors.centerIn: parent | ||||
|                 text: "top" | ||||
|             } | ||||
|         } | ||||
|         visible: true | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user