qskAncestor added
This commit is contained in:
parent
4c3a171c46
commit
d99844843b
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "QskGlobal.h"
|
#include "QskGlobal.h"
|
||||||
#include <qnamespace.h>
|
#include <qnamespace.h>
|
||||||
|
#include <qquickitem.h>
|
||||||
|
|
||||||
class QQuickItem;
|
class QQuickItem;
|
||||||
class QSGNode;
|
class QSGNode;
|
||||||
@ -43,4 +44,16 @@ 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 >
|
||||||
|
inline Item qskAncestorOf( const QQuickItem* item )
|
||||||
|
{
|
||||||
|
for ( auto it = item; it != nullptr; it = it->parentItem() )
|
||||||
|
{
|
||||||
|
if ( auto ancestor = qobject_cast< Item >( it ) )
|
||||||
|
return ancestor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user