mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
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:
@@ -1005,3 +1005,9 @@ void ExtendedTableWidget::sortByColumns(const std::vector<sqlb::SortedColumn>& c
|
||||
else
|
||||
sqlite_model->sort(columns);
|
||||
}
|
||||
|
||||
void ExtendedTableWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||
{
|
||||
QTableView::currentChanged(current, previous);
|
||||
emit currentIndexChanged(current, previous);
|
||||
}
|
||||
|
||||
@@ -74,8 +74,7 @@ signals:
|
||||
void openFileFromDropEvent(QString);
|
||||
void selectedRowsToBeDeleted();
|
||||
void editCondFormats(int column);
|
||||
// Make the inherited protected signal public
|
||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void currentIndexChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
|
||||
private:
|
||||
void copyMimeData(const QModelIndexList& fromIndices, QMimeData* mimeData, const bool withHeaders, const bool inSQL);
|
||||
@@ -98,6 +97,7 @@ protected:
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
void dragMoveEvent(QDragMoveEvent* event) override;
|
||||
void dropEvent(QDropEvent* event) override;
|
||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override;
|
||||
|
||||
FilterTableHeader* m_tableHeader;
|
||||
QMenu* m_contextMenu;
|
||||
|
||||
@@ -193,7 +193,7 @@ TableBrowser::TableBrowser(QWidget* parent) :
|
||||
clearAllCondFormats(column);
|
||||
});
|
||||
|
||||
connect(ui->dataTable, &ExtendedTableWidget::currentChanged, this, [this](const QModelIndex ¤t, const QModelIndex &) {
|
||||
connect(ui->dataTable, &ExtendedTableWidget::currentIndexChanged, this, [this](const QModelIndex ¤t, 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("");
|
||||
|
||||
Reference in New Issue
Block a user