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 <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-10-27 17:52:49 +02:00 committed by Lubomir I. Ivanov
parent 215f61175d
commit 81492b8cba
3 changed files with 13 additions and 2 deletions

View file

@ -1945,10 +1945,19 @@ void MainWindow::on_paste_triggered()
void MainWindow::on_actionFilterTags_triggered() void MainWindow::on_actionFilterTags_triggered()
{ {
if (ui.multiFilter->isVisible()) if (ui.multiFilter->isVisible()) {
ui.multiFilter->closeFilter(); ui.multiFilter->closeFilter();
else ui.actionFilterTags->setChecked(false);
}
else {
ui.multiFilter->setVisible(true); 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) void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *topRight, QWidget *bottomLeft, QWidget *bottomRight)

View file

@ -87,6 +87,7 @@ public:
QUndoStack *undoStack; QUndoStack *undoStack;
NotificationWidget *getNotificationWidget(); NotificationWidget *getNotificationWidget();
void enableDisableCloudActions(); void enableDisableCloudActions();
void setCheckedActionFilterTags(bool checked);
private private
slots: slots:

View file

@ -653,6 +653,7 @@ void MultiFilter::closeFilter()
{ {
MultiFilterSortModel::instance()->clearFilter(); MultiFilterSortModel::instance()->clearFilter();
hide(); hide();
MainWindow::instance()->setCheckedActionFilterTags(false);
} }
TextHyperlinkEventFilter::TextHyperlinkEventFilter(QTextEdit *txtEdit) : QObject(txtEdit), TextHyperlinkEventFilter::TextHyperlinkEventFilter(QTextEdit *txtEdit) : QObject(txtEdit),