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. how to set offset in layout

how to set offset in layout

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 844 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.
  • AhtiA Offline
    AhtiA Offline
    Ahti
    wrote on last edited by Ahti
    #1

    I have a GridLayout in which I defined two columns. Left column should be spaces equal to left column length. I tried to create a white color rectangle which would act as an empty area like this:

    GridLayout {
            columns: 2
            // Trying to set rectangle as an offset for Label
            Rectangle {
                width: parent.width / 2
                height: parent.height
            }
    
            Label {
                text: "some text"
            }
        }
    

    That didn't work. So how would I go about creating left column as an offset for right column ?

    what is a signature ?? Lol

    ODБOïO 1 Reply Last reply
    0
    • AhtiA Ahti

      I have a GridLayout in which I defined two columns. Left column should be spaces equal to left column length. I tried to create a white color rectangle which would act as an empty area like this:

      GridLayout {
              columns: 2
              // Trying to set rectangle as an offset for Label
              Rectangle {
                  width: parent.width / 2
                  height: parent.height
              }
      
              Label {
                  text: "some text"
              }
          }
      

      That didn't work. So how would I go about creating left column as an offset for right column ?

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @Ahti hi

         Rectangle {
                     // width: parent.width / 2
                      Layout.preferredWidth: parent.width / 2
                     // height: parent.height
                      Layout.preferredHeight: parent.height
                      color: "grey"
                  }
      
      AhtiA 1 Reply Last reply
      0
      • ODБOïO ODБOï

        @Ahti hi

           Rectangle {
                       // width: parent.width / 2
                        Layout.preferredWidth: parent.width / 2
                       // height: parent.height
                        Layout.preferredHeight: parent.height
                        color: "grey"
                    }
        
        AhtiA Offline
        AhtiA Offline
        Ahti
        wrote on last edited by
        #3

        @LeLev I was expecting there would be some other option besides creating a rectangle.

        what is a signature ?? Lol

        ODБOïO 1 Reply Last reply
        0
        • AhtiA Ahti

          @LeLev I was expecting there would be some other option besides creating a rectangle.

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by ODБOï
          #4

          @Ahti misunderstood your question,see if this helps

          GridLayout {
                      anchors.fill: parent
                      columns: 2
          
          
                      Label {
          
                          text: "some text"
                          Layout.preferredWidth: parent.width / 2
                          Layout.alignment: Qt.AlignRight
                      }
                  }
          
          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