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. [Solved] Anchoring an item next to an item of the same sort (a button)

[Solved] Anchoring an item next to an item of the same sort (a button)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 988 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.
  • E Offline
    E Offline
    Easter-Egg-X
    wrote on last edited by
    #1

    I'm trying to figure out why the right button doesn't seem to want to connect to the center button. It's supposed to be on the right side of the center button, but I see it on the left side. Also tried inverting the anchor points so left is right and right is left (like my world right now... lol), but the "right" button didn't seem to change position, so I am kinda thinking it may be because they aren't anchored at all. But why?

    @import QtQuick 2.0

    Rectangle {
    width: 600
    height: 600
    color: "black"

    Button {
        id: centerButton
        
        anchors.horizontalCenter: parent.horizontalCenter
        myText: "I am the center"
    }
    
    Button {
        id: nextButton
    
        myText: "Right to the center"
        anchors.left: centerButton.anchors.right
    }
    
    MouseArea {
        anchors.fill: parent
        onClicked: {
            Qt.quit();
        }
    }
    

    }@

    Hope to get some help, and thanks in advanced.

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nicky j
      wrote on last edited by
      #2

      maybe try:
      @anchors.left: centerButton.right@
      not sure if that will work though...

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Easter-Egg-X
        wrote on last edited by
        #3

        [quote author="nicky j" date="1393115712"]maybe try:
        @anchors.left: centerButton.right@
        not sure if that will work though...[/quote]

        It worked, cool. Thanks a lot man!

        1 Reply Last reply
        0
        • N Offline
          N Offline
          nicky j
          wrote on last edited by
          #4

          No problem, Im kind of still teaching my self QML. There is a learning curve, but Its a neat skill to have.

          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