mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-29 21:50:26 +00:00
b3253304a5
When connecting a model to the TableModel class, it would connect clicking on an item to the remove() slot of the model. This breaks the program flow implied by the undo code: Ui --> Undo-Command --> Model --> UI Moreover, the naming of the remove() slot is illogical, because clicks can also have different effects, as for example in the cylinder-table. Therefore, move the connect() call from TableModel to the callers. In the case of TabDiveSite, move the remove() function from the model to the TabWidget, where it makes more sense. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
31 lines
865 B
C++
31 lines
865 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 diveSiteClicked(const QModelIndex &);
|
|
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 hideEvent(QHideEvent *) override;
|
|
void showEvent(QShowEvent *) override;
|
|
};
|
|
|
|
#endif
|