Skip to content

Commit 7390ae2

Browse files
committed
widgets/cliprect: override parent's implicit size instead of wrapper
Adding implicitSize to margin wrappers broke implicit sizing of ClippingWrapperRectangle.
1 parent 73e673e commit 7390ae2

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/widgets/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ qt_add_qml_module(quickshell-widgets
1414
WrapperMouseArea.qml
1515
WrapperRectangle.qml
1616
ClippingWrapperRectangle.qml
17+
ClippingWrapperRectangleInternal.qml
1718
)
1819

1920
qt6_add_shaders(quickshell-widgets "widgets-cliprect"

src/widgets/ClippingWrapperRectangle.qml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import QtQuick
1111
/// > @@Item.height or @@Item.anchors on the child item, as they are used
1212
/// > by WrapperItem to position it. Instead set @@Item.implicitWidth and
1313
/// > @@Item.implicitHeight.
14-
ClippingRectangle {
14+
ClippingWrapperRectangleInternal {
1515
id: root
1616

1717
/// The default for @@topMargin, @@bottomMargin, @@leftMargin and @@rightMargin.
@@ -54,13 +54,10 @@ ClippingRectangle {
5454
/// See @@WrapperManager.child for details.
5555
property alias child: manager.child
5656

57-
implicitWidth: root.contentItem.implicitWidth + (root.contentInsideBorder ? root.border.width * 2 : 0)
58-
implicitHeight: root.contentItem.implicitHeight + (root.contentInsideBorder ? root.border.width * 2 : 0)
57+
border.width: 0
5958

60-
resources: [
61-
MarginWrapperManager {
62-
id: manager
63-
wrapper: root.contentItem
64-
}
65-
]
59+
__implicitWidthInternal: root.contentItem.implicitWidth + (root.contentInsideBorder ? root.border.width * 2 : 0)
60+
__implicitHeightInternal: root.contentItem.implicitHeight + (root.contentInsideBorder ? root.border.width * 2 : 0)
61+
62+
MarginWrapperManager { id: manager }
6663
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import QtQuick
2+
3+
ClippingRectangle {
4+
id: root
5+
property alias __implicitWidthInternal: root.implicitWidth
6+
property alias __implicitHeightInternal: root.implicitHeight
7+
}

0 commit comments

Comments
 (0)