diff --git a/examples/Examples.cpp b/examples/Examples.cpp index 51136a8..7b9c0c8 100644 --- a/examples/Examples.cpp +++ b/examples/Examples.cpp @@ -112,20 +112,9 @@ QGroupBox* Examples::createProgressBarInfinite() QGroupBox* Examples::createProgressBarCounter() { progressCounterTimer_.setInterval(TIME_INTERVAL); - QObject::connect( - &progressCounterTimer_, &QTimer::timeout, &progressBarCounter_, - [&progress = progress_, &bar = progressBarCounter_, - &startStop = startStopButtonCounter_, &timer = progressCounterTimer_]() - { - bar.updateProgress(progress); - ++progress; - if (progress > MAX_PROGRESS_BAR_VALUE) - { - timer.stop(); - progress = 0; - startStop.click(); - } - }); + QObject::connect(&progressCounterTimer_, &QTimer::timeout, this, + &Examples::counterTimerEvent); + QObject::connect(&startStopButtonCounter_, &QPushButton::clicked, this, &Examples::counterButtonClicked); @@ -215,3 +204,15 @@ void Examples::counterButtonClicked() startStopButtonCounter_.setText(QStringLiteral("stop")); } } + +void Examples::counterTimerEvent() +{ + progressBarCounter_.updateProgress(progress_); + ++progress_; + if (progress_ > MAX_PROGRESS_BAR_VALUE) + { + progress_ = 0; + progressCounterTimer_.stop(); + startStopButtonCounter_.click(); + } +} diff --git a/examples/Examples.h b/examples/Examples.h index 25d1921..c542b29 100644 --- a/examples/Examples.h +++ b/examples/Examples.h @@ -82,4 +82,6 @@ private slots: void infiniteButtonClicked(); void counterButtonClicked(); + + void counterTimerEvent(); };