Javascript 如何在QML'内排列矩形;什么是窗格? 下面的代码导致:请只考虑里面有蓝色边框和蓝色框的粉盒。< /P>
我想把那个蓝色的Javascript 如何在QML'内排列矩形;什么是窗格? 下面的代码导致:请只考虑里面有蓝色边框和蓝色框的粉盒。< /P>,javascript,qt,qml,Javascript,Qt,Qml,我想把那个蓝色的矩形排列在粉色框的右侧。实现这一目标的方法是什么?为什么锚失败了 这是因为如果在将指定给锚点的行布局外部定义蓝色矩形,则会出现行布局。rowlayout将替代路线定位 import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Layouts 1.12 import QtQuick.Controls 2.12 Window { id: window; visible: true; width
矩形
排列在粉色框的右侧。实现这一目标的方法是什么?为什么锚失败了
这是因为如果在将指定给锚点的行布局外部定义蓝色矩形,则会出现行布局。rowlayout将替代路线定位
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
Window
{
id: window; visible: true; width: 1000; height: 1000
Pane
{
id: pane
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
height: 50; width: 200
Layout.fillWidth: true
background:
Rectangle
{
id: rect
height: parent.height; width: parent.width
color: "pink";
border.color: "blue";
border.width: 2
}
RowLayout
{
width: parent.width; height: 50
Flickable
{
id: flickable
parent: rect
anchors.fill: parent
TextArea.flickable:
TextArea
{
id: messageField
text: "TextArea"
wrapMode: TextArea.Wrap
}
ScrollBar.vertical: ScrollBar { }
}
Rectangle
{
id: sendButton
parent: rect
anchors.right: rect.right; anchors.rightMargin: 2
anchors.top: rect.top; anchors.topMargin: 2
height: 20; width: 20
color: "blue"
}
}
}
}