@@ -27,6 +27,7 @@ SqliteTableModel::SqliteTableModel(DBBrowserDB& db, QObject* parent, const QStri
2727 , m_db(db)
2828 , m_lifeCounter(0 )
2929 , m_currentRowCount(0 )
30+ , m_realRowCount(0 )
3031 , m_encoding(encoding)
3132{
3233 // Load initial settings first
@@ -97,6 +98,11 @@ void SqliteTableModel::handleRowCountComplete (int life_id, int num_rows)
9798 if (life_id < m_lifeCounter)
9899 return ;
99100
101+ m_realRowCount = static_cast <unsigned int >(num_rows);
102+ if (num_rows > m_rowsLimit) {
103+ num_rows = m_rowsLimit;
104+ }
105+
100106 m_rowCountAvailable = RowCount::Complete;
101107 handleFinishedFetch (life_id, static_cast <unsigned int >(num_rows), static_cast <unsigned int >(num_rows));
102108
@@ -178,6 +184,11 @@ int SqliteTableModel::rowCount(const QModelIndex&) const
178184 return static_cast <int >(m_currentRowCount);
179185}
180186
187+ int SqliteTableModel::realRowCount () const
188+ {
189+ return static_cast <int >(m_realRowCount);
190+ }
191+
181192int SqliteTableModel::columnCount (const QModelIndex&) const
182193{
183194 return static_cast <int >(m_headers.size ());
@@ -637,6 +648,7 @@ bool SqliteTableModel::insertRows(int row, int count, const QModelIndex& parent)
637648 {
638649 m_cache.insert (i + static_cast <size_t >(row), std::move (tempList.at (i)));
639650 m_currentRowCount++;
651+ m_realRowCount++;
640652 }
641653 endInsertRows ();
642654
@@ -670,6 +682,7 @@ bool SqliteTableModel::removeRows(int row, int count, const QModelIndex& parent)
670682 {
671683 m_cache.erase (static_cast <size_t >(row + i));
672684 m_currentRowCount--;
685+ m_realRowCount--;
673686 }
674687
675688 endRemoveRows ();
@@ -868,6 +881,7 @@ void SqliteTableModel::clearCache()
868881 m_cache.clear ();
869882
870883 m_currentRowCount = 0 ;
884+ m_realRowCount = 0 ;
871885 m_rowCountAvailable = RowCount::Unknown;
872886}
873887
@@ -1166,6 +1180,7 @@ void SqliteTableModel::reloadSettings()
11661180 m_font = QFont (Settings::getValue (" databrowser" , " font" ).toString ());
11671181 m_font.setPointSize (Settings::getValue (" databrowser" , " fontsize" ).toInt ());
11681182 m_symbolLimit = Settings::getValue (" databrowser" , " symbol_limit" ).toInt ();
1183+ m_rowsLimit = Settings::getValue (" databrowser" , " rows_limit" ).toInt ();
11691184 m_imagePreviewEnabled = Settings::getValue (" databrowser" , " image_preview" ).toBool ();
11701185 m_chunkSize = static_cast <std::size_t >(Settings::getValue (" db" , " prefetchsize" ).toUInt ());
11711186}
0 commit comments