Add Platform::qobjectAsView()

to be removed once we port away from Qt, but needed for now to
support QtQuick
This commit is contained in:
Sergio Martins
2022-04-07 23:10:01 +01:00
parent 59f9824cc2
commit 4944ad5882
6 changed files with 24 additions and 6 deletions

View File

@@ -63,10 +63,15 @@ bool Platform_qtwidgets::hasActivePopup() const
std::shared_ptr<ViewWrapper> Platform_qtwidgets::focusedView() const
{
if (auto w = qobject_cast<QWidget *>(qApp->focusObject())) {
return qobjectAsView(qApp->focusObject());
}
std::shared_ptr<ViewWrapper> Platform_qtwidgets::qobjectAsView(QObject *obj) const
{
if (auto w = qobject_cast<QWidget *>(obj)) {
ViewWrapper *wrapper = new Views::ViewWrapper_qtwidgets(w);
return std::shared_ptr<ViewWrapper>(wrapper);
}
return {};
return nullptr;
}