better compile time checks
This commit is contained in:
parent
8227d8446c
commit
aeb29e855a
|
@ -31,30 +31,40 @@ class QSK_EXPORT QskShortcutMap
|
||||||
bool autoRepeat, const QObject* receiver, const char* method );
|
bool autoRepeat, const QObject* receiver, const char* method );
|
||||||
|
|
||||||
// functor based slots
|
// functor based slots
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* = nullptr >
|
||||||
static int addShortcut( const QKeySequence&,
|
static int addShortcut( const QKeySequence&, bool autoRepeat, T function );
|
||||||
bool autoRepeat, T function );
|
|
||||||
|
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* = nullptr >
|
||||||
static int addShortcut( const QKeySequence&,
|
static int addShortcut( QQuickItem*, const QKeySequence&, bool autoRepeat, T function );
|
||||||
bool autoRepeat, const QObject* context, T function );
|
|
||||||
|
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* = nullptr >
|
||||||
static int addShortcut( QQuickItem*, const QKeySequence&,
|
static int addShortcut( QQuickWindow*, const QKeySequence&, bool autoRepeat, T function );
|
||||||
bool autoRepeat, T function );
|
|
||||||
|
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* = nullptr >
|
||||||
|
static int addShortcut( const QKeySequence&, bool autoRepeat,
|
||||||
|
const QObject* context, T function );
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* = nullptr >
|
||||||
static int addShortcut( QQuickItem*, const QKeySequence&,
|
static int addShortcut( QQuickItem*, const QKeySequence&,
|
||||||
bool autoRepeat, const QObject* context, T function );
|
bool autoRepeat, const QObject* context, T function );
|
||||||
|
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* = nullptr >
|
||||||
static int addShortcut( QQuickWindow*, const QKeySequence&,
|
|
||||||
bool autoRepeat, T function );
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
static int addShortcut( QQuickWindow*, const QKeySequence&,
|
static int addShortcut( QQuickWindow*, const QKeySequence&,
|
||||||
bool autoRepeat, const QObject* context, T function );
|
bool autoRepeat, const QObject* context, T function );
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* = nullptr >
|
||||||
|
static int addShortcut( const QKeySequence&, bool autoRepeat,
|
||||||
|
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function );
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* = nullptr >
|
||||||
|
static int addShortcut( QQuickItem*, const QKeySequence&, bool autoRepeat,
|
||||||
|
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function );
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* = nullptr >
|
||||||
|
static int addShortcut( QQuickWindow*, const QKeySequence&, bool autoRepeat,
|
||||||
|
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function );
|
||||||
|
|
||||||
|
|
||||||
static bool contextMatcher( const QQuickItem*, Qt::ShortcutContext );
|
static bool contextMatcher( const QQuickItem*, Qt::ShortcutContext );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -90,22 +100,14 @@ inline int QskShortcutMap::addShortcut(
|
||||||
return addMethod( item, sequence, autoRepeat, receiver, method );
|
return addMethod( item, sequence, autoRepeat, receiver, method );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* >
|
||||||
inline int QskShortcutMap::addShortcut(
|
inline int QskShortcutMap::addShortcut(
|
||||||
const QKeySequence& sequence, bool autoRepeat, T function )
|
const QKeySequence& sequence, bool autoRepeat, T function )
|
||||||
{
|
{
|
||||||
return addFunctionT( nullptr, sequence, autoRepeat, nullptr, function );
|
return addFunctionT( nullptr, sequence, autoRepeat, nullptr, function );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* >
|
||||||
inline int QskShortcutMap::addShortcut(
|
|
||||||
const QKeySequence& sequence, bool autoRepeat,
|
|
||||||
const QObject* context, T function )
|
|
||||||
{
|
|
||||||
return addFunctionT( nullptr, sequence, autoRepeat, context, function );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
inline int QskShortcutMap::addShortcut(
|
inline int QskShortcutMap::addShortcut(
|
||||||
QQuickItem* item, const QKeySequence& sequence,
|
QQuickItem* item, const QKeySequence& sequence,
|
||||||
bool autoRepeat, T function )
|
bool autoRepeat, T function )
|
||||||
|
@ -113,16 +115,7 @@ inline int QskShortcutMap::addShortcut(
|
||||||
return addFunctionT( item, sequence, autoRepeat, nullptr, function );
|
return addFunctionT( item, sequence, autoRepeat, nullptr, function );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* >
|
||||||
inline int QskShortcutMap::addShortcut(
|
|
||||||
QQuickItem* item, const QKeySequence& sequence, bool autoRepeat,
|
|
||||||
const QObject* context, T function )
|
|
||||||
{
|
|
||||||
return addFunctionT( item, sequence, autoRepeat,
|
|
||||||
context, QskMetaFunction( function ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
inline int QskShortcutMap::addShortcut(
|
inline int QskShortcutMap::addShortcut(
|
||||||
QQuickWindow* window, const QKeySequence& sequence,
|
QQuickWindow* window, const QKeySequence& sequence,
|
||||||
bool autoRepeat, T function )
|
bool autoRepeat, T function )
|
||||||
|
@ -131,7 +124,23 @@ inline int QskShortcutMap::addShortcut(
|
||||||
return addFunctionT( item, sequence, autoRepeat, nullptr, function );
|
return addFunctionT( item, sequence, autoRepeat, nullptr, function );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* >
|
||||||
|
inline int QskShortcutMap::addShortcut(
|
||||||
|
const QKeySequence& sequence, bool autoRepeat,
|
||||||
|
const QObject* context, T function )
|
||||||
|
{
|
||||||
|
return addFunctionT( nullptr, sequence, autoRepeat, context, function );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* >
|
||||||
|
inline int QskShortcutMap::addShortcut(
|
||||||
|
QQuickItem* item, const QKeySequence& sequence, bool autoRepeat,
|
||||||
|
const QObject* context, T function )
|
||||||
|
{
|
||||||
|
return addFunctionT( item, sequence, autoRepeat, context, function );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* >
|
||||||
inline int QskShortcutMap::addShortcut(
|
inline int QskShortcutMap::addShortcut(
|
||||||
QQuickWindow* window, const QKeySequence& sequence,
|
QQuickWindow* window, const QKeySequence& sequence,
|
||||||
bool autoRepeat, const QObject* context, T function )
|
bool autoRepeat, const QObject* context, T function )
|
||||||
|
@ -140,6 +149,31 @@ inline int QskShortcutMap::addShortcut(
|
||||||
return addFunctionT( item, sequence, autoRepeat, context, function );
|
return addFunctionT( item, sequence, autoRepeat, context, function );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* >
|
||||||
|
inline int QskShortcutMap::addShortcut(
|
||||||
|
const QKeySequence& sequence, bool autoRepeat,
|
||||||
|
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function )
|
||||||
|
{
|
||||||
|
return addFunctionT( nullptr, sequence, autoRepeat, receiver, function );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* >
|
||||||
|
inline int QskShortcutMap::addShortcut(
|
||||||
|
QQuickItem* item, const QKeySequence& sequence, bool autoRepeat,
|
||||||
|
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function )
|
||||||
|
{
|
||||||
|
return addFunctionT( item, sequence, autoRepeat, receiver, function );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* >
|
||||||
|
inline int QskShortcutMap::addShortcut(
|
||||||
|
QQuickWindow* window, const QKeySequence& sequence, bool autoRepeat,
|
||||||
|
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function )
|
||||||
|
{
|
||||||
|
auto item = window ? window->contentItem() : nullptr;
|
||||||
|
return addFunctionT( item, sequence, autoRepeat, receiver, function );
|
||||||
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
inline int QskShortcutMap::addFunctionT(
|
inline int QskShortcutMap::addFunctionT(
|
||||||
QQuickItem* item, const QKeySequence& sequence, bool autoRepeat,
|
QQuickItem* item, const QKeySequence& sequence, bool autoRepeat,
|
||||||
|
|
Loading…
Reference in New Issue