VideoFillMode.qml Example File
multimedia/video/qmlvideo/qml/qmlvideo/VideoFillMode.qml
import QtQuick 2.0
import QtMultimedia 5.0
Scene {
id: root
Content {
id: content
anchors.centerIn: parent
width: parent.contentWidth
contentType: "video"
source: parent.source1
volume: parent.volume
onVideoFramePainted: root.videoFramePainted()
}
Button {
id: button
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
margins: parent.margins
}
width: Math.max(parent.width, parent.height) / 5
height: root.buttonHeight
text: "PreserveAspectFit"
onClicked: {
if (!content.dummy) {
var video = content.contentItem()
if (video.fillMode === VideoOutput.Stretch) {
video.fillMode = VideoOutput.PreserveAspectFit
text = "PreserveAspectFit"
} else if (video.fillMode === VideoOutput.PreserveAspectFit) {
video.fillMode = VideoOutput.PreserveAspectCrop
text = "PreserveAspectCrop"
} else {
video.fillMode = VideoOutput.Stretch
text = "Stretch"
}
}
}
}
Component.onCompleted: root.content = content
}