mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
065423896d
The dive-site-edit and dive-site-table tabs both put the filter into a special dive-site mode. When switching between both, it could happen that the one got its show befor the other got its hide event. Thus, the first would start dive-site filtering and the second stop it. Now the app was not in filter mode even though it should. To solve this problem, add reference counting for the filter's dive-site mode. In both tabs call the enter/exit functions on show/hide. In the dive-site-table tab, when the selection changes, use a set function that doesn't modify the reference count. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
31 lines
843 B
C++
31 lines
843 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef TAB_DIVE_SITE_H
|
|
#define TAB_DIVE_SITE_H
|
|
|
|
#include "TabBase.h"
|
|
#include "ui_TabDiveSite.h"
|
|
#include "qt-models/divelocationmodel.h"
|
|
|
|
class TabDiveSite : public TabBase {
|
|
Q_OBJECT
|
|
public:
|
|
TabDiveSite(QWidget *parent = 0);
|
|
void updateData() override;
|
|
void clear() override;
|
|
private slots:
|
|
void add();
|
|
void diveSiteAdded(struct dive_site *, int idx);
|
|
void diveSiteChanged(struct dive_site *ds, int field);
|
|
void on_purgeUnused_clicked();
|
|
void on_filterText_textChanged(const QString &text);
|
|
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
|
private:
|
|
Ui::TabDiveSite ui;
|
|
DiveSiteSortedModel model;
|
|
QVector<dive_site *> selectedDiveSites();
|
|
void updateFilter();
|
|
void hideEvent(QHideEvent *) override;
|
|
void showEvent(QShowEvent *) override;
|
|
};
|
|
|
|
#endif
|