mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: make overridden functions in model delegates private
There is no point in calling these functions directly, so we can just make them private. Morover, add override specifiers were they were missing and remove a pointless default parameter to the testActivation() function. It was not used anywhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d85f92c5df
commit
fc6d99eb93
1 changed files with 20 additions and 23 deletions
|
@ -21,11 +21,11 @@ class StarWidgetsDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit StarWidgetsDelegate(QWidget *parent = 0);
|
explicit StarWidgetsDelegate(QWidget *parent = 0);
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
const QSize &starSize() const;
|
const QSize &starSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
QWidget *parentWidget;
|
QWidget *parentWidget;
|
||||||
QSize minStarSize;
|
QSize minStarSize;
|
||||||
};
|
};
|
||||||
|
@ -34,19 +34,19 @@ class ComboBoxDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ComboBoxDelegate(QAbstractItemModel *model, QObject *parent = 0, bool allowEdit = true);
|
explicit ComboBoxDelegate(QAbstractItemModel *model, QObject *parent = 0, bool allowEdit = true);
|
||||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
|
||||||
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
bool eventFilter(QObject *object, QEvent *event) override;
|
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
void testActivation(const QString &currString = QString());
|
void testActivation(const QString &currString);
|
||||||
void testActivation(const QModelIndex &currIndex);
|
void testActivation(const QModelIndex &currIndex);
|
||||||
//HACK: try to get rid of this in the future.
|
//HACK: try to get rid of this in the future.
|
||||||
void fakeActivation();
|
void fakeActivation();
|
||||||
virtual void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint) = 0;
|
virtual void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint) = 0;
|
||||||
private:
|
private:
|
||||||
bool editable;
|
bool editable;
|
||||||
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
|
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||||
|
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
|
bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
protected:
|
protected:
|
||||||
QAbstractItemModel *model;
|
QAbstractItemModel *model;
|
||||||
mutable struct CurrSelected {
|
mutable struct CurrSelected {
|
||||||
|
@ -63,15 +63,15 @@ class TankInfoDelegate : public ComboBoxDelegate {
|
||||||
public:
|
public:
|
||||||
explicit TankInfoDelegate(QObject *parent = 0);
|
explicit TankInfoDelegate(QObject *parent = 0);
|
||||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||||
public
|
private:
|
||||||
slots:
|
void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint) override;
|
||||||
void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TankUseDelegate : public QStyledItemDelegate {
|
class TankUseDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TankUseDelegate(QObject *parent = 0);
|
explicit TankUseDelegate(QObject *parent = 0);
|
||||||
|
private:
|
||||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, 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;
|
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||||
|
@ -81,38 +81,35 @@ class WSInfoDelegate : public ComboBoxDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit WSInfoDelegate(QObject *parent = 0);
|
explicit WSInfoDelegate(QObject *parent = 0);
|
||||||
|
private:
|
||||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||||
public
|
void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint) override;
|
||||||
slots:
|
|
||||||
void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AirTypesDelegate : public ComboBoxDelegate {
|
class AirTypesDelegate : public ComboBoxDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AirTypesDelegate(QObject *parent = 0);
|
explicit AirTypesDelegate(QObject *parent = 0);
|
||||||
|
private:
|
||||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||||
public
|
void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint) override;
|
||||||
slots:
|
|
||||||
void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DiveTypesDelegate : public ComboBoxDelegate {
|
class DiveTypesDelegate : public ComboBoxDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DiveTypesDelegate(QObject *parent = 0);
|
explicit DiveTypesDelegate(QObject *parent = 0);
|
||||||
|
private:
|
||||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||||
public
|
void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint) override;
|
||||||
slots:
|
|
||||||
void editorClosed(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpinBoxDelegate : public QStyledItemDelegate {
|
class SpinBoxDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SpinBoxDelegate(int min, int max, int step, QObject *parent = 0);
|
SpinBoxDelegate(int min, int max, int step, QObject *parent = 0);
|
||||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
private:
|
private:
|
||||||
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
int min;
|
int min;
|
||||||
int max;
|
int max;
|
||||||
int step;
|
int step;
|
||||||
|
@ -122,8 +119,8 @@ class DoubleSpinBoxDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DoubleSpinBoxDelegate(double min, double max, double step, QObject *parent = 0);
|
DoubleSpinBoxDelegate(double min, double max, double step, QObject *parent = 0);
|
||||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
private:
|
private:
|
||||||
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
double min;
|
double min;
|
||||||
double max;
|
double max;
|
||||||
double step;
|
double step;
|
||||||
|
@ -133,10 +130,10 @@ class LocationFilterDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LocationFilterDelegate(QObject *parent = 0);
|
LocationFilterDelegate(QObject *parent = 0);
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
void setCurrentLocation(location_t loc);
|
void setCurrentLocation(location_t loc);
|
||||||
private:
|
private:
|
||||||
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
location_t currentLocation;
|
location_t currentLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue