Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qml Column not resizing when bottom item visible goes false
Forum Updated to NodeBB v4.3 + New Features

Qml Column not resizing when bottom item visible goes false

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 138 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.
  • S Offline
    S Offline
    supa5000
    wrote on last edited by
    #1

    Dear all,

    Please find minimal example attached below. The issue is that we have a component that is sized by childrenRect that is Column, that size does not seem to get updated at some cases. The main issue is not that colum size does not go to 0, but rather that its not updating at all if the bottom component goes visible=false (it does update size when middle or top component goes visible=false).

    How should i force the colum size to be updated? Should i file bug?

    Scenario 1 (start fresh):

    • User clicks 'turn 1'
    • Column gets resized, and on console i see 'qml: Column new heigth: 110'
    • User clicks 'turn 2'
    • Column gets resized, and on console i see 'qml: Column new heigth: 50'
    • User clicks 'turn 3'
    • Column does not get resized (Expected: colum size goes 0)

    Scenario 2 (start fresh):

    • User clicks 'turn 3'
    • Column does not get resized, no text on console (Expected: colum size goes smaller)
    • User clicks 'turn 2'
    • Column does not get resized, no text on console (Expected: colum size goes smaller)
    • User clicks 'turn 1'
    • Column does not get resized, no text on console (Expected: colum size goes 0)

    Tested with

    • Qml Runtime 6.2.0
    • $DEV/6.2.0/gcc_64/bin/qml minimal.qml
    
    
    import QtQuick 
    import QtQuick.Controls 
    
        Rectangle
        {
                height: 500
                width: 100
                color:"black"
    
        Column
        { 
            spacing: 20 
            Button {
                text:"Turn 1"
                onClicked: { r1.visible = !r1.visible }
            }
            Button {
                text:"Turn 2"
                onClicked: { r2.visible = !r2.visible }
            }
            Button {
                text:"Turn 3"
                onClicked: { r3.visible = !r3.visible }
            }
            Rectangle
            {
                color:"red"
                height: column.height
                width: 100
                Column {
                    id: column
                    width: parent.width
                    height: childrenRect.height
    
                    onHeightChanged: { console.log("Column new heigth:", height); }
                    spacing: 10 
                    Rectangle
                    {
                        id:r1
                        color:"blue"
                        width: 50
                        height: 50 
                    }
                    Rectangle
                    {
                        id:r2
                        color:"green"
                        width: 50
                        height: 50 
                    }
    
                    Rectangle
                    {
                        id:r3
                        color:"magenta"
                        width: 50
                        height: 50 
                    }
                        
                }
            }
        }
    }
    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 Extensions
    • Unsolved