pre Qt 5.15 code removed
This commit is contained in:
parent
1f0ad384ac
commit
09a12fc7a8
|
@ -14,23 +14,12 @@ QSK_QT_PRIVATE_BEGIN
|
||||||
#include <private/qobject_p.h>
|
#include <private/qobject_p.h>
|
||||||
QSK_QT_PRIVATE_END
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
static inline void qskInvokeFunctionQueued( QObject* object,
|
static inline void qskInvokeFunctionQueued(
|
||||||
QskMetaFunction::FunctionCall* functionCall, int argc, int* types, void* argv[],
|
QObject* object, QskMetaFunction::FunctionCall* functionCall,
|
||||||
QSemaphore* semaphore = nullptr )
|
void* argv[], QSemaphore* semaphore )
|
||||||
{
|
{
|
||||||
constexpr QObject* sender = nullptr;
|
|
||||||
constexpr int signalId = 0;
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
|
||||||
Q_UNUSED( types )
|
|
||||||
Q_UNUSED( argc )
|
|
||||||
|
|
||||||
auto event = new QMetaCallEvent(
|
auto event = new QMetaCallEvent(
|
||||||
functionCall, sender, signalId, argv, semaphore );
|
functionCall, nullptr, 0, argv, semaphore );
|
||||||
#else
|
|
||||||
auto event = new QMetaCallEvent(
|
|
||||||
functionCall, sender, signalId, argc, types, argv, semaphore );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QCoreApplication::postEvent( object, event );
|
QCoreApplication::postEvent( object, event );
|
||||||
}
|
}
|
||||||
|
@ -231,8 +220,7 @@ void QskMetaFunction::invoke( QObject* object,
|
||||||
|
|
||||||
QSemaphore semaphore;
|
QSemaphore semaphore;
|
||||||
|
|
||||||
qskInvokeFunctionQueued( receiver,
|
qskInvokeFunctionQueued( receiver, m_functionCall, argv, &semaphore );
|
||||||
m_functionCall, 0, nullptr, argv, &semaphore );
|
|
||||||
|
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
|
|
||||||
|
@ -247,18 +235,11 @@ void QskMetaFunction::invoke( QObject* object,
|
||||||
|
|
||||||
const auto argc = parameterCount() + 1; // return value + arguments
|
const auto argc = parameterCount() + 1; // return value + arguments
|
||||||
|
|
||||||
auto types = static_cast< int* >( std::malloc( argc * sizeof( int ) ) );
|
|
||||||
auto arguments = static_cast< void** >( std::malloc( argc * sizeof( void* ) ) );
|
auto arguments = static_cast< void** >( std::malloc( argc * sizeof( void* ) ) );
|
||||||
|
|
||||||
if ( types == nullptr || arguments == nullptr )
|
if ( arguments == nullptr )
|
||||||
{
|
|
||||||
std::free( types );
|
|
||||||
std::free( arguments );
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
types[ 0 ] = QMetaType::UnknownType;
|
|
||||||
arguments[ 0 ] = nullptr;
|
arguments[ 0 ] = nullptr;
|
||||||
|
|
||||||
const int* parameterTypes = m_functionCall->parameterTypes();
|
const int* parameterTypes = m_functionCall->parameterTypes();
|
||||||
|
@ -271,26 +252,24 @@ void QskMetaFunction::invoke( QObject* object,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
types[ i ] = parameterTypes[ i - 1 ];
|
const auto type = parameterTypes[ i - 1 ];
|
||||||
|
|
||||||
arguments[ i ] =
|
arguments[ i ] =
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
QMetaType( types[ i ] ).create( argv[ i ] );
|
QMetaType( type ).create( argv[ i ] );
|
||||||
#else
|
#else
|
||||||
QMetaType::create( types[ i ], argv[ i ] );
|
QMetaType::create( type, argv[ i ] );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( receiver.isNull() )
|
if ( receiver.isNull() )
|
||||||
{
|
{
|
||||||
// object might have died in the meantime
|
// object might have died in the meantime
|
||||||
std::free( types );
|
|
||||||
std::free( arguments );
|
std::free( arguments );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qskInvokeFunctionQueued( object, m_functionCall, argc, types, arguments );
|
qskInvokeFunctionQueued( object, m_functionCall, arguments, nullptr );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,19 +62,12 @@ namespace
|
||||||
public:
|
public:
|
||||||
MetaCallEvent(
|
MetaCallEvent(
|
||||||
QMetaObject::Call call, CallFunction callFunction, ushort offset,
|
QMetaObject::Call call, CallFunction callFunction, ushort offset,
|
||||||
ushort index, int nargs, int* types, void* args[],
|
ushort index, void* args[], QSemaphore* semaphore )
|
||||||
QSemaphore* semaphore = nullptr )
|
: QMetaCallEvent( offset, index, callFunction, nullptr, -1, args, semaphore )
|
||||||
: QMetaCallEvent( offset, index, callFunction, nullptr, -1,
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 )
|
|
||||||
nargs, types,
|
|
||||||
#endif
|
|
||||||
args, semaphore )
|
|
||||||
, m_call( call )
|
, m_call( call )
|
||||||
, m_callFunction( callFunction )
|
, m_callFunction( callFunction )
|
||||||
, m_index( index )
|
, m_index( index )
|
||||||
{
|
{
|
||||||
Q_UNUSED( nargs )
|
|
||||||
Q_UNUSED( types )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void placeMetaCall( QObject* object ) override
|
void placeMetaCall( QObject* object ) override
|
||||||
|
@ -93,13 +86,12 @@ namespace
|
||||||
|
|
||||||
static inline void qskInvokeMetaCallQueued(
|
static inline void qskInvokeMetaCallQueued(
|
||||||
QObject* object, QMetaObject::Call call, ushort offset,
|
QObject* object, QMetaObject::Call call, ushort offset,
|
||||||
ushort index, int nargs, int* types, void* args[],
|
ushort index, void* args[], QSemaphore* semaphore )
|
||||||
QSemaphore* semaphore = nullptr )
|
|
||||||
{
|
{
|
||||||
const auto callFunction = object->metaObject()->d.static_metacall;
|
const auto callFunction = object->metaObject()->d.static_metacall;
|
||||||
|
|
||||||
auto event = new MetaCallEvent( call, callFunction,
|
auto event = new MetaCallEvent( call, callFunction,
|
||||||
offset, index, nargs, types, args, semaphore );
|
offset, index, args, semaphore );
|
||||||
|
|
||||||
QCoreApplication::postEvent( object, event );
|
QCoreApplication::postEvent( object, event );
|
||||||
}
|
}
|
||||||
|
@ -205,7 +197,7 @@ static void qskInvokeMetaCall(
|
||||||
QSemaphore semaphore;
|
QSemaphore semaphore;
|
||||||
|
|
||||||
qskInvokeMetaCallQueued( receiver, call,
|
qskInvokeMetaCallQueued( receiver, call,
|
||||||
offset, index, 0, nullptr, argv, &semaphore );
|
offset, index, argv, &semaphore );
|
||||||
|
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
|
|
||||||
|
@ -216,9 +208,7 @@ static void qskInvokeMetaCall(
|
||||||
if ( receiver == nullptr )
|
if ( receiver == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int* types = nullptr;
|
|
||||||
void** arguments = nullptr;
|
void** arguments = nullptr;
|
||||||
int argc = 0;
|
|
||||||
|
|
||||||
if ( call == QMetaObject::InvokeMetaMethod )
|
if ( call == QMetaObject::InvokeMetaMethod )
|
||||||
{
|
{
|
||||||
|
@ -226,9 +216,8 @@ static void qskInvokeMetaCall(
|
||||||
// should be doable without QMetaMethod. TODO ...
|
// should be doable without QMetaMethod. TODO ...
|
||||||
const auto method = metaObject->method( offset + index );
|
const auto method = metaObject->method( offset + index );
|
||||||
#endif
|
#endif
|
||||||
argc = method.parameterCount() + 1;
|
const int argc = method.parameterCount() + 1;
|
||||||
|
|
||||||
types = static_cast< int* >( malloc( argc * sizeof( int ) ) );
|
|
||||||
arguments = static_cast< void** >( malloc( argc * sizeof( void* ) ) );
|
arguments = static_cast< void** >( malloc( argc * sizeof( void* ) ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -236,7 +225,6 @@ static void qskInvokeMetaCall(
|
||||||
invalid for Queued Connections.
|
invalid for Queued Connections.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
types[ 0 ] = QMetaType::UnknownType;
|
|
||||||
arguments[ 0 ] = nullptr;
|
arguments[ 0 ] = nullptr;
|
||||||
|
|
||||||
for ( int i = 1; i < argc; i++ )
|
for ( int i = 1; i < argc; i++ )
|
||||||
|
@ -248,8 +236,8 @@ static void qskInvokeMetaCall(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
types[ i ] = method.parameterType( i - 1 );
|
const auto type = method.parameterType( i - 1 );
|
||||||
arguments[ i ] = qskMetaTypeCreate( types[ i ], argv[ i ] );
|
arguments[ i ] = qskMetaTypeCreate( type, argv[ i ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -257,26 +245,18 @@ static void qskInvokeMetaCall(
|
||||||
// should be doable without QMetaMethod. TODO ...
|
// should be doable without QMetaMethod. TODO ...
|
||||||
const auto property = metaObject->property( offset + index );
|
const auto property = metaObject->property( offset + index );
|
||||||
|
|
||||||
argc = 1;
|
arguments = static_cast< void** >( malloc( 1 * sizeof( void* ) ) );
|
||||||
|
arguments[ 0 ] = qskMetaTypeCreate( property.userType(), argv[ 0 ] );
|
||||||
types = static_cast< int* >( malloc( argc * sizeof( int ) ) );
|
|
||||||
arguments = static_cast< void** >( malloc( argc * sizeof( void* ) ) );
|
|
||||||
|
|
||||||
types[ 0 ] = property.userType();
|
|
||||||
arguments[ 0 ] = qskMetaTypeCreate( types[ 0 ], argv[ 0 ] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( receiver.isNull() )
|
if ( receiver.isNull() )
|
||||||
{
|
{
|
||||||
// object might have died in the meantime
|
// object might have died in the meantime
|
||||||
free( types );
|
|
||||||
free( arguments );
|
free( arguments );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qskInvokeMetaCallQueued( object, call,
|
qskInvokeMetaCallQueued( object, call, offset, index, arguments, nullptr );
|
||||||
offset, index, argc, types, arguments );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue