[VDE] Proper parent lookup syncs group-by box again

This commit is contained in:
Brübach, Lukas 2025-12-05 03:20:35 +01:00
parent 0a239712dd
commit 05f83299d8
2 changed files with 33 additions and 16 deletions

View file

@ -0,0 +1,20 @@
#ifndef COCKATRICE_QT_UTILS_H
#define COCKATRICE_QT_UTILS_H
#include <QObject>
namespace QtUtils
{
template <typename T> T *findParentOfType(const QObject *obj)
{
const QObject *p = obj ? obj->parent() : nullptr;
while (p) {
if (auto casted = qobject_cast<T *>(const_cast<QObject *>(p))) {
return casted;
}
p = p->parent();
}
return nullptr;
}
} // namespace QtUtils
#endif // COCKATRICE_QT_UTILS_H