Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlboundsignal_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
5#ifndef QQMLBOUNDSIGNAL_P_H
6#define QQMLBOUNDSIGNAL_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qmetaobject.h>
20
21#include <private/qqmljavascriptexpression_p.h>
22#include <private/qqmlnotifier_p.h>
23#include <private/qqmlrefcount_p.h>
24#include <private/qtqmlglobal_p.h>
25
26QT_BEGIN_NAMESPACE
27
28class Q_QML_EXPORT QQmlBoundSignalExpression final
29 : public QQmlJavaScriptExpression,
30 public QQmlRefCounted<QQmlBoundSignalExpression>
31{
32 friend class QQmlRefCounted<QQmlBoundSignalExpression>;
33public:
34 QQmlBoundSignalExpression(
35 const QObject *target, int index, const QQmlRefPointer<QQmlContextData> &ctxt, QObject *scope,
36 const QString &expression, const QString &fileName, quint16 line, quint16 column,
37 const QString &handlerName = QString(), const QString &parameterString = QString());
38
39 QQmlBoundSignalExpression(
40 const QObject *target, int index, const QQmlRefPointer<QQmlContextData> &ctxt,
41 QObject *scopeObject, QV4::Function *function, QV4::ExecutionContext *scope = nullptr);
42
43 // inherited from QQmlJavaScriptExpression.
44 QString expressionIdentifier() const override;
45 void expressionChanged() override;
46
47 // evaluation of a bound signal expression doesn't return any value
48 void evaluate(void **a);
49
50 bool mustCaptureBindableProperty() const final {return true;}
51
52 QString expression() const;
53 const QObject *target() const { return m_target; }
54
55private:
56 ~QQmlBoundSignalExpression() override;
57
58 void init(const QQmlRefPointer<QQmlContextData> &ctxt, QObject *scope);
59
60 bool expressionFunctionValid() const { return function() != nullptr; }
61
62 int m_index;
63 const QObject *m_target;
64};
65
66class Q_QML_EXPORT QQmlBoundSignal : public QQmlNotifierEndpoint
67{
68public:
69 QQmlBoundSignal(QObject *target, int signal, QObject *owner, QQmlEngine *engine);
70 ~QQmlBoundSignal();
71
72 void removeFromObject();
73
74 QQmlBoundSignalExpression *expression() const;
75 void takeExpression(QQmlBoundSignalExpression *);
76
77 void setEnabled(bool enabled);
78
79private:
80 friend void QQmlBoundSignal_callback(QQmlNotifierEndpoint *, void **);
81 friend class QQmlPropertyPrivate;
82 friend class QQmlData;
83 friend class QQmlEngineDebugService;
84
85 void addToObject(QObject *owner);
86
87 QQmlBoundSignal **m_prevSignal;
88 QQmlBoundSignal *m_nextSignal;
89
90 bool m_enabled;
91
92 QQmlRefPointer<QQmlBoundSignalExpression> m_expression;
93};
94
96{
97public:
98 QQmlPropertyObserver(QQmlBoundSignalExpression *expr);
99
100private:
101 QQmlRefPointer<QQmlBoundSignalExpression> expression;
102};
103
104QT_END_NAMESPACE
105
106#endif // QQMLBOUNDSIGNAL_P_H
\inmodule QtQml
QQmlPropertyObserver(QQmlBoundSignalExpression *expr)
Combined button and popup list for selecting options.
void QQmlBoundSignal_callback(QQmlNotifierEndpoint *e, void **a)