「QMLのコントロール - RowとRowLayout」の版間の差分

📢 Webサイト閉鎖と移転のお知らせ
このWebサイトは2026年9月に閉鎖いたします。
新しい記事は移転先で追加しております。(旧サイトでは記事を追加しておりません)

 
(同じ利用者による、間の1版が非表示)
131行目: 131行目:
  }
  }
  </syntaxhighlight>
  </syntaxhighlight>
<br>
<code>Row</code>内のアイテムが表示されていない場合、または、幅や高さが0の場合は、そのアイテムはレイアウトされずに<code>Row</code>内に表示されない。<br>
<br>
また、<code>Row</code>は自動的に子アイテムを水平方向に配置するため、<br>
<code>Row</code>内の子アイテムはx位置を設定したり、<code>left</code>、<code>right</code>、<code>anchors.horizontalCenter</code>、<code>fill</code>、<code>centerIn</code>等のアンカーを使用して水平方向に固定してはならない。<br>
もし、上記の動作を行う必要がある場合は、<code>Row</code>を使用せずにアイテムを配置する。<br>
<br>
なお、<code>Row</code>内のアイテムは<code>Positioner</code>を使用して、<code>Row</code>内の位置に関する詳細情報にアクセスできる。<br>
<br>
<code>Row</code>やその他の関連するポジショナの使用方法については、[[QMLのコントロール - Positioner|Positioner]]を参照する。<br>
また、<code>Column</code>、<code>Grid</code>、<code>Flow</code>、<code>RowLayout</code>も参照すること。<br>
<br><br>
<br><br>


278行目: 289行目:


==== サンプルコード ====
==== サンプルコード ====
以下の例は、RowLayoutのサンプルコードである。<br>
以下の例は、<code>RowLayout</code>のサンプルコードである。<br>
[[ファイル:QML RowLayout 1.png|フレームなし|中央]]
  <syntaxhighlight lang="qml">
  <syntaxhighlight lang="qml">
  RowLayout {
  RowLayout {
284行目: 296行目:
     anchors.fill: parent
     anchors.fill: parent
     spacing: 6
     spacing: 6
     Rectangle {
     Rectangle {
       color: 'teal'
       color: 'teal'
291行目: 304行目:
       Layout.maximumWidth: 300
       Layout.maximumWidth: 300
       Layout.minimumHeight: 150
       Layout.minimumHeight: 150
       Text {
       Text {
           anchors.centerIn: parent
           anchors.centerIn: parent
303行目: 317行目:
       Layout.preferredWidth: 200
       Layout.preferredWidth: 200
       Layout.preferredHeight: 100
       Layout.preferredHeight: 100
       Text {
       Text {
           anchors.centerIn: parent
           anchors.centerIn: parent