Add View::isNull()

ViewWrappers don't have ownership of the gui element.
The gui element might have been deleted, leaving us with a
stale wrapper

For impl simply use a QPointer in the QtWidgets and QtQuick
backends
This commit is contained in:
Sergio Martins
2022-04-05 21:49:06 +01:00
parent ad3febd87e
commit 43faf85eb4
6 changed files with 29 additions and 4 deletions

View File

@@ -243,7 +243,7 @@ std::shared_ptr<ViewWrapper> ViewWrapper_qtwidgets::parentView() const
HANDLE ViewWrapper_qtwidgets::handle() const
{
return reinterpret_cast<HANDLE>(m_widget);
return reinterpret_cast<HANDLE>(m_widget.data());
}
void ViewWrapper_qtwidgets::grabMouse()
@@ -270,3 +270,8 @@ QString ViewWrapper_qtwidgets::objectName() const
{
return m_widget->QWidget::objectName();
}
bool ViewWrapper_qtwidgets::isNull() const
{
return m_widget.data() == nullptr;
}