This commit is contained in:
Uwe Rathmann 2018-03-02 07:23:12 +01:00
parent 2dbb48d8bb
commit 686f4ff2d8
2 changed files with 18 additions and 15 deletions

View File

@ -18,14 +18,19 @@ static void debugNone2()
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 )
{
qDebug() << d;
qDebug() << "D" << d;
}
static void debugValue( qreal d, int i )
@ -103,7 +108,8 @@ int main( int argc, char* argv[] )
invoker.addCallback( debugNone1 );
invoker.addCallback( debugNone2 );
invoker.addCallback( debugValue );
invoker.addCallback( debugValueI );
invoker.addCallback( debugValueI1 );
invoker.addCallback( debugValueI2 );
invoker.addCallback( debugValueD );
invoker.addCallback( &object, &MyObject::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( []() { qDebug() << "HERE"; } );
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; } );
#endif

View File

@ -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* )
{
static Invokable* invokable = nullptr;
switch ( which )
{
case Find:
{
*reinterpret_cast< void** >( args[0] ) = invokable;
*reinterpret_cast< void** >( args[0] ) = nullptr;
break;
}
case Create:
{
invokable = new Invokable( *reinterpret_cast< Function* >( args[1] ) );
*reinterpret_cast< void** >( args[0] ) = invokable;
*reinterpret_cast< void** >( args[0] ) =
new Invokable( *reinterpret_cast< Function* >( args[1] ) );
break;
}
case Destroy:
{
delete invokable;
invokable = nullptr;
delete static_cast< Invokable* >( invokable );
break;
}
case Call:
@ -105,7 +101,7 @@ public:
typedef QtPrivate::FunctionPointer< Function > FuncType;
FuncType::template call< Args, R >(
invokable->m_function, object, args );
static_cast< Invokable* >( invokable )->m_function, object, args );
break;
}
case TypeInfo: