Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEffectChainPresetSelector: use '[Library], focused_widget' instead of BackTab keystroke #4893

Merged
merged 2 commits into from
Aug 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/widget/wbeatspinbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ bool WBeatSpinBox::event(QEvent* pEvent) {
void WBeatSpinBox::keyPressEvent(QKeyEvent* pEvent) {
// By default, Return & Enter keys apply current value.
// Here, Return, Enter and Escape apply and move focus to tracks table.
// TODO(ronso0) switch to previously focused (library?) widget instead
if (pEvent->key() == Qt::Key_Return ||
pEvent->key() == Qt::Key_Enter ||
pEvent->key() == Qt::Key_Escape) {
Expand Down
11 changes: 5 additions & 6 deletions src/widget/weffectchainpresetselector.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "widget/weffectchainpresetselector.h"

#include <QAbstractItemView>
#include <QApplication>
#include <QPaintEvent>
#include <QStyleOption>
#include <QStylePainter>
#include <QtDebug>

#include "effects/chains/quickeffectchain.h"
#include "effects/effectsmanager.h"
#include "library/library_decl.h"
#include "widget/effectwidgetutils.h"

WEffectChainPresetSelector::WEffectChainPresetSelector(
Expand Down Expand Up @@ -88,12 +88,11 @@ void WEffectChainPresetSelector::slotEffectChainPresetSelected(int index) {
m_pChain->loadChainPreset(
m_pChainPresetManager->getPreset(currentData().toString()));
setBaseTooltip(itemData(index, Qt::ToolTipRole).toString());
// After selecting an effect send Shift+Tab to move focus to the next
// keyboard-focusable widget (tracks table in official skins) in order
// After selecting an effect move focus to the tracks table in order
// to immediately allow keyboard shortcuts again.
QKeyEvent backwardFocusKeyEvent =
QKeyEvent{QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier};
QApplication::sendEvent(this, &backwardFocusKeyEvent);
// TODO(ronso0) switch to previously focused (library?) widget instead
ControlObject::set(ConfigKey("[Library]", "focused_widget"),
static_cast<double>(FocusWidget::TracksTable));
}

void WEffectChainPresetSelector::slotChainPresetChanged(const QString& name) {
Expand Down
1 change: 1 addition & 0 deletions src/widget/weffectselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void WEffectSelector::slotEffectSelected(int newIndex) {
setBaseTooltip(itemData(newIndex, Qt::ToolTipRole).toString());
// After selecting an effect send Shift+Tab to move focus to tracks table
// in order to immediately allow keyboard shortcuts again.
// TODO(ronso0) switch to previously focused (library?) widget instead
ControlObject::set(ConfigKey("[Library]", "focused_widget"),
static_cast<double>(FocusWidget::TracksTable));
}
Expand Down