QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
qsettingsextendedtypes.h
1 #ifndef QSETTINGSEXTENDEDTYPES_H
2 #define QSETTINGSEXTENDEDTYPES_H
3 
4 #include <QString>
5 #include <QObject>
6 #include <QVariant>
7 
9 class FilePath : public QString
10 {
11 public:
13  template <typename... Args>
14  FilePath(Args... args) :
15  QString(args...)
16  {}
17 
19  operator QVariant() {
20  return (QString)*this;
21  }
22 };
23 
25 class IntRange
26 {
27 public:
29  IntRange(int value = 0) :
30  value(value)
31  {}
32 
34  operator int() {
35  return this->value;
36  }
37 
39  operator QVariant() {
40  return this->value;
41  }
42 
44  IntRange &operator=(int value) {
45  this->value = value;
46  return (*this);
47  }
48 
49 private:
50  int value;
51 };
52 
54 class HtmlText : public QString
55 {
56 public:
58  template <typename... Args>
59  HtmlText(Args... args) :
60  QString(args...)
61  {}
62 
64  operator QVariant() {
65  return (QString)*this;
66  }
67 };
68 
69 Q_DECLARE_METATYPE(FilePath)
70 Q_DECLARE_METATYPE(IntRange)
71 Q_DECLARE_METATYPE(HtmlText)
72 
73 #endif // QSETTINGSEXTENDEDTYPES_H
FilePath(Args...args)
Creates a FilePath by passing the arguments to the QString constructor.
Definition: qsettingsextendedtypes.h:14
A custom type that represents html-text (is a QString)
Definition: qsettingsextendedtypes.h:54
A custom type that represents a file path (is a QString)
Definition: qsettingsextendedtypes.h:9
IntRange & operator=(int value)
assignment operator from int
Definition: qsettingsextendedtypes.h:44
HtmlText(Args...args)
Creates a HtmlText by passing the arguments to the QString constructor.
Definition: qsettingsextendedtypes.h:59
IntRange(int value=0)
Creates a IntRange from a value.
Definition: qsettingsextendedtypes.h:29
A custom type that represents an integer range (is an int)
Definition: qsettingsextendedtypes.h:25