Debugger: Add a way to add perspective windows one-by-one

More convenient in some circumstances.

Change-Id: I413be4bebe9f5a2bbdfa9617ada6242d867eb1a0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
hjk
2018-07-24 11:50:08 +02:00
parent be5c228e5b
commit d41e690c84
2 changed files with 16 additions and 1 deletions

View File

@@ -496,4 +496,14 @@ void Perspective::addOperation(const Operation &operation)
m_operations.append(operation); m_operations.append(operation);
} }
void Perspective::addWindow(QWidget *widget,
Perspective::OperationType op,
bool visibleByDefault,
Qt::DockWidgetArea area)
{
const QByteArray dockId = widget->objectName().toUtf8();
QTC_CHECK(!dockId.isEmpty());
m_operations.append({dockId, widget, {}, op, visibleByDefault, area});
}
} // Utils } // Utils

View File

@@ -70,11 +70,16 @@ public:
Perspective() = default; Perspective() = default;
// Takes ownership of \a centralWidget and all dock widgets in \a operations. // Takes ownership of \a centralWidget and all dock widgets in \a operations.
Perspective(const QString &name, const QVector<Operation> &operations, Perspective(const QString &name,
const QVector<Operation> &operations = {},
QWidget *centralWidget = nullptr); QWidget *centralWidget = nullptr);
~Perspective(); ~Perspective();
void addOperation(const Operation &operation); void addOperation(const Operation &operation);
void addWindow(QWidget *widget,
OperationType op,
bool visibleByDefault = true,
Qt::DockWidgetArea area = Qt::BottomDockWidgetArea);
QVector<Operation> operations() const { return m_operations; } QVector<Operation> operations() const { return m_operations; }
QVector<QByteArray> docks() const { return m_docks; } QVector<QByteArray> docks() const { return m_docks; }