AdvancedDockingSystem: Add context objects into connections

(cherry picked from commit d701cd5dbe)
Change-Id: I564b9ffe6c7809a6d50a172062c52558f3023fc1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Jarek Kobus
2022-11-30 09:01:35 +01:00
committed by Tim Jenssen
parent 8a7b1d7a00
commit 216f3dd243
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

@@ -71,7 +71,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);
hlayout->addWidget(buttons);

View File

@@ -68,25 +68,19 @@ WorkspaceView::WorkspaceView(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()