aboutsummaryrefslogtreecommitdiff
path: root/src/GraphemeCountValidator.h
blob: e2a5dc76172b8cef51a91853a1bbe8691106b433 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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