Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Proper custom control sizing?
Qt 6.12 LTS is out! See what's new in the release blog

Proper custom control sizing?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 278 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RogueWarrior
    wrote on last edited by
    #1

    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
        }
    }
    
    

    GroupBox.jpg

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt
    • Unsolved