Qt 6.12 LTS is out! See what's new in the release
blog
Proper custom control sizing?
-
I've been working on a variation of the GroupBox control where the label lives outside the content rectangle (above the upper left corner) so it looks a bit like a filing cabinet folder tab. But I'm having some difficulty getting the bounding box of it to account for this label in column layouts so the spacing looks right.
T.GroupBox { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, contentWidth + leftPadding + rightPadding, implicitLabelWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding) spacing: 6 padding: 0 verticalPadding: 0 topPadding: 0 horizontalPadding: 0 bottomPadding: 0 label: Label { text: control.title color: control.palette.windowText anchors.leftMargin: 10 anchors.bottom: parent.top topPadding: 0 bottomPadding: 0 leftPadding: 10 background: Frame { z: -1 y: -1 width: parent.width + 10 height: parent.height + 2 } } background: Frame { anchors.top: control.top anchors.fill: parent } }