Exemplo n.º 1
0
QSArgument QuickInterpreter::convertToArgument( const QSObject &o )
{
    if( !o.isValid() )
	return QSArgument();
    const QSClass *cl = o.objectType();
    if( cl->name() == QString::fromLatin1("QObject") ) {
	QSWrapperShared *shared = (QSWrapperShared*) o.shVal();
	if (shared->objects.isEmpty())
            return QSArgument();
	return QSArgument( shared->objects[0] );
    } else if( cl == ptrClass ) {
	Q_ASSERT( ptrClass->pointer( &o ) );
	return QSArgument( ptrClass->pointer( &o ) );
    } else {
	return QSArgument( o.toVariant( QVariant::Invalid ) );
    }
}
Exemplo n.º 2
0
QVariant QuickInterpreter::convertToArgument(const QSObject &o)
{
    if(!o.isValid())
	return QVariant();
    const QSClass *cl = o.objectType();
    if(cl->name() == QString::fromLatin1("QObject")) {
	QSWrapperShared *shared = (QSWrapperShared*) o.shVal();
	if (shared->objects.isEmpty())
            return QVariant();
        QVariant v(QMetaType::QObjectStar, static_cast<QObject *>(0));
        qVariantSetValue<QObject *>(v, shared->objects[0]);
        return v;
    } else if(cl == ptrClass) {
	Q_ASSERT(ptrClass->pointer(&o));
        QVariant v(QMetaType::VoidStar, static_cast<void *>(0));
        qVariantSetValue<void *>(v, ptrClass->pointer(&o));
        return v;
    } else {
	return QVariant(o.toVariant(QVariant::Invalid));
    }
}