1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-20 22:02:59 +00:00
mpv/DOCS/client_api_examples/qml_direct/main.qml
wm4 f551fbaa25 DOCS/client_api_examples: add an alternative qml example
This one avoids use of a FBO. It's less flexible, because it uses works
around the whole QML rendering API. It seems to be the only way to get
OpenGL rendering without any indirections, though.

Parts of this example were insipired by Qt's "Squircle" example.

Also add a README file with a short description of each example, to
reduce the initial confusing.
2015-01-08 02:40:30 +01:00

50 lines
1.1 KiB
QML

import QtQuick 2.0
import QtQuick.Controls 1.0
import mpvtest 1.0
Item {
width: 1280
height: 720
MpvObject {
id: renderer
// This object isn't real and not visible; it just renders into the
// background of the containing Window.
width: 0
height: 0
}
MouseArea {
anchors.fill: parent
onClicked: renderer.command(["loadfile", "../../../test.mkv"])
}
Rectangle {
id: labelFrame
anchors.margins: -50
radius: 5
color: "white"
border.color: "black"
opacity: 0.8
anchors.fill: box
}
Row {
id: box
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 100
Text {
anchors.margins: 10
wrapMode: Text.WordWrap
text: "QtQuick and mpv are both rendering stuff.\n
In this example, mpv is always in the background.\n
Click to load ../../../test.mkv"
}
}
}