mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-04 01:08:26 +02:00
[ui] sequence player: play-pause sequence using a timer
This commit is contained in:
parent
45a95b5114
commit
47d3089e5b
1 changed files with 35 additions and 1 deletions
|
@ -7,6 +7,8 @@ import Controls 1.0
|
|||
FloatingPane {
|
||||
id: root
|
||||
|
||||
property real fps: 4
|
||||
|
||||
function sequence(vps) {
|
||||
let objs = []
|
||||
for (let i = 0; i < vps.count; i++) {
|
||||
|
@ -27,16 +29,48 @@ FloatingPane {
|
|||
|
||||
QtObject {
|
||||
id: m
|
||||
|
||||
property var currentCameraInit: _reconstruction && _reconstruction.cameraInit ? _reconstruction.cameraInit : undefined
|
||||
property var viewpoints: currentCameraInit ? currentCameraInit.attribute('viewpoints').value : undefined
|
||||
property var sortedViewIds: viewpoints ? sequence(viewpoints) : []
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
|
||||
repeat: true
|
||||
running: false
|
||||
interval: 1000 / fps
|
||||
|
||||
onTriggered: {
|
||||
viewSlider.value = viewSlider.value + 1;
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
Button {
|
||||
id: playButton
|
||||
|
||||
checkable: true
|
||||
checked: false
|
||||
text: checked ? "pause" : "play"
|
||||
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
timer.running = true;
|
||||
}
|
||||
else {
|
||||
timer.running = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: viewSlider
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
@ -45,7 +79,7 @@ FloatingPane {
|
|||
live: true
|
||||
|
||||
from: 0
|
||||
to: Math.max(m.sortedViewIds.length, 1)
|
||||
to: m.sortedViewIds.length + 1
|
||||
|
||||
onValueChanged: {
|
||||
let idx = Math.floor(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue