diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 36d4ac2d..8758db5a 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1028,9 +1028,16 @@ void MainWindow::setRecordsetLabel() // Update the validator of the goto row field gotoValidator->setRange(0, total); + // When there is no query for this table (i.e. no table is selected), there is no row count query either which in turn means + // that the row count query will never finish. And because of this the row count will be forever unknown. To avoid always showing + // a misleading "determining row count" text in the UI we set the row count status to complete here for empty queries. + auto row_count_available = m_browseTableModel->rowCountAvailable(); + if(m_browseTableModel->query().isEmpty()) + row_count_available = SqliteTableModel::RowCount::Complete; + // Update the label showing the current position QString txt; - switch(m_browseTableModel->rowCountAvailable()) + switch(row_count_available) { case SqliteTableModel::RowCount::Unknown: txt = tr("determining row count..."); diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index 187c586e..941b6a86 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -100,6 +100,7 @@ void SqliteTableModel::reset() beginResetModel(); clearCache(); + m_sQuery.clear(); m_query.clear(); m_headers.clear(); m_vDataTypes.clear();