qskAncestorOf -> qskFindAncestorOf

This commit is contained in:
Uwe Rathmann 2019-03-16 16:11:27 +01:00
parent 319ad18fd6
commit 53f3dc519d
1 changed files with 3 additions and 3 deletions

View File

@ -44,12 +44,12 @@ QSK_EXPORT void qskInputMethodSetVisible( const QQuickItem*, bool );
QSK_EXPORT const QSGNode* qskItemNode( const QQuickItem* ); QSK_EXPORT const QSGNode* qskItemNode( const QQuickItem* );
QSK_EXPORT const QSGNode* qskPaintNode( const QQuickItem* ); QSK_EXPORT const QSGNode* qskPaintNode( const QQuickItem* );
template< typename Item > template< typename T >
inline Item qskAncestorOf( const QQuickItem* item ) inline T qskFindAncestorOf( const QQuickItem* item )
{ {
for ( auto it = item; it != nullptr; it = it->parentItem() ) for ( auto it = item; it != nullptr; it = it->parentItem() )
{ {
if ( auto ancestor = qobject_cast< Item >( it ) ) if ( auto ancestor = qobject_cast< T >( it ) )
return ancestor; return ancestor;
} }