#include <QtCore/qmetatype.h>
#include <QtCore/qvariant.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qobject.h>
#include <QtScript/qscriptvalue.h>
#include <QtScript/qscriptcontext.h>
#include <QtScript/qscriptstring.h>
#include <QtScript/qscriptprogram.h>
Go to the source code of this file.
|
Q_SCRIPT_EXPORT bool | qScriptConnect (QObject *sender, const char *signal, const QScriptValue &receiver, const QScriptValue &function) |
|
Q_SCRIPT_EXPORT bool | qScriptDisconnect (QObject *sender, const char *signal, const QScriptValue &receiver, const QScriptValue &function) |
|
template<class T > |
QScriptValue | qscriptQMetaObjectConstructor (QScriptContext *, QScriptEngine *, T *) |
|
template<typename T > |
int | qScriptRegisterMetaType (QScriptEngine *eng, QScriptValue(*toScriptValue)(QScriptEngine *, const T &t), void(*fromScriptValue)(const QScriptValue &, T &t), const QScriptValue &prototype=QScriptValue()) |
|
void | qScriptRegisterMetaType_helper (QScriptEngine *eng, int type, QScriptEngine::MarshalFunction mf, QScriptEngine::DemarshalFunction df, const QScriptValue &prototype) |
|
template<typename T > |
int | qScriptRegisterSequenceMetaType (QScriptEngine *engine, const QScriptValue &prototype=QScriptValue()) |
|
template<typename T > |
T | qscriptvalue_cast (const QScriptValue &) |
|
template<> |
QVariant | qscriptvalue_cast< QVariant > (const QScriptValue &value) |
|
bool | qscriptvalue_cast_helper (const QScriptValue &value, int type, void *ptr) |
|
template<class T > |
QT_DEPRECATED QScriptValue | qScriptValueFromQMetaObject (QScriptEngine *engine) |
|
template<class Container > |
QScriptValue | qScriptValueFromSequence (QScriptEngine *eng, const Container &cont) |
|
template<typename T > |
QScriptValue | qScriptValueFromValue (QScriptEngine *, const T &) |
|
template<> |
QScriptValue | qScriptValueFromValue< QVariant > (QScriptEngine *engine, const QVariant &v) |
|
QScriptValue | qScriptValueFromValue_helper (QScriptEngine *engine, int type, const void *ptr) |
|
template<class Container > |
void | qScriptValueToSequence (const QScriptValue &value, Container &cont) |
|
template<typename T > |
QT_DEPRECATED T | qScriptValueToValue (const QScriptValue &value) |
|
◆ Q_SCRIPT_DECLARE_QMETAOBJECT
#define Q_SCRIPT_DECLARE_QMETAOBJECT |
( |
|
T, |
|
|
|
_Arg1 |
|
) |
| |
Value:{ \
T* t = new T(arg1); \
if (
ctx->isCalledAsConstructor()) \
return o; \
}
The QScriptContext class represents a Qt Script function invocation.
T qscriptvalue_cast(const QScriptValue &value)
Returns the given value converted to the template type T.
The QScriptEngine class provides an environment for evaluating Qt Script code.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
The QScriptValue class acts as a container for the Qt Script data types.
- Since
- 4.3
Declares the given QMetaObject. Used in combination with QScriptEngine::scriptValueFromQMetaObject() to make enums and instantiation of QMetaObject available to script code. The constructor generated by this macro takes a single argument of type ArgType; typically the argument is the parent type of the new instance, in which case ArgType is QWidget*
or QObject*
. Objects created by the constructor will have QScriptEngine::AutoOwnership ownership.
Definition at line 283 of file qscriptengine.h.
◆ qScriptConnect()
◆ qScriptDisconnect()
◆ qscriptQMetaObjectConstructor()
Definition at line 57 of file qscriptengine.h.
The QScriptValue class acts as a container for the Qt Script data types.
◆ qScriptRegisterMetaType()
Definition at line 380 of file qscriptengine.h.
390 const int id = qRegisterMetaType<T>();
393 eng,
id, reinterpret_cast<QScriptEngine::MarshalFunction>(toScriptValue),
void qScriptRegisterMetaType_helper(QScriptEngine *eng, int type, QScriptEngine::MarshalFunction mf, QScriptEngine::DemarshalFunction df, const QScriptValue &prototype)
static JSAgentWatchData fromScriptValue(const QString &expression, const QScriptValue &value)
◆ qScriptRegisterMetaType_helper()
◆ qScriptRegisterSequenceMetaType()
Definition at line 424 of file qscriptengine.h.
void qScriptValueToSequence(const QScriptValue &value, Container &container)
Copies the elements in the sequence specified by value to the given container of template type Contai...
QScriptValue qScriptValueFromSequence(QScriptEngine *engine, const Container &container)
static QByteArray prototype(const QList< QByteArray > ¶meterTypes, const QList< QByteArray > ¶meterNames, bool *ok)
◆ qscriptvalue_cast()
Definition at line 344 of file qscriptengine.h.
Referenced by Node::attributes(), Node::childNodes(), Document::documentElement(), Node::firstChild(), QScriptEngine::fromScriptValue(), Text::isElementContentWhitespace(), Node::lastChild(), NamedNodeMap::length(), NodeList::length(), CharacterData::length(), Attr::name(), Node::nextSibling(), Node::nodeName(), Node::nodeType(), Node::nodeValue(), Attr::ownerElement(), Node::parentNode(), Node::previousSibling(), QDeclarativeSqlQueryScriptClass::property(), NamedNodeMapClass::property(), NodeListClass::property(), qmlsqldatabase_change_version(), qmlsqldatabase_executeSql(), qmlsqldatabase_item(), qmlsqldatabase_transaction_shared(), qScriptValueToValue(), NamedNodeMapClass::queryProperty(), NodeListClass::queryProperty(), QDeclarativeSqlQueryScriptClass::setProperty(), QScriptDebuggerBackendPrivate::trace(), Attr::value(), Text::wholeText(), Document::xmlEncoding(), Document::xmlStandalone(), and Document::xmlVersion().
347 const int id = qMetaTypeId<T>();
352 return qvariant_cast<T>(value.
toVariant());
QVariant toVariant() const
Returns the QVariant value of this QScriptValue, if it can be converted to a QVariant; otherwise retu...
bool qscriptvalue_cast_helper(const QScriptValue &value, int type, void *ptr)
bool isVariant() const
Returns true if this QScriptValue is a variant value; otherwise returns false.
◆ qscriptvalue_cast< QVariant >()
Definition at line 358 of file qscriptengine.h.
QVariant toVariant() const
Returns the QVariant value of this QScriptValue, if it can be converted to a QVariant; otherwise retu...
◆ qscriptvalue_cast_helper()
bool qscriptvalue_cast_helper |
( |
const QScriptValue & |
value, |
|
|
int |
type, |
|
|
void * |
ptr |
|
) |
| |
|
inline |
◆ qScriptValueFromQMetaObject()
Definition at line 305 of file qscriptengine.h.
QScriptValue scriptValueFromQMetaObject()
Creates a QScriptValue that represents the Qt class T.
◆ qScriptValueFromSequence()
template<class Container >
Definition at line 401 of file qscriptengine.h.
Referenced by qScriptRegisterSequenceMetaType().
404 typename Container::const_iterator begin = cont.begin();
405 typename Container::const_iterator
end = cont.end();
406 typename Container::const_iterator
it;
408 for (it = begin, i = 0; it !=
end; ++
it, ++i)
#define it(className, varName)
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
long ASN1_INTEGER_get ASN1_INTEGER * a
void setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags=KeepExistingFlags)
Sets the value of this QScriptValue's property with the given name to the given value.
QScriptValue newArray(uint length=0)
Creates a QtScript object of class Array with the given length.
static const KeyPair *const end
The QScriptValue class acts as a container for the Qt Script data types.
◆ qScriptValueFromValue()
◆ qScriptValueFromValue< QVariant >()
Definition at line 333 of file qscriptengine.h.
int userType() const
Returns the storage type of the value stored in the variant.
QScriptValue qScriptValueFromValue_helper(QScriptEngine *engine, int type, const void *ptr)
◆ qScriptValueFromValue_helper()
◆ qScriptValueToSequence()
template<class Container >
void qScriptValueToSequence |
( |
const QScriptValue & |
value, |
|
|
Container & |
cont |
|
) |
| |
|
related |
Definition at line 414 of file qscriptengine.h.
Referenced by QScriptDebuggerScriptedConsoleCommand::parse(), and qScriptRegisterSequenceMetaType().
417 for (
quint32 i = 0; i < len; ++i) {
419 cont.push_back(qscriptvalue_cast<typename Container::value_type>(item));
QScriptValue property(const QString &name, const ResolveFlags &mode=ResolvePrototype) const
Returns the value of this QScriptValue's property with the given name, using the given mode to resolv...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
quint32 toUInt32() const
Returns the unsigned 32-bit integer value of this QScriptValue, using the conversion rules described ...
The QScriptValue class acts as a container for the Qt Script data types.
◆ qScriptValueToValue()
Definition at line 365 of file qscriptengine.h.
T qscriptvalue_cast(const QScriptValue &value)
Returns the given value converted to the template type T.