[PATCH] MultiFilter: make sure to uncheck "Filter divelist" if the user closes

Lubomir I. Ivanov neolit123 at gmail.com
Mon Jun 12 15:18:57 PDT 2017


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

If the user presses the close button (x) in the multi filter, the filter
is closed, but the checkbox in the menu (Log -> Filter divelist)
is left checked.

This patch adds a method to MainWindow that clears the checkbox;
called from MultiFilter::closeFilter().

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---

I'm building against Qt 5.5.1 and there are consistent asserts
when closing / clearing the filter:
ASSERT failure in QPersistentModelIndex::~QPersistentModelIndex:
"persistent model indexes corrupted",
file itemmodels\qabstractitemmodel.cpp, line 557

void MultiFilterSortModel::clearFilter()
{
	justCleared = true;
	Q_FOREACH (MultiFilterInterface *iface, models) {
		iface->clearFilter();
               ^
               possible cause

The latest official Windows binaries seem OK.
---
 desktop-widgets/mainwindow.cpp    | 5 +++++
 desktop-widgets/mainwindow.h      | 1 +
 desktop-widgets/simplewidgets.cpp | 1 +
 3 files changed, 7 insertions(+)

diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 9df5066..2b487cc 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -1956,6 +1956,11 @@ void MainWindow::on_actionFilterTags_triggered()
 		ui.multiFilter->setVisible(true);
 }
 
+void MainWindow::uncheckMultiFilter()
+{
+	ui.actionFilterTags->setChecked(false);
+}
+
 void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *topRight, QWidget *bottomLeft, QWidget *bottomRight)
 {
 	applicationState[state] = WidgetForQuadrant(topLeft, topRight, bottomLeft, bottomRight);
diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h
index 10fe6d4..2d4906c 100644
--- a/desktop-widgets/mainwindow.h
+++ b/desktop-widgets/mainwindow.h
@@ -95,6 +95,7 @@ public:
 	NotificationWidget *getNotificationWidget();
 	void enableDisableCloudActions();
 	void showError();
+	void uncheckMultiFilter();
 
 private
 slots:
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index ab1fcaa..eb5e57c 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -652,6 +652,7 @@ void MultiFilter::adjustHeight()
 void MultiFilter::closeFilter()
 {
 	MultiFilterSortModel::instance()->clearFilter();
+	MainWindow::instance()->uncheckMultiFilter();
 	hide();
 }
 
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list