source: subsurface/desktop-widgets/modeldelegates.h @ f0bd39c

Mtestandroid_testdcDownloadforatdotdeiosmergeKirigamiPorttesting
Last change on this file since f0bd39c was f0bd39c, checked in by Dirk Hohndel <dirk@…>, 2 years ago

modeldelegates: remove printing related delegates

Remove HTMLDelegate and ProfilePrintDelagate? as
these are obosolete. The print related rendering
at the moment happens via QWebView.

Signed-off-by: Lubomir I. Ivanov <neolit123@…>
Signed-off-by: Dirk Hohndel <dirk@…>

  • Property mode set to 100644
File size: 4.3 KB
Line 
1#ifndef MODELDELEGATES_H
2#define MODELDELEGATES_H
3
4#include <QStyledItemDelegate>
5#include <QComboBox>
6class QPainter;
7
8class DiveListDelegate : public QStyledItemDelegate {
9public:
10        explicit DiveListDelegate(QObject *parent = 0)
11            : QStyledItemDelegate(parent)
12        {
13        }
14        QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
15};
16
17class StarWidgetsDelegate : public QStyledItemDelegate {
18        Q_OBJECT
19public:
20        explicit StarWidgetsDelegate(QWidget *parent = 0);
21        virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
22        virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
23        const QSize& starSize() const;
24
25private:
26        QWidget *parentWidget;
27        QSize minStarSize;
28};
29
30class ComboBoxDelegate : public QStyledItemDelegate {
31        Q_OBJECT
32public:
33        explicit ComboBoxDelegate(QAbstractItemModel *model, QObject *parent = 0);
34        virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
35        virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
36        virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
37        virtual bool eventFilter(QObject *object, QEvent *event);
38public
39slots:
40        void testActivation(const QString &currString = QString());
41        void testActivation(const QModelIndex &currIndex);
42        //HACK: try to get rid of this in the future.
43        void fakeActivation();
44        void fixTabBehavior();
45        virtual void revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint) = 0;
46
47protected:
48        QAbstractItemModel *model;
49};
50
51class TankInfoDelegate : public ComboBoxDelegate {
52        Q_OBJECT
53public:
54        explicit TankInfoDelegate(QObject *parent = 0);
55        virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
56        virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
57public
58slots:
59        void revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
60        void reenableReplot(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
61};
62
63class TankUseDelegate : public QStyledItemDelegate {
64        Q_OBJECT
65public:
66        explicit TankUseDelegate(QObject *parent = 0);
67        virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
68        virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
69        virtual void setEditorData(QWidget * editor, const QModelIndex & index) const;
70};
71
72class WSInfoDelegate : public ComboBoxDelegate {
73        Q_OBJECT
74public:
75        explicit WSInfoDelegate(QObject *parent = 0);
76        virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
77        virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
78public
79slots:
80        void revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
81};
82
83class AirTypesDelegate : public ComboBoxDelegate {
84        Q_OBJECT
85public:
86        explicit AirTypesDelegate(QObject *parent = 0);
87        virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
88public
89slots:
90        void revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
91};
92
93class SpinBoxDelegate : public QStyledItemDelegate {
94        Q_OBJECT
95public:
96        SpinBoxDelegate(int min, int max, int step, QObject *parent = 0);
97        virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
98private:
99        int min;
100        int max;
101        int step;
102};
103
104class DoubleSpinBoxDelegate : public QStyledItemDelegate {
105        Q_OBJECT
106public:
107        DoubleSpinBoxDelegate(double min, double max, double step, QObject *parent = 0);
108        virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
109private:
110        double min;
111        double max;
112        double step;
113};
114
115class LocationFilterDelegate : public QStyledItemDelegate {
116        Q_OBJECT
117public:
118        LocationFilterDelegate(QObject *parent = 0);
119        void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
120        QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
121};
122
123#endif // MODELDELEGATES_H
Note: See TracBrowser for help on using the repository browser.