AdvancedDockingSystem: Add context objects into connections

Change-Id: I564b9ffe6c7809a6d50a172062c52558f3023fc1
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
Jarek Kobus
2022-11-30 09:01:35 +01:00
parent 4080f31d25
commit d701cd5dbe
3 changed files with 10 additions and 16 deletions

View File

@@ -222,7 +222,7 @@ namespace ADS
floatingWidget = floatingDockContainer = new FloatingDockContainer(m_dockArea);
} else {
auto w = new FloatingDragPreview(m_dockArea);
QObject::connect(w, &FloatingDragPreview::draggingCanceled, [=]() {
QObject::connect(w, &FloatingDragPreview::draggingCanceled, q, [this] {
m_dragState = DraggingInactive;
});
floatingWidget = w;

View File

@@ -74,7 +74,7 @@ WorkspaceNameInputDialog::WorkspaceNameInputDialog(DockManager *manager, QWidget
m_okButton = buttons->button(QDialogButtonBox::Ok);
m_switchToButton = new QPushButton;
buttons->addButton(m_switchToButton, QDialogButtonBox::AcceptRole);
connect(m_switchToButton, &QPushButton::clicked, [this]() { m_usedSwitchTo = true; });
connect(m_switchToButton, &QPushButton::clicked, this, [this] { m_usedSwitchTo = true; });
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);

View File

@@ -60,25 +60,19 @@ WorkspaceView::WorkspaceView(DockManager *manager, QWidget *parent)
m_workspaceModel.index(0, m_workspaceModel.columnCount() - 1));
selectionModel()->select(firstRow, QItemSelectionModel::QItemSelectionModel::SelectCurrent);
connect(this, &Utils::TreeView::activated, [this](const QModelIndex &index) {
connect(this, &Utils::TreeView::activated, this, [this](const QModelIndex &index) {
emit workspaceActivated(m_workspaceModel.workspaceAt(index.row()));
});
connect(selectionModel(), &QItemSelectionModel::selectionChanged, [this] {
connect(selectionModel(), &QItemSelectionModel::selectionChanged, this, [this] {
emit workspacesSelected(selectedWorkspaces());
});
connect(&m_workspaceModel,
&WorkspaceModel::workspaceSwitched,
this,
&WorkspaceView::workspaceSwitched);
connect(&m_workspaceModel,
&WorkspaceModel::modelReset,
this,
&WorkspaceView::selectActiveWorkspace);
connect(&m_workspaceModel,
&WorkspaceModel::workspaceCreated,
this,
&WorkspaceView::selectWorkspace);
connect(&m_workspaceModel, &WorkspaceModel::workspaceSwitched,
this, &WorkspaceView::workspaceSwitched);
connect(&m_workspaceModel, &WorkspaceModel::modelReset,
this, &WorkspaceView::selectActiveWorkspace);
connect(&m_workspaceModel, &WorkspaceModel::workspaceCreated,
this, &WorkspaceView::selectWorkspace);
}
void WorkspaceView::createNewWorkspace()