forked from quickshell/quickshell
		
	widgets/cliprect: override parent's implicit size instead of wrapper
Adding implicitSize to margin wrappers broke implicit sizing of ClippingWrapperRectangle.
This commit is contained in:
		
							parent
							
								
									73e673ea1c
								
							
						
					
					
						commit
						7390ae28e4
					
				
					 3 changed files with 14 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -14,6 +14,7 @@ qt_add_qml_module(quickshell-widgets
 | 
			
		|||
		WrapperMouseArea.qml
 | 
			
		||||
		WrapperRectangle.qml
 | 
			
		||||
		ClippingWrapperRectangle.qml
 | 
			
		||||
		ClippingWrapperRectangleInternal.qml
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
qt6_add_shaders(quickshell-widgets "widgets-cliprect"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ import QtQuick
 | 
			
		|||
/// > @@Item.height or @@Item.anchors on the child item, as they are used
 | 
			
		||||
/// > by WrapperItem to position it. Instead set @@Item.implicitWidth and
 | 
			
		||||
/// > @@Item.implicitHeight.
 | 
			
		||||
ClippingRectangle {
 | 
			
		||||
ClippingWrapperRectangleInternal {
 | 
			
		||||
	id: root
 | 
			
		||||
 | 
			
		||||
	/// The default for @@topMargin, @@bottomMargin, @@leftMargin and @@rightMargin.
 | 
			
		||||
| 
						 | 
				
			
			@ -54,13 +54,10 @@ ClippingRectangle {
 | 
			
		|||
	/// See @@WrapperManager.child for details.
 | 
			
		||||
	property alias child: manager.child
 | 
			
		||||
 | 
			
		||||
	implicitWidth: root.contentItem.implicitWidth + (root.contentInsideBorder ? root.border.width * 2 : 0)
 | 
			
		||||
	implicitHeight: root.contentItem.implicitHeight + (root.contentInsideBorder ? root.border.width * 2 : 0)
 | 
			
		||||
	border.width: 0
 | 
			
		||||
 | 
			
		||||
	resources: [
 | 
			
		||||
		MarginWrapperManager {
 | 
			
		||||
			id: manager
 | 
			
		||||
			wrapper: root.contentItem
 | 
			
		||||
		}
 | 
			
		||||
	]
 | 
			
		||||
	__implicitWidthInternal: root.contentItem.implicitWidth + (root.contentInsideBorder ? root.border.width * 2 : 0)
 | 
			
		||||
	__implicitHeightInternal: root.contentItem.implicitHeight + (root.contentInsideBorder ? root.border.width * 2 : 0)
 | 
			
		||||
 | 
			
		||||
	MarginWrapperManager { id: manager }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										7
									
								
								src/widgets/ClippingWrapperRectangleInternal.qml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/widgets/ClippingWrapperRectangleInternal.qml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
import QtQuick
 | 
			
		||||
 | 
			
		||||
ClippingRectangle {
 | 
			
		||||
	id: root
 | 
			
		||||
	property alias __implicitWidthInternal: root.implicitWidth
 | 
			
		||||
	property alias __implicitHeightInternal: root.implicitHeight
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue