mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-24 00:31:36 +01:00
Make seeking with keys behaviour consistent.
This commit is contained in:
parent
625a995751
commit
758444de5f
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user