diff --git a/examples/Examples.cpp b/examples/Examples.cpp index cc48f9e..90615db 100644 --- a/examples/Examples.cpp +++ b/examples/Examples.cpp @@ -102,18 +102,9 @@ QGroupBox* Examples::wrapProgressBar(const QString& name, QGroupBox* Examples::createProgressBarInfinite() { - QObject::connect( - &startStopButtonInfinite_, &QPushButton::clicked, &progressBarInfinite_, - [&bar = progressBarInfinite_, &startStop = startStopButtonInfinite_]() - { - const bool running{bar.isRunning()}; - if (running) - bar.stop(); - else - bar.start(); - startStop.setText( - (running ? QStringLiteral("start") : QStringLiteral("stop"))); - }); + QObject::connect(&startStopButtonInfinite_, &QPushButton::clicked, this, + &Examples::infiniteButtonClicked); + return wrapProgressBar(QStringLiteral("Infinite progress bar"), &progressBarInfinite_, &startStopButtonInfinite_); } @@ -208,3 +199,18 @@ void Examples::filterStringsValuesChanged(QStringList bannedItems) { info_.setText("Names Filter: " + bannedItems.join(',')); } + +void Examples::infiniteButtonClicked() +{ + const bool running{progressBarInfinite_.isRunning()}; + if (running) + { + progressBarInfinite_.stop(); + startStopButtonInfinite_.setText(QStringLiteral("start")); + } + else + { + progressBarInfinite_.start(); + startStopButtonInfinite_.setText(QStringLiteral("stop")); + } +} diff --git a/examples/Examples.h b/examples/Examples.h index 9c342ee..6fa6b72 100644 --- a/examples/Examples.h +++ b/examples/Examples.h @@ -78,4 +78,6 @@ private slots: void filterDatesValuesChanged(QDate from, QDate to, bool filterEmptyDates); void filterStringsValuesChanged(QStringList bannedItems); + + void infiniteButtonClicked(); };