Skip to content

Commit

Permalink
fixup: direct keyevent to current WTracktableView if available
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed May 30, 2024
1 parent 1b5dee3 commit ab8c1d2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/library/librarycontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "widget/wlibrary.h"
#include "widget/wlibrarysidebar.h"
#include "widget/wsearchlineedit.h"
#include "widget/wtracktableview.h"

namespace {
const QString kAppGroup = QStringLiteral("[App]");
Expand Down Expand Up @@ -838,11 +839,17 @@ void LibraryControl::slotMoveTrack(double v) {
return;
}

auto* pTrackTableview = m_pLibraryWidget->getCurrentTrackTableView();
if (!pTrackTableview) {
// no track table view is currently visible
return;
}

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

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

0 comments on commit ab8c1d2

Please sign in to comment.