一个的RowLayout的项目的取向是在一个组框

问题描述 投票:1回答:1

我发展,我已经做了两个按钮和两个labeltextfield的UI。问题是,对准我不能在做的RowLayout内项目。并且按钮也没有锚定到文本框的底部。我已经设置了anchor.bottom到textfield.bottom。

我设置了Layout.Alignment = Qt.AlignBottom但是,这不是工作

GroupBox{
    id: gb

RowLayout{
    id:rl
    Button{
        id: btn1
        text:"Btn1"
        Layout.preferredHeight: 30
        Layout.preferredWidth: 150
        anchors.bottom: tlfield.bottom
    }

    Button{
        id: btn2
        text:"Btn2"
        Layout.preferredHeight: 30
        Layout.preferredWidth: 150
        anchors.bottom: tlfield.bottom
    }

    LabeledTextFieldVertical
    {
        id: tlfield
        fieldLabel.text: "text"
        fieldText.text: check
        fieldText.maximumLength: 15
        Layout.preferredWidth: 130
        fieldText.height:30
        Layout.alignment: Qt.AlignBottom
        shouldFillWidth: false
    }
  }
}
qt qml
1个回答
0
投票

布局和锚固件是两种不同的机制,请参阅进一步阅读Qt Quick LayoutsPositioning with Anchors

© www.soinside.com 2019 - 2024. All rights reserved.