Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/433.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
Javascript 如何在QML'内排列矩形;什么是窗格? 下面的代码导致:请只考虑里面有蓝色边框和蓝色框的粉盒。< /P>_Javascript_Qt_Qml - Fatal编程技术网

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"
          }
       }
    }

}