0
私のアプリケーションの基本レイアウトを作成しようとしています。私はそれがこのように見えるようにします。これはこれまでの私のセットアップです。Layout.fillHeight:trueを設定する矩形が見えないQtクイック2
main.qml
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("basic layout")
ColumnLayout {
anchors.fill: parent
spacing: 0
Header {
Layout.fillWidth: true
height: 50
}
Body {
Layout.fillWidth: true
Layout.fillHeight: true
}
Footer {
Layout.fillWidth: true
height: 30
}
}
}
Header.qml
import QtQuick 2.7
import QtQuick.Layouts 1.3
Rectangle {
color: "red"
}
Footer.qml
import QtQuick 2.7
import QtQuick.Layouts 1.3
Rectangle {
color: "blue"
}
Body.qml
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
Item {
RowLayout {
anchors.fill: parent
Rectangle {
color: "red"
width: 100
Layout.fillHeight: true
}
Rectangle {
color: "green"
width: 400
Layout.fillHeight: true
}
Rectangle {
color: "blue"
width: 400
Layout.fillHeight: true
}
Rectangle {
color: "black"
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}
それが実行されたときBody
セクションでは、空白以外何もありません。 長方形を手作業でサイズ表示すると、長方形が表示されます。 anchors.fill: parent
をのレベルにItem
に追加しようとしました。それでも結果は同じです。何が間違っているのですか?
を使用してRowLayoutに長方形の幅を設定する必要があります。私はちょうどあなたのコードをコピーし、それを実行し、あなたの最初の写真のように(ほとんど)見えます。 – derM
私もあなたの問題を再現できません。私のために働いてください5.9.1 –
これは私のオペレーティングシステムの問題かもしれませんか?私はLubuntuを使用しています。 Qt version 5.9.2 – CoderS