qskinny/playground/invoker/Callback.cpp

41 lines
1.1 KiB
C++
Raw Normal View History

/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#include "Callback.h"
#include <QMetaMethod>
2018-08-03 08:15:28 +02:00
Callback::Callback()
: m_context( nullptr )
{
}
2018-08-03 08:15:28 +02:00
Callback::Callback( const QObject* context, const QMetaMethod& method )
: m_context( const_cast< QObject* >( context ) )
, m_invokable( method )
{
}
2018-08-03 08:15:28 +02:00
Callback::Callback( const QObject* context, const char* methodName )
: Callback( context, qskMetaMethod( context, methodName ) )
{
}
2018-08-03 08:15:28 +02:00
Callback::Callback( const QObject* context, const QMetaProperty& property )
: m_context( const_cast< QObject* >( context ) )
, m_invokable( property )
{
}
2018-08-03 08:15:28 +02:00
Callback::Callback( const QObject* context, const QskMetaFunction& function )
: m_context( const_cast< QObject* >( context ) )
, m_invokable( function )
{
}
void Callback::invoke( void* args[], Qt::ConnectionType connectionType )
{
m_invokable.invoke( m_context, args, connectionType );
}