1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-23 16:28:19 +01:00

Make seeking with keys behaviour consistent.

This commit is contained in:
Eduardo Sánchez Muñoz 2015-07-02 13:54:11 +02:00
parent 625a995751
commit 758444de5f
2 changed files with 13 additions and 0 deletions

View File

@ -98,6 +98,18 @@ void TrackSliderSlider::leaveEvent(QEvent* e) {
popup_->hide();
}
void TrackSliderSlider::keyPressEvent(QKeyEvent* event) {
if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Down) {
if (isEnabled()) setValue(value() - 1 * kMsecPerSec);
event->accept();
} else if (event->key() == Qt::Key_Right || event->key() == Qt::Key_Up) {
if (isEnabled()) setValue(value() + 1 * kMsecPerSec);
event->accept();
} else {
QSlider::keyPressEvent(event);
}
}
void TrackSliderSlider::UpdateDeltaTime() {
if (popup_->isVisible()) {
int delta_seconds = mouse_hover_seconds_ - (value() / kMsecPerSec);

View File

@ -35,6 +35,7 @@ class TrackSliderSlider : public QSlider {
void mouseMoveEvent(QMouseEvent* e);
void enterEvent(QEvent*);
void leaveEvent(QEvent*);
void keyPressEvent(QKeyEvent* event);
private slots:
void UpdateDeltaTime();