Skip to content

Commit

Permalink
examples/QMLPlayer: do not update preview if move without press
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Jan 18, 2016
1 parent 188aec6 commit 1e93a27
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 7 additions & 1 deletion examples/QMLPlayer/qml/QMLPlayer/ControlPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ Rectangle {
// return
if (playState == "stop")
return
if (pos.y > -previewText.height && pos.y <= height/2)
return
preview.state = dpos.y > 0 ? "out" : "out_"
}
onHoverAt: {
Expand Down Expand Up @@ -189,6 +191,10 @@ Rectangle {
moved = 0
}
onMouseXChanged: {
if (!pressed) {
mouse.accepted = false
return
}
mouse.accepted = true
var x1 = mapToItem(progress, mouseX, 0).x
var dx = x1 - gPos
Expand Down Expand Up @@ -219,7 +225,7 @@ Rectangle {
name: "out_"
PropertyChanges {
target: preview
anchors.bottomMargin: -preview.height
anchors.bottomMargin: -(preview.height + progress.height)
opacity: 0
}
}
Expand Down
9 changes: 6 additions & 3 deletions examples/QMLPlayer/qml/QMLPlayer/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,13 @@ Rectangle {
}
if (player.playbackState == MediaPlayer.StoppedState || !player.hasVideo)
return;
if (mouseY < control.y - control.previewHeight)
if (mouseY < control.y - control.previewHeight) {
control.hidePreview() // TODO: check previw hovered too
else
control.showPreview(mouseX/parent.width)
} else {
if (pressed) {
control.showPreview(mouseX/parent.width)
}
}
}
}
}
Expand Down

0 comments on commit 1e93a27

Please sign in to comment.