summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/simplewidgets.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-12-23 14:17:23 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-24 08:24:11 -0800
commit1a4e7ad0dd29b9eeac2016933cb86bff260dadbb (patch)
tree92730f71f4d41207bb86fd81509fc7778f96108f /desktop-widgets/simplewidgets.h
parent603e43f46ece939e732df14c501844e7bd983211 (diff)
downloadsubsurface-1a4e7ad0dd29b9eeac2016933cb86bff260dadbb.tar.gz
Factor out *Filter code into FilterBase base class
The TagFilter, BuddyFilter, SuitFilter and LocationFilter classes all did essentially the same thing. Therefore, factor out common code / objects into a base class FilterBase. The new base class stores a pointer to the filter model. It was felt that this is simpler than introducing virtual methods. The only thing the *Filter classes now do is setting a label and in one case a tooltip. Thus, in principle, they could be removed completely, but let's keep them for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/simplewidgets.h')
-rw-r--r--desktop-widgets/simplewidgets.h39
1 files changed, 15 insertions, 24 deletions
diff --git a/desktop-widgets/simplewidgets.h b/desktop-widgets/simplewidgets.h
index 4f9746d98..22f1ddd62 100644
--- a/desktop-widgets/simplewidgets.h
+++ b/desktop-widgets/simplewidgets.h
@@ -5,6 +5,7 @@
class MinMaxAvgWidgetPrivate;
class QAbstractButton;
class QNetworkReply;
+class FilterModelBase;
#include <QWidget>
#include <QGroupBox>
@@ -165,49 +166,39 @@ public:
Ui::FilterWidget2 ui;
};
-class TagFilter : public QWidget {
- Q_OBJECT
-public:
- TagFilter(QWidget *parent = 0);
+class FilterBase : public QWidget {
+protected:
+ FilterBase(FilterModelBase *model, QWidget *parent = 0);
+ FilterModelBase *model;
+ Ui::FilterWidget ui;
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
+ friend class MultiFilter;
+};
-private:
- Ui::FilterWidget ui;
+class TagFilter : public FilterBase {
+ Q_OBJECT
+public:
+ TagFilter(QWidget *parent = 0);
friend class MultiFilter;
};
-class BuddyFilter : public QWidget {
+class BuddyFilter : public FilterBase {
Q_OBJECT
public:
BuddyFilter(QWidget *parent = 0);
- virtual void showEvent(QShowEvent *);
- virtual void hideEvent(QHideEvent *);
-
-private:
- Ui::FilterWidget ui;
};
-class SuitFilter : public QWidget {
+class SuitFilter : public FilterBase {
Q_OBJECT
public:
SuitFilter(QWidget *parent = 0);
- virtual void showEvent(QShowEvent *);
- virtual void hideEvent(QHideEvent *);
-
-private:
- Ui::FilterWidget ui;
};
-class LocationFilter : public QWidget {
+class LocationFilter : public FilterBase {
Q_OBJECT
public:
LocationFilter(QWidget *parent = 0);
- virtual void showEvent(QShowEvent *);
- virtual void hideEvent(QHideEvent *);
-
-private:
- Ui::FilterWidget ui;
};
class TextHyperlinkEventFilter : public QObject {