forked from qt-creator/qt-creator
Debugger: Move ownership of perspective central widget to plugin
It's only used in GammaRay currently, and with dynamic perspectives lifetime is better managed close to the code that knows how to (re-)construct the beasts. Change-Id: I9e8ebe2e93d749a62fb008f773f1702a4c0bab3c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -463,7 +463,12 @@ Perspective::~Perspective()
|
|||||||
{
|
{
|
||||||
foreach (const Operation &operation, m_operations)
|
foreach (const Operation &operation, m_operations)
|
||||||
delete operation.widget;
|
delete operation.widget;
|
||||||
delete m_centralWidget;
|
}
|
||||||
|
|
||||||
|
void Perspective::setCentralWidget(QWidget *centralWidget)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_centralWidget == nullptr, return);
|
||||||
|
m_centralWidget = centralWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Perspective::name() const
|
QString Perspective::name() const
|
||||||
@@ -523,9 +528,8 @@ Perspective::Operation::Operation(const QByteArray &dockId, QWidget *widget, con
|
|||||||
operationType(splitType), visibleByDefault(visibleByDefault), area(area)
|
operationType(splitType), visibleByDefault(visibleByDefault), area(area)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Perspective::Perspective(const QString &name, const QVector<Operation> &splits,
|
Perspective::Perspective(const QString &name, const QVector<Operation> &splits)
|
||||||
QWidget *centralWidget)
|
: m_name(name), m_operations(splits)
|
||||||
: m_name(name), m_operations(splits), m_centralWidget(centralWidget)
|
|
||||||
{
|
{
|
||||||
for (const Operation &split : splits)
|
for (const Operation &split : splits)
|
||||||
m_docks.append(split.dockId);
|
m_docks.append(split.dockId);
|
||||||
|
@@ -69,12 +69,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Perspective() = default;
|
Perspective() = default;
|
||||||
// Takes ownership of \a centralWidget and all dock widgets in \a operations.
|
// Takes ownership of all dock widgets in \a operations.
|
||||||
Perspective(const QString &name,
|
Perspective(const QString &name,
|
||||||
const QVector<Operation> &operations = {},
|
const QVector<Operation> &operations = {});
|
||||||
QWidget *centralWidget = nullptr);
|
|
||||||
~Perspective();
|
~Perspective();
|
||||||
|
|
||||||
|
void setCentralWidget(QWidget *centralWidget);
|
||||||
void addOperation(const Operation &operation);
|
void addOperation(const Operation &operation);
|
||||||
void addWindow(QWidget *widget,
|
void addWindow(QWidget *widget,
|
||||||
OperationType op,
|
OperationType op,
|
||||||
|
Reference in New Issue
Block a user