Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt Groupbox中rowlayout项的对齐方式_Qt_Qml - Fatal编程技术网

Qt Groupbox中rowlayout项的对齐方式

Qt Groupbox中rowlayout项的对齐方式,qt,qml,Qt,Qml,我正在开发一个UI,其中我制作了两个按钮和两个labeltextfield。问题是我无法在rowlayout中对齐内部项。而且按钮也没有固定到文本字段的底部。我已经将anchor.bottom设置为textfield.bottom 我设置了布局。Alignment=Qt.AlignBottom,但不起作用 GroupBox{ id: gb RowLayout{ id:rl Button{ id: btn1 text:"Btn1"

我正在开发一个UI,其中我制作了两个按钮和两个labeltextfield。问题是我无法在rowlayout中对齐内部项。而且按钮也没有固定到文本字段的底部。我已经将anchor.bottom设置为textfield.bottom

我设置了布局。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
    }
  }
}

布局和锚定项是两种不同的机制,请参阅和以获取进一步阅读。

布局和锚定项是两种不同的机制,请参阅和以获取进一步阅读。

不应将布局和锚定混合使用。如果你把你想要的图片制作出来,我可以提出一个只包含布局或锚定的解决方案,你喜欢什么?这将非常有帮助,不管你觉得你能回答什么。你可以编辑问题以插入图片你不应该混合布局和锚定。如果你把你想要的图片制作出来,我可以提出一个只包含布局或锚定的解决方案,你喜欢什么?这将非常有帮助,不管你觉得你能回答什么。你可以编辑问题以插入图片