QskMetaInvokable improved
This commit is contained in:
parent
b788f7da2c
commit
c109b170f1
@ -10,6 +10,7 @@
|
|||||||
#include <QMetaMethod>
|
#include <QMetaMethod>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -39,8 +40,16 @@ static void qskInvokeSetProperty( QObject* object,
|
|||||||
const QMetaObject* metaObject, int propertyIndex,
|
const QMetaObject* metaObject, int propertyIndex,
|
||||||
void* args[], Qt::ConnectionType connectionType )
|
void* args[], Qt::ConnectionType connectionType )
|
||||||
{
|
{
|
||||||
|
int invokeType = connectionType & 0x3;
|
||||||
|
|
||||||
|
if ( invokeType == Qt::AutoConnection )
|
||||||
|
{
|
||||||
|
invokeType = ( object->thread() != QThread::currentThread() )
|
||||||
|
? Qt::QueuedConnection : Qt::DirectConnection;
|
||||||
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if ( connectionType != Qt::DirectConnection )
|
if ( invokeType != Qt::DirectConnection )
|
||||||
return; // TODO ...
|
return; // TODO ...
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -48,14 +57,10 @@ static void qskInvokeSetProperty( QObject* object,
|
|||||||
{
|
{
|
||||||
int status = -1;
|
int status = -1;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
void *argv[] = { args[1], nullptr, &status, &flags };
|
void* argv[] = { args[1], nullptr, &status, &flags };
|
||||||
|
|
||||||
#if 1
|
|
||||||
QMetaObject::metacall( object,
|
QMetaObject::metacall( object,
|
||||||
QMetaObject::WriteProperty, propertyIndex, argv );
|
QMetaObject::WriteProperty, propertyIndex, argv );
|
||||||
#else
|
|
||||||
metaObject->d.static_metacall(object, QMetaObject::WriteProperty, idx, argv);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,6 +291,31 @@ int QskMetaInvokable::returnType() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray QskMetaInvokable::name() const
|
||||||
|
{
|
||||||
|
switch( m_type )
|
||||||
|
{
|
||||||
|
case MetaMethod:
|
||||||
|
{
|
||||||
|
return method().name();
|
||||||
|
}
|
||||||
|
case MetaProperty:
|
||||||
|
{
|
||||||
|
return property().name();
|
||||||
|
}
|
||||||
|
case MetaFunction:
|
||||||
|
{
|
||||||
|
// what to do here ???
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QMetaMethod QskMetaInvokable::method() const
|
QMetaMethod QskMetaInvokable::method() const
|
||||||
{
|
{
|
||||||
if ( m_type == MetaMethod && m_metaData.metaObject )
|
if ( m_type == MetaMethod && m_metaData.metaObject )
|
||||||
|
@ -68,9 +68,11 @@ public:
|
|||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
QMetaMethod method() const;
|
QByteArray name() const;
|
||||||
QMetaProperty property() const;
|
|
||||||
QskMetaFunction function() const;
|
QMetaMethod method() const;
|
||||||
|
QMetaProperty property() const;
|
||||||
|
QskMetaFunction function() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct FunctionData
|
struct FunctionData
|
||||||
|
Loading…
x
Reference in New Issue
Block a user