mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-17 01:09:36 -06:00
Improve focusing the filter line with keyboard shortcut II
- Focus the filter line when setting something as filter. - Instead of stopping focus cycling at the end of the filter header, pass the focus up to the table. - Change keyReleaseEvent to comply with documentation. See issue #3439
This commit is contained in:
@@ -880,6 +880,7 @@ void ExtendedTableWidget::useAsFilter(const QString& filterOperator, bool binary
|
||||
m_tableHeader->setFilter(column, value + filterOperator);
|
||||
else
|
||||
m_tableHeader->setFilter(column, filterOperator + value + operatorSuffix);
|
||||
m_tableHeader->setFocusColumn(column);
|
||||
}
|
||||
|
||||
void ExtendedTableWidget::duplicateUpperCell()
|
||||
|
||||
@@ -67,20 +67,30 @@ void FilterLineEdit::delayedSignalTimerTriggered()
|
||||
|
||||
void FilterLineEdit::keyReleaseEvent(QKeyEvent* event)
|
||||
{
|
||||
bool actedUponKey = false;
|
||||
if(event->key() == Qt::Key_Tab)
|
||||
{
|
||||
if(filterList && columnNumber < filterList->size() - 1)
|
||||
{
|
||||
filterList->at(columnNumber + 1)->setFocus();
|
||||
event->accept();
|
||||
} else {
|
||||
QWidget* grandParent = parentWidget()->parentWidget();
|
||||
// Pass focus to the table (grandparent).
|
||||
// Parent would be the table header, which would cycle back to the first
|
||||
// column (due to proxying).
|
||||
if(grandParent)
|
||||
grandParent->setFocus();
|
||||
}
|
||||
actedUponKey = true;
|
||||
} else if(event->key() == Qt::Key_Backtab) {
|
||||
if(filterList && columnNumber > 0)
|
||||
{
|
||||
filterList->at(columnNumber - 1)->setFocus();
|
||||
event->accept();
|
||||
actedUponKey = true;
|
||||
}
|
||||
}
|
||||
if(!actedUponKey)
|
||||
QLineEdit::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
void FilterLineEdit::focusInEvent(QFocusEvent* event)
|
||||
|
||||
Reference in New Issue
Block a user