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

@@ -14,6 +14,7 @@
#include "ViewWrapper.h"
#include <QWidget>
#include <QPointer>
namespace KDDockWidgets::Views {
@@ -50,9 +51,10 @@ public:
QScreen *screen() const override;
void setFocus(Qt::FocusReason) override;
QString objectName() const override;
bool isNull() const override;
private:
QWidget *const m_widget;
QPointer<QWidget> m_widget;
};
}