summaryrefslogtreecommitdiffstats
path: root/tools/qmldebugger/standalone/expressionquerywidget.h
blob: 6fab059e1048e580bc9d54143dfd53cbcb202fc2 (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
#ifndef EXPRESSIONQUERYWIDGET_H
#define EXPRESSIONQUERYWIDGET_H

#include <QWidget>

#include <QtDeclarative/qmldebug.h>

QT_BEGIN_NAMESPACE

class QGroupBox;
class QTextEdit;
class QLineEdit;
class QPushButton;

class ExpressionQueryWidget : public QWidget
{
    Q_OBJECT
public:
    enum Style {
        Compact,
        Shell
    };

    ExpressionQueryWidget(QmlEngineDebug *client = 0, QWidget *parent = 0);
    
    void setEngineDebug(QmlEngineDebug *client);
    void clear();

protected:
    bool eventFilter(QObject *obj, QEvent *event);

public slots:
    void setCurrentObject(const QmlDebugObjectReference &obj);

private slots:
    void executeExpression();
    void showResult();

private:
    void appendPrompt();
    void checkCurrentContext();
    void showCurrentContext();
    void updateTitle();

    Style m_style;

    QmlEngineDebug *m_client;
    QmlDebugExpressionQuery *m_query;
    QTextEdit *m_textEdit;
    QLineEdit *m_lineEdit;
    QPushButton *m_button;
    QString m_prompt;
    QString m_expr;
    QString m_lastExpr;

    QString m_title;

    QmlDebugObjectReference m_currObject;
    QmlDebugObjectReference m_objectAtLastFocus;
};

QT_END_NAMESPACE

#endif