Fix problem with cursor navigation in table browser

This was causing that cursor navigation in table browser did not move the
scroll or that find bar required an additional scrollTo call.

Problem was introduced in 63aabb9601

See comments in PR #2013
This commit is contained in:
mgrojo
2019-09-30 23:41:58 +02:00
parent b7f6bef398
commit 7ca90e0f7e
3 changed files with 11 additions and 6 deletions

View File

@@ -193,7 +193,7 @@ TableBrowser::TableBrowser(QWidget* parent) :
clearAllCondFormats(column);
});
connect(ui->dataTable, &ExtendedTableWidget::currentChanged, this, [this](const QModelIndex &current, const QModelIndex &) {
connect(ui->dataTable, &ExtendedTableWidget::currentIndexChanged, this, [this](const QModelIndex &current, const QModelIndex &) {
// Get cell current format for updating the format toolbar values. Block signals, so the format change is not reapplied.
QFont font;
font.fromString(m_browseTableModel->data(current, Qt::FontRole).toString());
@@ -1389,10 +1389,9 @@ void TableBrowser::find(const QString& expr, bool forward, bool include_first)
const auto match = m_browseTableModel->nextMatch(start, column_list, expr, flags, !forward, include_first);
// Select the next match if we found one
if(match.isValid()) {
if(match.isValid())
ui->dataTable->setCurrentIndex(match);
ui->dataTable->scrollTo(match);
}
// Make the expression control red if no results were found
if(match.isValid() || expr == "")
ui->editFindExpression->setStyleSheet("");