This commit is contained in:
parent
2dbb48d8bb
commit
686f4ff2d8
|
@ -18,14 +18,19 @@ static void debugNone2()
|
||||||
qDebug() << "None 2";
|
qDebug() << "None 2";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void debugValueI( int i )
|
static void debugValueI1( int i )
|
||||||
{
|
{
|
||||||
qDebug() << i;
|
qDebug() << "I1" << i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void debugValueI2( int i )
|
||||||
|
{
|
||||||
|
qDebug() << "I2" << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void debugValueD( qreal d )
|
static void debugValueD( qreal d )
|
||||||
{
|
{
|
||||||
qDebug() << d;
|
qDebug() << "D" << d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void debugValue( qreal d, int i )
|
static void debugValue( qreal d, int i )
|
||||||
|
@ -103,7 +108,8 @@ int main( int argc, char* argv[] )
|
||||||
invoker.addCallback( debugNone1 );
|
invoker.addCallback( debugNone1 );
|
||||||
invoker.addCallback( debugNone2 );
|
invoker.addCallback( debugNone2 );
|
||||||
invoker.addCallback( debugValue );
|
invoker.addCallback( debugValue );
|
||||||
invoker.addCallback( debugValueI );
|
invoker.addCallback( debugValueI1 );
|
||||||
|
invoker.addCallback( debugValueI2 );
|
||||||
invoker.addCallback( debugValueD );
|
invoker.addCallback( debugValueD );
|
||||||
invoker.addCallback( &object, &MyObject::print1 );
|
invoker.addCallback( &object, &MyObject::print1 );
|
||||||
invoker.addCallback( &object2, &MyObject2::print1 );
|
invoker.addCallback( &object2, &MyObject2::print1 );
|
||||||
|
@ -120,7 +126,8 @@ int main( int argc, char* argv[] )
|
||||||
invoker.addCallback( &object, []( double d ) { qDebug() << d; } );
|
invoker.addCallback( &object, []( double d ) { qDebug() << d; } );
|
||||||
invoker.addCallback( []() { qDebug() << "HERE"; } );
|
invoker.addCallback( []() { qDebug() << "HERE"; } );
|
||||||
invoker.addCallback( []( int i, double d ) { qDebug() << i << d; } );
|
invoker.addCallback( []( int i, double d ) { qDebug() << i << d; } );
|
||||||
invoker.addCallback( []( int i ) { qDebug() << i; } );
|
invoker.addCallback( []( int i ) { qDebug() << "I1" << i; } );
|
||||||
|
invoker.addCallback( []( int i ) { qDebug() << "I2" << i; } );
|
||||||
invoker.addCallback( []( double d ) { qDebug() << d; } );
|
invoker.addCallback( []( double d ) { qDebug() << d; } );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -74,30 +74,26 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void invoke(int which, QtPrivate::QSlotObjectBase*,
|
static void invoke(int which, QtPrivate::QSlotObjectBase* invokable,
|
||||||
QObject* object, void** args, bool* )
|
QObject* object, void** args, bool* )
|
||||||
{
|
{
|
||||||
static Invokable* invokable = nullptr;
|
|
||||||
|
|
||||||
switch ( which )
|
switch ( which )
|
||||||
{
|
{
|
||||||
case Find:
|
case Find:
|
||||||
{
|
{
|
||||||
*reinterpret_cast< void** >( args[0] ) = invokable;
|
*reinterpret_cast< void** >( args[0] ) = nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Create:
|
case Create:
|
||||||
{
|
{
|
||||||
invokable = new Invokable( *reinterpret_cast< Function* >( args[1] ) );
|
*reinterpret_cast< void** >( args[0] ) =
|
||||||
*reinterpret_cast< void** >( args[0] ) = invokable;
|
new Invokable( *reinterpret_cast< Function* >( args[1] ) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Destroy:
|
case Destroy:
|
||||||
{
|
{
|
||||||
delete invokable;
|
delete static_cast< Invokable* >( invokable );
|
||||||
invokable = nullptr;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Call:
|
case Call:
|
||||||
|
@ -105,7 +101,7 @@ public:
|
||||||
typedef QtPrivate::FunctionPointer< Function > FuncType;
|
typedef QtPrivate::FunctionPointer< Function > FuncType;
|
||||||
|
|
||||||
FuncType::template call< Args, R >(
|
FuncType::template call< Args, R >(
|
||||||
invokable->m_function, object, args );
|
static_cast< Invokable* >( invokable )->m_function, object, args );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TypeInfo:
|
case TypeInfo:
|
||||||
|
|
Loading…
Reference in New Issue