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



  • 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.



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



  • [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!



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.