Fix video seeking.

Regression was introduced in d0e854e9d8.

Each time you hide() a widget its mousePress state is reset and
mouseMoveEvent() / mouseReleaseEvent() handlers are never called.

So you can't toggle (hide + show) widgets that are mouse-pressed.

Fixes #4802.
This commit is contained in:
John Preston 2018-06-06 11:56:39 +03:00
parent 4a4544c883
commit 777bf7d8d9
4 changed files with 16 additions and 6 deletions

View File

@ -79,17 +79,21 @@ template <typename Callback>
void Controller::startFading(Callback start) {
if (!_fadeAnimation->animating()) {
showChildren();
_playbackSlider->hide();
_playbackSlider->disablePaint(true);
_childrenHidden = false;
}
start();
if (_fadeAnimation->animating()) {
hideChildren();
for (const auto child : children()) {
if (child->isWidgetType() && child != _playbackSlider) {
static_cast<QWidget*>(child)->hide();
}
}
_childrenHidden = true;
} else {
fadeFinished();
}
_playbackSlider->show();
_playbackSlider->disablePaint(false);
}
void Controller::showAnimated() {

View File

@ -2961,9 +2961,6 @@ bool MediaView::eventFilter(QObject *obj, QEvent *e) {
activate = true;
}
if (activate) {
if (_controlsState == ControlsHiding || _controlsState == ControlsHidden) {
int a = 0;
}
activateControls();
}
}

View File

@ -195,7 +195,14 @@ float64 MediaSlider::getOverDuration() const {
return _st.duration;
}
void MediaSlider::disablePaint(bool disabled) {
_paintDisabled = disabled;
}
void MediaSlider::paintEvent(QPaintEvent *e) {
if (_paintDisabled) {
return;
}
Painter p(this);
PainterHighQualityEnabler hq(p);

View File

@ -124,6 +124,7 @@ public:
_alwaysDisplayMarker = alwaysDisplayMarker;
update();
}
void disablePaint(bool disabled);
protected:
void paintEvent(QPaintEvent *e) override;
@ -134,6 +135,7 @@ private:
const style::MediaSlider &_st;
bool _alwaysDisplayMarker = false;
bool _paintDisabled = false;
};