View CTOR no longer receives "thisQObject" via argument

It's unused, views don't need to be QObject based anymore
This commit is contained in:
Sergio Martins
2022-07-10 22:44:54 +01:00
parent 8e7e68eddc
commit 92b49f78a9
5 changed files with 11 additions and 13 deletions

View File

@@ -33,10 +33,9 @@ namespace KDDockWidgets {
static qint64 s_nextId = 1;
}
View::View(Controller *controller, Type type, QObject *thisObj)
View::View(Controller *controller, Type type)
: d(new Private())
, m_controller(controller)
, m_thisObj(thisObj)
, m_id(QString::number(KDDockWidgets::s_nextId++))
, m_type(type)
{
@@ -330,11 +329,6 @@ QScreen *View::screen() const
return nullptr;
}
HANDLE View::handle() const
{
return m_thisObj;
}
void View::setAboutToBeDestroyed()
{
m_aboutToBeDestroyed = true;

View File

@@ -17,7 +17,6 @@
#include <QSize> // TODOm4 Remove Qt headers, introduce Size and Rect structs
#include <QRect>
#include <QObject>
#include <memory>
@@ -58,7 +57,7 @@ using WId = quintptr;
class DOCKS_EXPORT View
{
public:
explicit View(Controller *controller, Type, QObject *thisObj);
explicit View(Controller *controller, Type);
virtual ~View();
virtual void init() {};
@@ -67,7 +66,7 @@ public:
/// This value only makes sense to the frontend. For example, for QtQuick it might be a
/// QQuickItem, while for QtWidgets it's a QWidget *. Can be whatever the frontend developer wants,
/// as long as it uniquely identifies the GUI element. KDDW backend only uses it for comparison purposes
HANDLE handle() const;
virtual HANDLE handle() const = 0;
/// @brief Returns whether the gui item represented by this view was already deleted
/// Usually false, as KDDW internal gui elements inherit View, and nobody will access them after destruction.
@@ -292,7 +291,6 @@ protected:
free_impl();
Controller *const m_controller;
QObject *const m_thisObj;
bool m_inDtor = false;
private:

View File

@@ -21,7 +21,7 @@ using namespace KDDockWidgets::Views;
View_dummy::View_dummy(KDDockWidgets::Controller *controller, Type type,
void * /*parent*/, Qt::WindowFlags) // replace void with your type
: View(controller, type, nullptr) // TODO pass parent
: View(controller, type)
{
}

View File

@@ -84,7 +84,7 @@ public:
};
View_qt::View_qt(Controller *controller, Type type, QObject *thisObj)
: View(controller, type, thisObj)
: View(controller, type)
, m_eventFilter(thisObj ? new EventFilter(this, thisObj) : nullptr)
, m_thisObj(thisObj)
{
@@ -102,6 +102,11 @@ QObject *View_qt::thisObject() const
return m_thisObj;
}
KDDockWidgets::HANDLE View_qt::handle() const
{
return m_thisObj;
}
void View_qt::setObjectName(const QString &name)
{
if (m_thisObj) {

View File

@@ -33,6 +33,7 @@ public:
QObject *thisObject() const;
HANDLE handle() const override;
void setObjectName(const QString &name) override;
static QObject *asQObject(View *);