Skip to content

Commit a1f506b

Browse files
committed
Fix not working filters.
Closes issue sqlitebrowser#46.
1 parent 6057eda commit a1f506b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/MainWindow.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,8 @@ void MainWindow::init()
7777
ui->dbTreeWidget->setColumnWidth(0, 300);
7878

7979
// Set up filter row
80-
FilterTableHeader* tableHeader = new FilterTableHeader(ui->dataTable);
81-
connect(tableHeader, SIGNAL(filterChanged(int,QString)), m_browseTableModel, SLOT(updateFilter(int,QString)));
82-
connect(tableHeader, SIGNAL(filterChanged(int,QString)), this, SLOT(setRecordsetLabel()));
83-
ui->dataTable->setHorizontalHeader(tableHeader);
80+
m_tableHeader = new FilterTableHeader(ui->dataTable);
81+
ui->dataTable->setHorizontalHeader(m_tableHeader);
8482

8583
// Create the actions for the recently opened dbs list
8684
for(int i = 0; i < MaxRecentFiles; ++i) {
@@ -118,7 +116,8 @@ void MainWindow::init()
118116
ui->statusbar->addPermanentWidget(statusEncodingLabel);
119117

120118
// Connect some more signals and slots
121-
connect(tableHeader, SIGNAL(sectionClicked(int)), this, SLOT(browseTableHeaderClicked(int)));
119+
connect(m_tableHeader, SIGNAL(filterChanged(int,QString)), this, SLOT(setRecordsetLabel()));
120+
connect(m_tableHeader, SIGNAL(sectionClicked(int)), this, SLOT(browseTableHeaderClicked(int)));
122121
connect(ui->dataTable->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setRecordsetLabel()));
123122
connect(editWin, SIGNAL(goingAway()), this, SLOT(editWinAway()));
124123
connect(editWin, SIGNAL(updateRecordText(int, int, QByteArray)), this, SLOT(updateRecordText(int, int, QByteArray)));
@@ -365,6 +364,7 @@ void MainWindow::fileClose()
365364
// Delete the model for the Browse tab and create a new one
366365
delete m_browseTableModel;
367366
m_browseTableModel = new SqliteTableModel(this, &db, PreferencesDialog::getSettingsValue("db", "prefetchsize").toInt());
367+
connect(m_tableHeader, SIGNAL(filterChanged(int,QString)), m_browseTableModel, SLOT(updateFilter(int,QString)));
368368

369369
// Manually update the recordset label inside the Browse tab now
370370
setRecordsetLabel();

src/MainWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class DbStructureModel;
1919
class QNetworkReply;
2020
class QNetworkAccessManager;
2121
class QTreeWidgetItem;
22+
class FilterTableHeader;
2223

2324
namespace Ui {
2425
class MainWindow;
@@ -67,6 +68,7 @@ class MainWindow : public QMainWindow
6768

6869
SqliteTableModel* m_browseTableModel;
6970
SqliteTableModel* m_currentPlotModel;
71+
FilterTableHeader* m_tableHeader;
7072
QMenu *popupTableMenu;
7173
QMenu *recentFilesMenu;
7274

0 commit comments

Comments
 (0)