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. [Solved] Column with border
Forum Updated to NodeBB v4.3 + New Features

[Solved] Column with border

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 3.5k Views 1 Watching
  • 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.
  • E Offline
    E Offline
    ephe
    wrote on last edited by
    #1

    Is it possible to create a border around a Column element?
    I have tried to create a Rectangle around it:
    @
    Rectangle
    {
    color: "blue"
    radius: 5
    border.color: "black"
    border.width: 5

    Column
    {
        id: column
    
        anchors.fill: parent
        anchors.margins: 10
        ...
    }
    

    }
    @

    But the rectangle is not visible. Maybe I'm missing a property?
    Neither the background nor the border is visible.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      ludde
      wrote on last edited by
      #2

      Cannot see why that would not work. In fact, the following works just fine for me:
      @
      import QtQuick 1.0

      Rectangle {
      width: 100
      height: 100

      color: "blue"
      radius: 5
      border.color: "black"
      border.width: 5
      
      Column {
          anchors.fill: parent
          anchors.margins: 10
      
          Text { text: "Hello" }
          Text { text: "World" }
      }
      

      }
      @

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vsorokin
        wrote on last edited by
        #3

        You must set width and height or anchors for Rectangle element.

        --
        Vasiliy

        1 Reply Last reply
        0
        • E Offline
          E Offline
          ephe
          wrote on last edited by
          #4

          Thank you, I have set the height and width to the column.height and column.width. But this doesn't work. (Also anchors.fill: column) does not work.
          Do I always have to set these properties statically?


          edit: it is working now!

          @
          Rectangle
          {
          id: rectangle
          color: "#f3f3f3"
          radius: 5
          border.color: "#5e5b5b"
          border.width: 2
          width: 640;

          Column
          {
              id: column
              objectName: "column"
          
              anchors.margins: 1
              anchors.left: parent.left
              anchors.right: parent.right
              rectangle.height = height
              ...
          }
          

          }
          @

          1 Reply Last reply
          0
          • L Offline
            L Offline
            ludde
            wrote on last edited by
            #5

            You don't have to set them statically, but they must be bound to something that eventually evaluates to real values. Using the column width and height creates a circular dependency that will never evaluate to a real value.

            1 Reply Last reply
            0
            • E Offline
              E Offline
              ephe
              wrote on last edited by
              #6

              I think that this was my problem. I've edited my previous post, which now contains the code which was working for me.
              Thank you all for your help!

              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