summaryrefslogtreecommitdiffstats
path: root/src/qmlandroid/widget/qqmlandroidtextview_p.h
blob: b2f75e22028935cd4859d16c5daf39eb4170c150 (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef QQMLANDROIDTEXTVIEW_P_H
#define QQMLANDROIDTEXTVIEW_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include "qqmlandroidview_p.h"
#include "qqmlandroidoptional_p.h"
#include <QtGui/qcolor.h>

QT_BEGIN_NAMESPACE

class QQmlAndroidTextView : public QQmlAndroidView
{
    Q_OBJECT
    Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
    Q_PROPERTY(int textColor READ textColor WRITE setTextColor NOTIFY textColorChanged)
    Q_PROPERTY(qreal textSize READ textSize WRITE setTextSize NOTIFY textSizeChanged)
    Q_PROPERTY(QString hint READ hint WRITE setHint NOTIFY hintChanged)
    Q_PROPERTY(bool singleLine READ isSingleLine WRITE setSingleLine NOTIFY singleLineChanged)
    Q_PROPERTY(int inputType READ inputType WRITE setInputType NOTIFY inputTypeChanged)

public:
    explicit QQmlAndroidTextView(QQmlAndroidView *parent = 0);

    QString text() const;
    void setText(const QString &text);

    int textColor() const;
    void setTextColor(int color);

    qreal textSize() const;
    void setTextSize(qreal size);

    QString hint() const;
    void setHint(const QString &hint);

    bool isSingleLine() const;
    void setSingleLine(bool singleLine);

    int inputType() const;
    void setInputType(int type);

Q_SIGNALS:
    void textChanged();
    void textColorChanged();
    void textSizeChanged();
    void hintChanged();
    void singleLineChanged();
    void inputTypeChanged();

protected:
    QAndroidJniObject onCreate() Q_DECL_OVERRIDE;
    void onInflate(QAndroidJniObject &instance) Q_DECL_OVERRIDE;

private:
    QString m_text;
    QString m_hint;
    QQmlAndroidOptional<int> m_textColor;
    QQmlAndroidOptional<qreal> m_textSize;
    bool m_singleLine;
    QQmlAndroidOptional<int> m_inputType;
};

QT_END_NAMESPACE

#endif // QQMLANDROIDTEXTVIEW_P_H