mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-11 17:34:20 +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();
|
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() {
|
void TrackSliderSlider::UpdateDeltaTime() {
|
||||||
if (popup_->isVisible()) {
|
if (popup_->isVisible()) {
|
||||||
int delta_seconds = mouse_hover_seconds_ - (value() / kMsecPerSec);
|
int delta_seconds = mouse_hover_seconds_ - (value() / kMsecPerSec);
|
||||||
|
@ -35,6 +35,7 @@ class TrackSliderSlider : public QSlider {
|
|||||||
void mouseMoveEvent(QMouseEvent* e);
|
void mouseMoveEvent(QMouseEvent* e);
|
||||||
void enterEvent(QEvent*);
|
void enterEvent(QEvent*);
|
||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*);
|
||||||
|
void keyPressEvent(QKeyEvent* event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void UpdateDeltaTime();
|
void UpdateDeltaTime();
|
||||||
|
Loading…
Reference in New Issue
Block a user