This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
qialertview.h
70 lines (49 loc) · 1.62 KB
/
qialertview.h
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
#ifndef QIALERTVIEW_H
#define QIALERTVIEW_H
#include <QQuickItem>
#ifndef Q_OS_IOS
#include <QMessageBox>
#include <QPointer>
#endif
/// QIAlertView provides an interface to access iOS's UIAlertView
class QIAlertView : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
Q_PROPERTY(QString message READ message WRITE setMessage NOTIFY messageChanged)
Q_PROPERTY(QStringList buttons READ buttons WRITE setButtons NOTIFY buttonsChanged)
Q_PROPERTY(int clickedButtonIndex READ clickedButtonIndex WRITE setClickedButtonIndex NOTIFY clickedButtonIndexChanged)
public:
explicit QIAlertView(QQuickItem *parent = 0);
~QIAlertView();
virtual QString title() const;
QString text() const;
QString message() const;
QStringList buttons() const;
void setButtons(const QStringList &buttons);
int clickedButtonIndex() const;
void setClickedButtonIndex(int clickedButtonIndex);
public Q_SLOTS:
virtual void setTitle(const QString &arg);
void setMessage(const QString &arg);
void show();
void dismiss(int clickedButtonIndex, bool animated = true);
Q_SIGNALS:
void titleChanged();
void messageChanged();
void buttonsChanged();
void clicked(int buttonIndex);
void clickedButtonIndexChanged();
private:
Q_INVOKABLE void onReceived(QString name,QVariantMap data);
Q_INVOKABLE void onFinished(int index);
QString m_title;
QString m_message;
QStringList m_buttons;
bool m_opened;
int m_clickedButtonIndex;
#ifndef Q_OS_IOS
QPointer<QMessageBox> dialog;
#endif
};
#endif // QIALERTVIEW_H