Only enable filter actions when Extended Table has filter lines

When the filter lines have not been generated for a Extended Table
(currently the case for Execute SQL tables), the filter actions make no
sense, so they are disabled.

See issue #1469
This commit is contained in:
mgrojo
2018-07-13 00:25:11 +02:00
parent 6a2c4511f1
commit b37df2cf62
2 changed files with 6 additions and 0 deletions

View File

@@ -213,6 +213,11 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) :
copyWithHeadersAction->setEnabled(enabled);
copyAsSQLAction->setEnabled(enabled);
// Hide filter actions when there isn't any filters
bool hasFilters = m_tableHeader->hasFilters();
filterAction->setVisible(hasFilters);
filterMenu->menuAction()->setVisible(hasFilters);
// Try to find out whether the current view is editable and (de)activate menu options according to that
bool editable = editTriggers() != QAbstractItemView::NoEditTriggers;
nullAction->setEnabled(enabled && editable);