Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Layout.fillwidth returns 0
Forum Updated to NodeBB v4.3 + New Features

Layout.fillwidth returns 0

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 997 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.
  • L Offline
    L Offline
    literA2
    wrote on 4 Dec 2015, 17:12 last edited by literA2 12 Apr 2015, 17:13
    #1

    Hi,

    I am using a GridLayout with 2 columns, and I want to get the width of the second column which Layout.fillwidth is true, however it returns 0.

    Is there any way to determine the width if Layout.fillwidth is set to true? or any other way to implement such where i can determine the second column's width?

      GridLayout {
        id: infoGrid
        Layout.fillWidth: true
    
        columns: 2
        columnSpacing: 20
        rowSpacing: 5
    
        Text {
          text: qsTr("Server :")
        }
       Text {
          Layout.fillWidth: true
          text: qsTr("Server name")
        }
      }
    

    Please advise, thanks!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      literA2
      wrote on 4 Jan 2016, 13:45 last edited by
      #2

      Sorry for bumping this, because still I can't figure this out. Thanks.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        devel
        wrote on 4 Jan 2016, 15:55 last edited by
        #3

        Width of the second column is the width of the "Server name" element. If you are trying to get it in the Component.onCompleted, it won't do much because the layout is not calculated yet.

        L 1 Reply Last reply 4 Jan 2016, 17:21
        0
        • D devel
          4 Jan 2016, 15:55

          Width of the second column is the width of the "Server name" element. If you are trying to get it in the Component.onCompleted, it won't do much because the layout is not calculated yet.

          L Offline
          L Offline
          literA2
          wrote on 4 Jan 2016, 17:21 last edited by
          #4

          @devel Thanks for the reply.

          I wanted to get the whole width not just the painted width because i want to scroll the text if the paintedWidth is greater than its column width.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            devel
            wrote on 5 Jan 2016, 12:20 last edited by
            #5

            That's probably the implicitWidth of the largest item.

            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