aboutsummaryrefslogtreecommitdiff
path: root/src/GraphemeCountValidator.h
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2022-10-10 21:30:02 +0200
committerAndreas Grois <andi@grois.info>2022-10-10 21:37:15 +0200
commite4ad766315879e1ff05bb111229f073f8f0ed68e (patch)
tree4b043ff47c78b2c00c80c94ebda622c32c8b6d3d /src/GraphemeCountValidator.h
PassFish: Initial Commit
Well, that's a lie. But nobody needs to see all the iterations I decided to sweep under the rug. That said, I think the repo is, while not clean, clean enough now, to not be embarrassed by uploading it to github.
Diffstat (limited to 'src/GraphemeCountValidator.h')
-rw-r--r--src/GraphemeCountValidator.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/GraphemeCountValidator.h b/src/GraphemeCountValidator.h
new file mode 100644
index 0000000..e2a5dc7
--- /dev/null
+++ b/src/GraphemeCountValidator.h
@@ -0,0 +1,26 @@
+#ifndef GRAPHEMECOUNTVALIDATOR_H
+#define GRAPHEMECOUNTVALIDATOR_H
+
+#include <QValidator>
+
+class Q_GUI_EXPORT GraphemeCountValidator : public QValidator
+{
+ Q_OBJECT
+ Q_PROPERTY(uint minGraphemeCount READ minGraphemeCount WRITE setMinGraphemeCount NOTIFY minGraphemeCountChanged)
+public:
+ explicit GraphemeCountValidator(QObject *parent = nullptr);
+ explicit GraphemeCountValidator(uint min_count, QObject *parent = nullptr);
+ virtual QValidator::State validate(QString &, int &) const override;
+
+ uint minGraphemeCount() const;
+ void setMinGraphemeCount(uint c);
+
+
+Q_SIGNALS:
+ void minGraphemeCountChanged(uint minGraphemeCount);
+
+private:
+ uint minCount;
+};
+
+#endif // GRAPHEMECOUNTVALIDATOR_H