Tests: Add context object into connections

Change-Id: I4bb05e5890b9b415085f17d6358d9066e3112d6d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2023-08-01 20:35:59 +02:00
parent 5245cad811
commit 47fce17aa3
3 changed files with 5 additions and 6 deletions

View File

@@ -55,15 +55,14 @@ void tst_TimelineZoomControl::window()
QTimer timer;
timer.setSingleShot(true);
connect(&timer, &QTimer::timeout, [&] {
connect(&timer, &QTimer::timeout, this, [&zoomControl] {
QVERIFY(zoomControl.windowLocked());
zoomControl.setWindowLocked(false);
});
int numWindowChanges = 0;
connect(&zoomControl, &TimelineZoomControl::windowChanged,
[&](qint64, qint64) {
connect(&zoomControl, &TimelineZoomControl::windowChanged, this, [&](qint64, qint64) {
verifyWindow(zoomControl);
QVERIFY(!timer.isActive());
@@ -100,7 +99,7 @@ void tst_TimelineZoomControl::window()
zoomControl.setRange(152000, 152005); // move right
QMetaObject::Connection connection = connect(
&zoomControl, &TimelineZoomControl::windowMovingChanged, [&](bool moving) {
&zoomControl, &TimelineZoomControl::windowMovingChanged, this, [&](bool moving) {
if (moving)
return;

View File

@@ -45,7 +45,7 @@ ThemeSelector::ThemeSelector(QWidget *parent)
setCurrentText(appSettings.value(themeNameKey, "Flat Dark").toString());
setTheme(currentData().toString());
connect(this, &QComboBox::currentTextChanged, [this]{
connect(this, &QComboBox::currentTextChanged, this, [this] {
setTheme(currentData().toString());
QSettings appSettings;
appSettings.setValue(themeNameKey, currentText());

View File

@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
auto withLink = new Utils::InfoLabel("With <a href=\"link clicked!\">link</a>", InfoLabel::Error);
withLink->setElideMode(Qt::ElideNone);
QObject::connect(withLink, &QLabel::linkActivated, [widget](const QString& link){
QObject::connect(withLink, &QLabel::linkActivated, &app, [widget](const QString& link) {
QMessageBox::information(widget, {}, link);
});
mainLayout->addWidget(withLink);