Skip to content

Commit

Permalink
sending key event to library widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolau Leal Werneck committed Apr 16, 2024
1 parent 567e961 commit cb745eb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/library/librarycontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,16 @@ void LibraryControl::slotMoveTrackBackward(double v) {
}

void LibraryControl::slotMoveTrack(double v) {
if (!m_pLibraryWidget) {
return;
}

const auto key = (v < 0) ? Qt::Key_Up : Qt::Key_Down;
const auto times = static_cast<unsigned short>(std::abs(v));
emitKeyEvent(QKeyEvent{
QEvent::KeyPress, key, Qt::AltModifier, QString(), false, times});
QKeyEvent event = QKeyEvent{
QEvent::KeyPress, key, Qt::AltModifier, QString(), false, times};
QApplication::sendEvent(m_pLibraryWidget, &event);

}

void LibraryControl::emitKeyEvent(QKeyEvent&& event) {
Expand Down

0 comments on commit cb745eb

Please sign in to comment.