File tree Expand file tree Collapse file tree 3 files changed +10
-13
lines changed
Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -128,13 +128,3 @@ void FilterTableHeader::setFilter(size_t column, const QString& value)
128128 if (column < filterWidgets.size ())
129129 filterWidgets.at (column)->setText (value);
130130}
131-
132- void FilterTableHeader::setFiltersVisible (bool visible)
133- {
134- // Loop through all widgets
135- for (size_t i=0 ; i < filterWidgets.size (); ++i)
136- {
137- // Get the current widget, and set it visible or not
138- filterWidgets.at (i)->setVisible (visible);
139- }
140- }
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ class FilterTableHeader : public QHeaderView
1515 explicit FilterTableHeader (QTableView* parent = nullptr );
1616 QSize sizeHint () const override ;
1717 bool hasFilters () const {return (filterWidgets.size () > 0 );}
18- void setFiltersVisible (bool visible);
1918
2019public slots:
2120 void generateFilters (size_t number, bool showFirst = false );
Original file line number Diff line number Diff line change @@ -691,8 +691,16 @@ void TableBrowser::updateRecordsetLabel()
691691 enableEditing (m_model->rowCountAvailable () != SqliteTableModel::RowCount::Unknown && is_table_or_unlocked_view);
692692
693693 // Show filters unless the table is empty
694- const bool filtersVisible = m_model->rowCount () > 0 || m_model->filterCount () != 0 ;
695- qobject_cast<FilterTableHeader*>(ui->dataTable ->horizontalHeader ())->setFiltersVisible (filtersVisible);
694+ const bool needs_filters = total > 0 || m_model->filterCount () > 0 ;
695+ FilterTableHeader* header = qobject_cast<FilterTableHeader*>(ui->dataTable ->horizontalHeader ());
696+ if (header) {
697+ if (needs_filters && !header->hasFilters ()) {
698+ generateFilters ();
699+ ui->dataTable ->adjustSize ();
700+ } else if (!needs_filters && header->hasFilters ()) {
701+ header->generateFilters (0 );
702+ }
703+ }
696704}
697705
698706sqlb::Query TableBrowser::buildQuery (const BrowseDataTableSettings& storedData, const sqlb::ObjectIdentifier& tablename) const
You can’t perform that action at this time.
0 commit comments