const version for qskFindAncestorOf added

This commit is contained in:
Uwe Rathmann 2019-04-18 16:13:05 +02:00
parent 3c8cea78ee
commit d55af92fb6

View File

@ -45,7 +45,7 @@ QSK_EXPORT const QSGNode* qskItemNode( const QQuickItem* );
QSK_EXPORT const QSGNode* qskPaintNode( const QQuickItem* ); QSK_EXPORT const QSGNode* qskPaintNode( const QQuickItem* );
template< typename T > template< typename T >
inline T qskFindAncestorOf( const QQuickItem* item ) inline T qskFindAncestorOf( QQuickItem* item )
{ {
for ( auto it = item; it != nullptr; it = it->parentItem() ) for ( auto it = item; it != nullptr; it = it->parentItem() )
{ {
@ -56,4 +56,11 @@ inline T qskFindAncestorOf( const QQuickItem* item )
return nullptr; return nullptr;
} }
template< typename T >
inline T qskFindAncestorOf( const QQuickItem* item )
{
return qskFindAncestorOf< std::remove_const< T > >(
const_cast< QQuickItem * >( item ) );
}
#endif #endif