Skip to content

Commit b00c4f7

Browse files
committed
plot: Add button to load all data
See issue #499. This also fixes a bug introduced in 6784a6a which effectively disabled the partial prefetch mechanism on large tables.
1 parent cb79aba commit b00c4f7

3 files changed

Lines changed: 87 additions & 39 deletions

File tree

‎src/MainWindow.cpp‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,10 +1713,6 @@ void MainWindow::updatePlot(SqliteTableModel *model, bool update)
17131713

17141714
if(model)
17151715
{
1716-
// Make sure all data is loaded before trying to plot anything
1717-
while(model->canFetchMore())
1718-
model->fetchMore();
1719-
17201716
for(int i = 0; i < model->columnCount(); ++i)
17211717
{
17221718
QVariant::Type columntype = guessdatatype(model, i);
@@ -2493,3 +2489,16 @@ void MainWindow::browseDataSetDefaultTableEncoding()
24932489
{
24942490
browseDataSetTableEncoding(true);
24952491
}
2492+
2493+
void MainWindow::browseDataFetchAllData()
2494+
{
2495+
if(m_browseTableModel)
2496+
{
2497+
// Make sure all data is loaded
2498+
while(m_browseTableModel->canFetchMore())
2499+
m_browseTableModel->fetchMore();
2500+
2501+
// Update plot
2502+
updatePlot(m_browseTableModel);
2503+
}
2504+
}

‎src/MainWindow.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ private slots:
226226
void showRowidColumn(bool show);
227227
void browseDataSetTableEncoding(bool forAllTables = false);
228228
void browseDataSetDefaultTableEncoding();
229+
void browseDataFetchAllData();
229230
};
230231

231232
#endif

‎src/MainWindow.ui‎

Lines changed: 73 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@
333333
<rect>
334334
<x>0</x>
335335
<y>0</y>
336-
<width>280</width>
336+
<width>468</width>
337337
<height>558</height>
338338
</rect>
339339
</property>
@@ -1255,6 +1255,17 @@
12551255
</property>
12561256
</widget>
12571257
</item>
1258+
<item>
1259+
<widget class="QToolButton" name="buttonLoadAllData">
1260+
<property name="toolTip">
1261+
<string>Load all data. This has only an effect if not all data has been fetched from the table yet due to the partial fetch mechanism.</string>
1262+
</property>
1263+
<property name="icon">
1264+
<iconset resource="icons/icons.qrc">
1265+
<normaloff>:/icons/keyword</normaloff>:/icons/keyword</iconset>
1266+
</property>
1267+
</widget>
1268+
</item>
12581269
</layout>
12591270
</widget>
12601271
</item>
@@ -1867,6 +1878,16 @@
18671878
<tabstop>spinPragmaWalAutoCheckpoint</tabstop>
18681879
<tabstop>comboLogSubmittedBy</tabstop>
18691880
<tabstop>buttonLogClear</tabstop>
1881+
<tabstop>mainTab</tabstop>
1882+
<tabstop>buttonBegin</tabstop>
1883+
<tabstop>buttonEnd</tabstop>
1884+
<tabstop>tabSqlAreas</tabstop>
1885+
<tabstop>treePlotColumns</tabstop>
1886+
<tabstop>comboLineType</tabstop>
1887+
<tabstop>comboPointShape</tabstop>
1888+
<tabstop>butSavePlot</tabstop>
1889+
<tabstop>buttonLoadAllData</tabstop>
1890+
<tabstop>treeSchemaDock</tabstop>
18701891
</tabstops>
18711892
<resources>
18721893
<include location="icons/icons.qrc"/>
@@ -1959,8 +1980,8 @@
19591980
<slot>addRecord()</slot>
19601981
<hints>
19611982
<hint type="sourcelabel">
1962-
<x>443</x>
1963-
<y>141</y>
1983+
<x>402</x>
1984+
<y>143</y>
19641985
</hint>
19651986
<hint type="destinationlabel">
19661987
<x>399</x>
@@ -1975,8 +1996,8 @@
19751996
<slot>deleteRecord()</slot>
19761997
<hints>
19771998
<hint type="sourcelabel">
1978-
<x>565</x>
1979-
<y>141</y>
1999+
<x>506</x>
2000+
<y>143</y>
19802001
</hint>
19812002
<hint type="destinationlabel">
19822003
<x>399</x>
@@ -1991,8 +2012,8 @@
19912012
<slot>navigatePrevious()</slot>
19922013
<hints>
19932014
<hint type="sourcelabel">
1994-
<x>74</x>
1995-
<y>585</y>
2015+
<x>86</x>
2016+
<y>539</y>
19962017
</hint>
19972018
<hint type="destinationlabel">
19982019
<x>399</x>
@@ -2007,8 +2028,8 @@
20072028
<slot>navigateNext()</slot>
20082029
<hints>
20092030
<hint type="sourcelabel">
2010-
<x>168</x>
2011-
<y>585</y>
2031+
<x>183</x>
2032+
<y>539</y>
20122033
</hint>
20132034
<hint type="destinationlabel">
20142035
<x>399</x>
@@ -2023,8 +2044,8 @@
20232044
<slot>navigateGoto()</slot>
20242045
<hints>
20252046
<hint type="sourcelabel">
2026-
<x>413</x>
2027-
<y>586</y>
2047+
<x>365</x>
2048+
<y>539</y>
20282049
</hint>
20292050
<hint type="destinationlabel">
20302051
<x>399</x>
@@ -2039,8 +2060,8 @@
20392060
<slot>navigateGoto()</slot>
20402061
<hints>
20412062
<hint type="sourcelabel">
2042-
<x>565</x>
2043-
<y>586</y>
2063+
<x>506</x>
2064+
<y>538</y>
20442065
</hint>
20452066
<hint type="destinationlabel">
20462067
<x>399</x>
@@ -2295,8 +2316,8 @@
22952316
<slot>createTreeContextMenu(QPoint)</slot>
22962317
<hints>
22972318
<hint type="sourcelabel">
2298-
<x>101</x>
2299-
<y>125</y>
2319+
<x>111</x>
2320+
<y>261</y>
23002321
</hint>
23012322
<hint type="destinationlabel">
23022323
<x>399</x>
@@ -2343,8 +2364,8 @@
23432364
<slot>loadPragmas()</slot>
23442365
<hints>
23452366
<hint type="sourcelabel">
2346-
<x>101</x>
2347-
<y>125</y>
2367+
<x>111</x>
2368+
<y>540</y>
23482369
</hint>
23492370
<hint type="destinationlabel">
23502371
<x>-1</x>
@@ -2359,8 +2380,8 @@
23592380
<slot>savePragmas()</slot>
23602381
<hints>
23612382
<hint type="sourcelabel">
2362-
<x>101</x>
2363-
<y>125</y>
2383+
<x>111</x>
2384+
<y>540</y>
23642385
</hint>
23652386
<hint type="destinationlabel">
23662387
<x>802</x>
@@ -2379,8 +2400,8 @@
23792400
<y>126</y>
23802401
</hint>
23812402
<hint type="destinationlabel">
2382-
<x>691</x>
2383-
<y>163</y>
2403+
<x>632</x>
2404+
<y>173</y>
23842405
</hint>
23852406
</hints>
23862407
</connection>
@@ -2395,8 +2416,8 @@
23952416
<y>126</y>
23962417
</hint>
23972418
<hint type="destinationlabel">
2398-
<x>990</x>
2399-
<y>240</y>
2419+
<x>1028</x>
2420+
<y>230</y>
24002421
</hint>
24012422
</hints>
24022423
</connection>
@@ -2407,12 +2428,12 @@
24072428
<slot>setCurrentIndex(int)</slot>
24082429
<hints>
24092430
<hint type="sourcelabel">
2410-
<x>872</x>
2411-
<y>126</y>
2431+
<x>772</x>
2432+
<y>135</y>
24122433
</hint>
24132434
<hint type="destinationlabel">
2414-
<x>987</x>
2415-
<y>240</y>
2435+
<x>1028</x>
2436+
<y>230</y>
24162437
</hint>
24172438
</hints>
24182439
</connection>
@@ -2439,8 +2460,8 @@
24392460
<slot>closeSqlTab(int)</slot>
24402461
<hints>
24412462
<hint type="sourcelabel">
2442-
<x>81</x>
2443-
<y>125</y>
2463+
<x>91</x>
2464+
<y>259</y>
24442465
</hint>
24452466
<hint type="destinationlabel">
24462467
<x>-1</x>
@@ -2663,8 +2684,8 @@
26632684
<slot>navigateEnd()</slot>
26642685
<hints>
26652686
<hint type="sourcelabel">
2666-
<x>189</x>
2667-
<y>573</y>
2687+
<x>223</x>
2688+
<y>539</y>
26682689
</hint>
26692690
<hint type="destinationlabel">
26702691
<x>499</x>
@@ -2679,8 +2700,8 @@
26792700
<slot>navigateBegin()</slot>
26802701
<hints>
26812702
<hint type="sourcelabel">
2682-
<x>69</x>
2683-
<y>140</y>
2703+
<x>50</x>
2704+
<y>539</y>
26842705
</hint>
26852706
<hint type="destinationlabel">
26862707
<x>499</x>
@@ -2727,8 +2748,8 @@
27272748
<slot>jumpToRow(QString,QString,QByteArray)</slot>
27282749
<hints>
27292750
<hint type="sourcelabel">
2730-
<x>60</x>
2731-
<y>105</y>
2751+
<x>70</x>
2752+
<y>242</y>
27322753
</hint>
27332754
<hint type="destinationlabel">
27342755
<x>518</x>
@@ -2800,6 +2821,22 @@
28002821
</hint>
28012822
</hints>
28022823
</connection>
2824+
<connection>
2825+
<sender>buttonLoadAllData</sender>
2826+
<signal>clicked()</signal>
2827+
<receiver>MainWindow</receiver>
2828+
<slot>browseDataFetchAllData()</slot>
2829+
<hints>
2830+
<hint type="sourcelabel">
2831+
<x>1003</x>
2832+
<y>389</y>
2833+
</hint>
2834+
<hint type="destinationlabel">
2835+
<x>1005</x>
2836+
<y>412</y>
2837+
</hint>
2838+
</hints>
2839+
</connection>
28032840
</connections>
28042841
<slots>
28052842
<slot>fileOpen()</slot>
@@ -2860,5 +2897,6 @@
28602897
<slot>showRowidColumn(bool)</slot>
28612898
<slot>browseDataSetTableEncoding()</slot>
28622899
<slot>browseDataSetDefaultTableEncoding()</slot>
2900+
<slot>browseDataFetchAllData()</slot>
28632901
</slots>
28642902
</ui>

0 commit comments

Comments
 (0)