Hide TrackSliderPopup on exit from popup

The previous behavior exited on leaving TrackSliderSlider,
which causes the popup to flicker, as it is shown and
hidden rapidly.
This commit is contained in:
Antonio Russo 2018-02-24 11:23:24 -05:00 committed by John Maguire
parent 43e1b69229
commit f629d37315
4 changed files with 6 additions and 6 deletions

View File

@ -66,6 +66,11 @@ void TrackSliderPopup::paintEvent(QPaintEvent*) {
p.drawPixmap(0, 0, pixmap_);
}
void TrackSliderPopup::leaveEvent(QEvent* e) {
QWidget::leaveEvent(e);
hide();
}
void TrackSliderPopup::UpdatePixmap() {
const int text_width =
qMax(font_metrics_.width(text_), small_font_metrics_.width(small_text_));

View File

@ -33,6 +33,7 @@ class TrackSliderPopup : public QWidget {
protected:
void paintEvent(QPaintEvent*);
void leaveEvent(QEvent*);
private:
static const int kTextMargin;

View File

@ -103,11 +103,6 @@ void TrackSliderSlider::enterEvent(QEvent* e) {
}
}
void TrackSliderSlider::leaveEvent(QEvent* e) {
QSlider::leaveEvent(e);
popup_->hide();
}
void TrackSliderSlider::keyPressEvent(QKeyEvent* event) {
if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Down) {
emit SeekBackward();

View File

@ -39,7 +39,6 @@ signals:
void mouseMoveEvent(QMouseEvent* e);
void wheelEvent(QWheelEvent *e);
void enterEvent(QEvent*);
void leaveEvent(QEvent*);
void keyPressEvent(QKeyEvent* event);
private slots: