2011-02-26 03:57:55 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
2013-02-25 09:28:43 +00:00
|
|
|
#include <QEvent>
|
2012-12-11 03:53:03 +00:00
|
|
|
#include <QWebElement>
|
|
|
|
|
|
|
|
class WebPage;
|
2013-01-20 23:57:04 +00:00
|
|
|
class InvocationResult;
|
2011-02-26 03:57:55 +00:00
|
|
|
|
|
|
|
class JavascriptInvocation : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString functionName READ functionName)
|
2013-12-06 15:43:17 +00:00
|
|
|
Q_PROPERTY(bool allowUnattached READ allowUnattached)
|
2011-02-26 03:57:55 +00:00
|
|
|
Q_PROPERTY(QStringList arguments READ arguments)
|
2013-02-02 22:32:54 +00:00
|
|
|
Q_PROPERTY(QVariant error READ getError WRITE setError)
|
2017-02-07 01:29:11 +00:00
|
|
|
Q_PROPERTY(Qt::Key key_enum)
|
2011-02-26 03:57:55 +00:00
|
|
|
|
|
|
|
public:
|
2013-12-06 15:43:17 +00:00
|
|
|
JavascriptInvocation(const QString &functionName, bool allowUnattached, const QStringList &arguments, WebPage *page, QObject *parent = 0);
|
2011-02-26 03:57:55 +00:00
|
|
|
QString &functionName();
|
2013-12-06 15:43:17 +00:00
|
|
|
bool allowUnattached();
|
2011-02-26 03:57:55 +00:00
|
|
|
QStringList &arguments();
|
2013-02-25 09:28:43 +00:00
|
|
|
Q_INVOKABLE void leftClick(int x, int y);
|
|
|
|
Q_INVOKABLE void rightClick(int x, int y);
|
|
|
|
Q_INVOKABLE void doubleClick(int x, int y);
|
2013-01-21 00:13:58 +00:00
|
|
|
Q_INVOKABLE bool clickTest(QWebElement element, int absoluteX, int absoluteY);
|
|
|
|
Q_INVOKABLE QVariantMap clickPosition(QWebElement element, int left, int top, int width, int height);
|
2013-02-26 19:32:03 +00:00
|
|
|
Q_INVOKABLE void hover(int absoluteX, int absoluteY);
|
2013-03-21 03:20:14 +00:00
|
|
|
Q_INVOKABLE void keypress(QChar);
|
2017-02-07 01:29:11 +00:00
|
|
|
Q_INVOKABLE void namedKeydown(QString keyName);
|
|
|
|
Q_INVOKABLE void namedKeyup(QString keyName);
|
|
|
|
Q_INVOKABLE void namedKeypress(QString keyName, QString modifiers);
|
2013-11-09 19:34:43 +00:00
|
|
|
Q_INVOKABLE const QString render(void);
|
2013-02-02 22:32:54 +00:00
|
|
|
QVariant getError();
|
|
|
|
void setError(QVariant error);
|
2013-01-20 23:57:04 +00:00
|
|
|
InvocationResult invoke(QWebFrame *);
|
2011-02-26 03:57:55 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_functionName;
|
2013-12-06 15:43:17 +00:00
|
|
|
bool m_allowUnattached;
|
2011-02-26 03:57:55 +00:00
|
|
|
QStringList m_arguments;
|
2012-12-11 03:53:03 +00:00
|
|
|
WebPage *m_page;
|
2013-02-02 22:32:54 +00:00
|
|
|
QVariant m_error;
|
2013-02-26 19:32:03 +00:00
|
|
|
void hover(const QPoint &);
|
2013-03-21 03:20:14 +00:00
|
|
|
int keyCodeFor(const QChar &);
|
2017-02-07 01:29:11 +00:00
|
|
|
int keyCodeForName(const QString &);
|
|
|
|
Qt::Key key_enum;
|
|
|
|
Qt::KeyboardModifiers m_currentModifiers;
|
2011-02-26 03:57:55 +00:00
|
|
|
};
|
|
|
|
|