KJsEmbed
qobject_binding.cpp
135 KJSEmbed::QObjectBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::QObjectBinding>(exec, self);
136 if (!imp) { // No implementation, so we need to use the first argument as we are a global static invocation.
145 KJSEmbed::QObjectBinding *senderImp = KJSEmbed::extractBindingImp<KJSEmbed::QObjectBinding>(exec, args[0]);
159 receiver = new SlotProxy(args[2]->toObject(exec), exec->dynamicInterpreter(), sender, args[3]->toString(exec).ascii());
170 QMetaMethod senderMetaMethod = senderMetaObject->method(senderMetaObject->indexOfSignal(signal.constData()));
173 QMetaMethod receiverMetaMethod = receiverMetaObject->method(receiverMetaObject->indexOfSlot(slot.constData()));
175 if (validSignal(senderMetaMethod, senderImp->access()) && (!receiverImp || validSlot(receiverMetaMethod, receiverImp->access()))) {
176 return KJS::jsBoolean(QObject::connect(sender, signal.constData(), receiver, slot.constData()));
191 void QObjectBinding::publishQObject(KJS::ExecState *exec, KJS::JSObject *target, QObject *object)
193 KJSEmbed::QObjectBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::QObjectBinding>(exec, target);
207 KJSEmbed::QObjectBinding *childImp = KJSEmbed::extractBindingImp<KJSEmbed::QObjectBinding>(exec, childObject);
257 exec->dynamicInterpreter()->globalObject()->put(exec, "connect", new StaticBinding(exec, &QObjectFactory::methods()[0]));
281 bool QObjectBinding::getOwnPropertySlot(KJS::ExecState *exec, const KJS::Identifier &propertyName, KJS::PropertySlot &slot)
309 qDebug() << QString("propertyGetter called but no property, name was '%1'").arg(propertyName.ascii());
323 void QObjectBinding::put(KJS::ExecState *exec, const KJS::Identifier &propertyName, KJS::JSValue *value, int attr)
347 i18n("Setting property %1 failed: property invalid, read-only or does not exist").arg(propertyName.ascii()));
397 PointerBase *getArg(KJS::ExecState *exec, const QList<QByteArray> &types, const KJS::List &args, int idx, QString &errorText)
409 const QString firstPart = i18np("The slot asked for %1 argument", "The slot asked for %1 arguments", idx);
410 const QString secondPart = i18np("but there is only %1 available", "but there are only %1 available", types.size());
411 errorText = i18nc("%1 is 'the slot asked for foo arguments', %2 is 'but there are only bar available'", "%1, %2.");
417 //qDebug( QString("type=%1 argtype=%2 variantType=%3 (%4)").arg(types[idx].constData()).arg(args[idx]->type()).arg(varianttype).arg(QVariant::typeToName(varianttype)).toLatin1() );
538 } else if (ObjectBinding *objImp = KJSEmbed::extractBindingImp<ObjectBinding>(exec, args[idx])) {
543 //qDebug() << "\tVariantBinding typeName=" << valImp->variant().typeName() << "type=" << valImp->variant().type() << "userType=" << valImp->variant().userType() << " variant=" << valImp->variant();
634 KJS::JSValue *SlotBinding::callAsFunction(KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &args)
652 if (metaMember.parameterTypes().size() == args.size() && validSlot(metaMember, imp->access())) {
660 return KJS::throwError(exec, KJS::GeneralError, i18n("No such method '%1'.", m_memberName.constData()));
661 //return KJSEmbed::throwError(exec, i18n("Call to '%1' failed.").arg(m_memberName.constData()));
677 QVariant returnValue = returnIsMetaType ? QVariant(tp, (void *)nullptr) : QVariant(returnTypeId);
689 return KJS::throwError(exec, KJS::GeneralError, i18n("Call to method '%1' failed, unable to get argument %2: %3", m_memberName.constData(), idx, errorText));
726 return KJS::throwError(exec, KJS::GeneralError, i18n("Call to '%1' failed.", m_memberName.constData()));
733 : KJS::InternalFunctionImp(static_cast<KJS::FunctionPrototype *>(exec->lexicalInterpreter()->builtinFunctionPrototype()),
741 KJS::JSObject *KJSEmbed::createQObject(KJS::ExecState *exec, QObject *value, KJSEmbed::ObjectBinding::Ownership owner)
819 KJSEmbed::QObjectBinding *parentImp = KJSEmbed::extractBindingImp<KJSEmbed::QObjectBinding>(exec, parentObject);
821 parentImp->setAccess(imp->access()); // inherit access from child since we don't know the access-level of the parent here :-(
846 KJSEmbed::QObjectBinding *childImp = KJSEmbed::extractBindingImp<KJSEmbed::QObjectBinding>(exec, childObject);
bool isNull() const const
int methodCount() const const
int indexOfSlot(const char *slot) const const
int value(int index) const const
A binding method that is used in VariantBinding and ObjectBinding.
Definition: static_binding.h:38
const QChar * constData() const const
bool isScriptable(const QObject *object) const const
QString number(int n, int base)
JSGlobalObject * globalObject() const
int type(const char *typeName)
Type type(const QSqlDatabase &db)
int count(const T &value) const const
T value() const const
Private
PointerToQObject
bool isWritable() const const
QVariant::Type nameToType(const char *name)
bool inherits(const char *className) const const
QByteArray toLatin1() const const
int size() const
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
const char * className
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
const char * ascii() const
QStringList types(Mode mode=Writing)
QByteArray methodSignature() const const
int size() const const
QString typeName(const QJsonObject &obj)
const char * typeName() const const
QString i18n(const char *text, const TYPE &arg...)
QVariant::Type type() const const
bool isEmpty() const const
QMetaMethod method(int index) const const
const QMetaObject * superClass() const const
KJS::JSObject * construct(KJS::ExecState *exec, const KJS::List &args) override
Calls the callback that will in turn create a new instance of this object with the arguments passed i...
Definition: static_binding.cpp:77
QList< QByteArray > parameterNames() const const
int indexOfSignal(const char *signal) const const
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
static void publish(KJS::ExecState *exec, KJS::JSObject *object, const Method *methods)
Publishes an array of Methods to an object.
Definition: static_binding.cpp:59
bool convert(int targetTypeId)
uint toUInt(bool *ok, int base) const const
virtual const QMetaObject * metaObject() const const
QString & replace(int position, int n, QChar after)
QString & remove(int position, int n)
T findChild(const QString &name, Qt::FindChildOptions options) const const
QMetaType::TypeFlags typeFlags(int type)
bool canConvert(int targetTypeId) const const
QString i18np(const char *singular, const char *plural, const TYPE &arg...)
const char * className() const const
static ScriptableExtension * childObject(QObject *obj)
int enumeratorCount() const const
bool setProperty(const char *name, const QVariant &value)
int keyCount() const const
QMetaProperty property(int index) const const
Filters events for a QObject and forwards them to a JS handler.
Definition: eventproxy.h:43
const char * constData() const const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString left(int n) const const
QMetaMethod::Access access() const const
QMetaEnum enumerator(int index) const const
const char * key(int index) const const
QString i18nc(const char *context, const char *text, const TYPE &arg...)
virtual QVariant callAsFunction(ScriptableExtension *callerPrincipal, quint64 objId, const ArgList &args)
Interpreter * dynamicInterpreter() const
int indexOfProperty(const char *name) const const
virtual bool put(ScriptableExtension *callerPrincipal, quint64 objId, const QString &propName, const QVariant &value)
Type
const char * typeName() const const
QList< QByteArray > parameterTypes() const const
bool isEnumType() const const
int access(const QString &path, int mode)
char * toString(const EngineQuery &query)
QVariant property(const char *name) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 10 2023 03:59:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 10 2023 03:59:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.