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

Searchbar clear #3262

Merged
merged 11 commits into from
Feb 17, 2021
9 changes: 8 additions & 1 deletion src/widget/wsearchlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ WSearchLineEdit::WSearchLineEdit(QWidget* pParent)

m_clearButton->setCursor(Qt::ArrowCursor);
m_clearButton->setObjectName(QStringLiteral("SearchClearButton"));
m_clearButton->setFocusPolicy(Qt::ClickFocus);
Copy link
Member

@ronso0 ronso0 Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree:
how do you quickly clear the search from a controller now?
Scrolling all the way to the top of the search history is no option for me.

I know this was requested on Zulip because someone uses a custom mappin for the Trax encoder press and wants to reduce the Tabs necessary to get to the tracks table, but the default most common mapping is [Library],GoToItem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current system is also problematic for blind users as the tab order changes depending on the state of the search bar.

I'm ambivalent about the focus behaviour. What's the general stand towards this ?

// Query style for arrow width and frame border
updateStyleMetrics();

Expand Down Expand Up @@ -280,7 +281,13 @@ QString WSearchLineEdit::getSearchText() const {
bool WSearchLineEdit::eventFilter(QObject* obj, QEvent* event) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_Down) {
if (keyEvent->key() == Qt::Key_Up) {
if (findCurrentTextIndex() == 0) {
setCurrentIndex(-1);
setCurrentText("");
return true;
}
} else if (keyEvent->key() == Qt::Key_Down) {
// after clearing the text field the down key is expected to
// show the last entry
if (currentText().isEmpty()) {
Expand Down