diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index e2884bf..6b47a3c 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -341,7 +341,7 @@ struct MainWindowPrivate DockWidget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContent); auto ToolBar = DockWidget->createDefaultToolBar(); auto Action = ToolBar->addAction(svgIcon(":/adsdemo/images/fullscreen.svg"), "Toggle Fullscreen"); - QObject::connect(Action, &QAction::triggered, [=]() + QObject::connect(Action, &QAction::triggered, DockWidget, [=]() { if (DockWidget->isFullScreen()) { @@ -419,7 +419,7 @@ void MainWindowPrivate::createContent() auto DockArea = DockManager->addDockWidget(ads::CenterDockWidgetArea, DockWidget, TopDockArea); // Now we create a action to test resizing of DockArea widget auto Action = ui.menuTests->addAction(QString("Resize %1").arg(DockWidget->windowTitle())); - QObject::connect(Action, &QAction::triggered, [DockArea]() + QObject::connect(Action, &QAction::triggered, DockArea, [DockArea]() { // Resizing only works, if the Splitter is visible and has a valid // sizes @@ -445,7 +445,7 @@ void MainWindowPrivate::createContent() auto TitleBar = DockArea->titleBar(); int Index = TitleBar->indexOf(TitleBar->tabBar()); TitleBar->insertWidget(Index + 1, CustomButton); - QObject::connect(CustomButton, &QToolButton::clicked, [=]() + QObject::connect(CustomButton, &QToolButton::clicked, DockArea, [=]() { auto DockWidget = createEditorWidget(); DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true); @@ -464,7 +464,7 @@ void MainWindowPrivate::createContent() // Tests CustomCloseHandling without DeleteOnClose LabelDockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true); - QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, [LabelDockWidget, this]() + QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, LabelDockWidget, [LabelDockWidget, this]() { int Result = QMessageBox::question(_this, "Custom Close Request", "Do you really want to close this dock widget?"); diff --git a/examples/deleteonclose/main.cpp b/examples/deleteonclose/main.cpp index 25f8ed1..25fb833 100644 --- a/examples/deleteonclose/main.cpp +++ b/examples/deleteonclose/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton, true); auto dockManager = new ads::CDockManager(&w); w.setDockManager(dockManager); - QObject::connect(dockManager, &ads::CDockManager::focusedDockWidgetChanged, [] (ads::CDockWidget* old, ads::CDockWidget* now) { + QObject::connect(dockManager, &ads::CDockManager::focusedDockWidgetChanged, [](ads::CDockWidget* old, ads::CDockWidget* now) { static int Count = 0; qDebug() << Count++ << " CDockManager::focusedDockWidgetChanged old: " << (old ? old->objectName() : "-") << " now: " << now->objectName() << " visible: " << now->isVisible(); now->widget()->setFocus(); @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) action = new QAction("Toggle [DeleteContentOnClose]", &w); w.menuBar()->addAction(action); - QObject::connect(action, &QAction::triggered, [dw]() { + QObject::connect(action, &QAction::triggered, dw, [dw]() { dw->toggleView(dw->isClosed()); qDebug() << QString("dock widget %1! contents widget %2!").arg(dw->isClosed() ? "closed" : "open", dw->widget() ? "created" : "deleted"); });