From 81492b8cbae8bee18eecaf317cdd01629a3a8130 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Fri, 27 Oct 2017 17:52:49 +0200 Subject: Set checked status of menu entry for dive list filter correctly When enabling the dive list filter via the menu entry "Log->Filter dives" and then switch off the filter via the small "close" button of the filter: Set the checked status of the menu entry correctly. Also set it correctly when switching on/off via the menu entry to avoid any situation where it is not synced. Signed-off-by: Stefan Fuchs --- desktop-widgets/mainwindow.cpp | 13 +++++++++++-- desktop-widgets/mainwindow.h | 1 + desktop-widgets/simplewidgets.cpp | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 1afe8b262..93943edcf 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1945,10 +1945,19 @@ void MainWindow::on_paste_triggered() void MainWindow::on_actionFilterTags_triggered() { - if (ui.multiFilter->isVisible()) + if (ui.multiFilter->isVisible()) { ui.multiFilter->closeFilter(); - else + ui.actionFilterTags->setChecked(false); + } + else { ui.multiFilter->setVisible(true); + ui.actionFilterTags->setChecked(true); + } +} + +void MainWindow::setCheckedActionFilterTags(bool checked) +{ + ui.actionFilterTags->setChecked(checked); } void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *topRight, QWidget *bottomLeft, QWidget *bottomRight) diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 073d3cad8..edd3fb0c8 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -87,6 +87,7 @@ public: QUndoStack *undoStack; NotificationWidget *getNotificationWidget(); void enableDisableCloudActions(); + void setCheckedActionFilterTags(bool checked); private slots: diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index ab1fcaabb..13a3ee435 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -653,6 +653,7 @@ void MultiFilter::closeFilter() { MultiFilterSortModel::instance()->clearFilter(); hide(); + MainWindow::instance()->setCheckedActionFilterTags(false); } TextHyperlinkEventFilter::TextHyperlinkEventFilter(QTextEdit *txtEdit) : QObject(txtEdit), -- cgit v1.2.3-70-g09d2