@@ -24,6 +24,7 @@ SqliteTableModel::SqliteTableModel(DBBrowserDB& db, QObject* parent, const QStri
2424 , m_db(db)
2525 , m_lifeCounter(0 )
2626 , m_currentRowCount(0 )
27+ , m_realRowCount(0 )
2728 , m_encoding(encoding)
2829{
2930 // Load initial settings first
@@ -94,6 +95,11 @@ void SqliteTableModel::handleRowCountComplete (int life_id, int num_rows)
9495 if (life_id < m_lifeCounter)
9596 return ;
9697
98+ m_realRowCount = static_cast <unsigned int >(num_rows);
99+ if (num_rows > m_rowsLimit) {
100+ num_rows = m_rowsLimit;
101+ }
102+
97103 m_rowCountAvailable = RowCount::Complete;
98104 handleFinishedFetch (life_id, static_cast <unsigned int >(num_rows), static_cast <unsigned int >(num_rows));
99105
@@ -175,6 +181,11 @@ int SqliteTableModel::rowCount(const QModelIndex&) const
175181 return static_cast <int >(m_currentRowCount);
176182}
177183
184+ int SqliteTableModel::realRowCount () const
185+ {
186+ return static_cast <int >(m_realRowCount);
187+ }
188+
178189int SqliteTableModel::columnCount (const QModelIndex&) const
179190{
180191 return static_cast <int >(m_headers.size ());
@@ -662,6 +673,7 @@ bool SqliteTableModel::insertRows(int row, int count, const QModelIndex& parent)
662673 {
663674 m_cache.insert (i + static_cast <size_t >(row), std::move (tempList.at (i)));
664675 m_currentRowCount++;
676+ m_realRowCount++;
665677 }
666678 endInsertRows ();
667679
@@ -695,6 +707,7 @@ bool SqliteTableModel::removeRows(int row, int count, const QModelIndex& parent)
695707 {
696708 m_cache.erase (static_cast <size_t >(row + i));
697709 m_currentRowCount--;
710+ m_realRowCount--;
698711 }
699712
700713 endRemoveRows ();
@@ -837,6 +850,7 @@ void SqliteTableModel::clearCache()
837850 m_cache.clear ();
838851
839852 m_currentRowCount = 0 ;
853+ m_realRowCount = 0 ;
840854 m_rowCountAvailable = RowCount::Unknown;
841855}
842856
@@ -1137,6 +1151,7 @@ void SqliteTableModel::reloadSettings()
11371151 m_font = QFont (Settings::getValue (" databrowser" , " font" ).toString ());
11381152 m_font.setPointSize (Settings::getValue (" databrowser" , " fontsize" ).toInt ());
11391153 m_symbolLimit = Settings::getValue (" databrowser" , " symbol_limit" ).toInt ();
1154+ m_rowsLimit = Settings::getValue (" databrowser" , " rows_limit" ).toInt ();
11401155 m_imagePreviewEnabled = Settings::getValue (" databrowser" , " image_preview" ).toBool ();
11411156 m_chunkSize = static_cast <std::size_t >(Settings::getValue (" db" , " prefetchsize" ).toUInt ());
11421157}
0 commit comments