Android: Use guard object in some lambda connects

Change-Id: I004d2729d2502a7f2159ea1713cafaabbeb6cc72
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2021-08-24 16:08:52 +02:00
parent ca735829b4
commit 6b417333c8

View File

@@ -308,30 +308,30 @@ SplashScreenContainerWidget::SplashScreenContainerWidget(
imageWidget->setImageFileName(landscapeSplashFileName); imageWidget->setImageFileName(landscapeSplashFileName);
for (auto &&imageWidget : m_imageWidgets) { for (auto &&imageWidget : m_imageWidgets) {
connect(imageWidget, &SplashScreenWidget::imageChanged, [this]() { connect(imageWidget, &SplashScreenWidget::imageChanged, this, [this] {
createSplashscreenThemes(); createSplashscreenThemes();
emit splashScreensModified(); emit splashScreensModified();
}); });
} }
for (auto &&imageWidget : m_portraitImageWidgets) { for (auto &&imageWidget : m_portraitImageWidgets) {
connect(imageWidget, &SplashScreenWidget::imageChanged, [this]() { connect(imageWidget, &SplashScreenWidget::imageChanged, this, [this] {
createSplashscreenThemes(); createSplashscreenThemes();
emit splashScreensModified(); emit splashScreensModified();
}); });
} }
for (auto &&imageWidget : m_landscapeImageWidgets) { for (auto &&imageWidget : m_landscapeImageWidgets) {
connect(imageWidget, &SplashScreenWidget::imageChanged, [this]() { connect(imageWidget, &SplashScreenWidget::imageChanged, this, [this] {
createSplashscreenThemes(); createSplashscreenThemes();
emit splashScreensModified(); emit splashScreensModified();
}); });
} }
connect(m_stickyCheck, &QCheckBox::stateChanged, [this](int state) { connect(m_stickyCheck, &QCheckBox::stateChanged, this, [this](int state) {
bool old = m_splashScreenSticky; bool old = m_splashScreenSticky;
m_splashScreenSticky = (state == Qt::Checked); m_splashScreenSticky = (state == Qt::Checked);
if (old != m_splashScreenSticky) if (old != m_splashScreenSticky)
emit splashScreensModified(); emit splashScreensModified();
}); });
connect(m_backgroundColor, &QToolButton::clicked, [this]() { connect(m_backgroundColor, &QToolButton::clicked, this, [this] {
const QColor color = QColorDialog::getColor(m_splashScreenBackgroundColor, const QColor color = QColorDialog::getColor(m_splashScreenBackgroundColor,
this, this,
tr("Select background color")); tr("Select background color"));
@@ -341,7 +341,7 @@ SplashScreenContainerWidget::SplashScreenContainerWidget(
emit splashScreensModified(); emit splashScreensModified();
} }
}); });
connect(m_masterImage, &QToolButton::clicked, [this] { connect(m_masterImage, &QToolButton::clicked, this, [this] {
const FilePath file = FileUtils::getOpenFilePath(this, tr("Select master image"), const FilePath file = FileUtils::getOpenFilePath(this, tr("Select master image"),
FileUtils::homePath(), fileDialogImageFiles); FileUtils::homePath(), fileDialogImageFiles);
if (!file.isEmpty()) { if (!file.isEmpty()) {
@@ -351,7 +351,7 @@ SplashScreenContainerWidget::SplashScreenContainerWidget(
emit splashScreensModified(); emit splashScreensModified();
} }
}); });
connect(m_portraitMasterImage, &QToolButton::clicked, [this] { connect(m_portraitMasterImage, &QToolButton::clicked, this, [this] {
const FilePath file = FileUtils::getOpenFilePath(this, tr("Select portrait master image"), const FilePath file = FileUtils::getOpenFilePath(this, tr("Select portrait master image"),
FileUtils::homePath(), fileDialogImageFiles); FileUtils::homePath(), fileDialogImageFiles);
if (!file.isEmpty()) { if (!file.isEmpty()) {
@@ -361,7 +361,7 @@ SplashScreenContainerWidget::SplashScreenContainerWidget(
emit splashScreensModified(); emit splashScreensModified();
} }
}); });
connect(m_landscapeMasterImage, &QToolButton::clicked, [this] { connect(m_landscapeMasterImage, &QToolButton::clicked, this, [this] {
const FilePath file = FileUtils::getOpenFilePath(this, tr("Select landscape master image"), const FilePath file = FileUtils::getOpenFilePath(this, tr("Select landscape master image"),
FileUtils::homePath(), fileDialogImageFiles); FileUtils::homePath(), fileDialogImageFiles);
if (!file.isEmpty()) { if (!file.isEmpty()) {
@@ -371,16 +371,16 @@ SplashScreenContainerWidget::SplashScreenContainerWidget(
emit splashScreensModified(); emit splashScreensModified();
} }
}); });
connect(m_imageShowMode, &QComboBox::currentTextChanged, [this](const QString &mode) { connect(m_imageShowMode, &QComboBox::currentTextChanged, this, [this](const QString &mode) {
setImageShowMode(mode); setImageShowMode(mode);
createSplashscreenThemes(); createSplashscreenThemes();
emit splashScreensModified(); emit splashScreensModified();
}); });
connect(clearAllButton, &QToolButton::clicked, [this]() { connect(clearAllButton, &QToolButton::clicked, this, [this] {
clearAll(); clearAll();
emit splashScreensModified(); emit splashScreensModified();
}); });
connect(m_convertSplashscreen, &QToolButton::clicked, [this]() { connect(m_convertSplashscreen, &QToolButton::clicked, this, [this] {
clearAll(); clearAll();
setCurrentIndex(0); setCurrentIndex(0);
emit splashScreensModified(); emit splashScreensModified();