mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
tab-widgets: pass current dive computer to delegates
Don't access the global current_dc, but pass it to the sensor and tank-use delegates, when the current dive or dive computer changes. The same pattern is already realized for the tank and weight models. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
32de8a1387
commit
19baae449d
6 changed files with 48 additions and 33 deletions
|
@ -6,7 +6,9 @@
|
|||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QComboBox>
|
||||
|
||||
class QPainter;
|
||||
struct divecomputer;
|
||||
|
||||
class DiveListDelegate : public QStyledItemDelegate {
|
||||
public:
|
||||
|
@ -73,19 +75,23 @@ class TankUseDelegate : public QStyledItemDelegate {
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit TankUseDelegate(QObject *parent = 0);
|
||||
void setCurrentDC(divecomputer *dc);
|
||||
private:
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||
divecomputer *currentdc;
|
||||
};
|
||||
|
||||
class SensorDelegate : public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SensorDelegate(QObject *parent = 0);
|
||||
void setCurrentDC(divecomputer *dc);
|
||||
private:
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
divecomputer *currentdc;
|
||||
};
|
||||
|
||||
class WSInfoDelegate : public ComboBoxDelegate {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue