QMLウィンドウにネストされたRowLayout
があります。内側の行には2つの画像があります。これらの画像のファイル.png
は(意図的に)かなり大きいです。これらの画像にheight
プロパティを設定しようとすると、それらの画像が小さくなるように設定されても、大きな画像が描画されます。QMLイメージの表示サイズを調整する
私は彼らが小さくなるように取得することができた唯一の方法は、sourceSize.height:100
代わりのheight:100
を設定することです。しかし、これは私が望むものではありません。私は彼らがリロードすることなく上下に拡大縮小できるようにしたい。
画像が含まれている高さがRowLayout
になるようにQMLを修正するにはどうすればよいですか?
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
ApplicationWindow {
width:600; height:300
visible:true
Rectangle {
color:'red'
anchors { top:header.bottom; bottom:footer.top; left:parent.left; right:parent.right }
}
header:RowLayout {
id:header
spacing:0
height:100; width:parent.width
RowLayout {
id:playcontrol
Layout.minimumWidth:200; Layout.maximumWidth:200; Layout.preferredWidth:200
height:parent.height
Image {
// I really want these to take on the height of their row
source:'qrc:/img/play.png'
width:100; height:100
fillMode:Image.PreserveAspectFit; clip:true
}
Image {
source:'qrc:/img/skip.png'
width:100; height:100
fillMode:Image.PreserveAspectFit; clip:true
}
}
Rectangle {
color:'#80CC00CC'
Layout.minimumWidth:200
Layout.preferredWidth:parent.width*0.7
Layout.fillWidth:true; Layout.fillHeight:true
height:parent.height
}
}
footer:Rectangle { height:100; color:'blue' }
}