From bfb8e43c34014b8fc454c3fb8d6a2aa7e5ac9176 Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Tue, 17 Feb 2026 09:05:45 +0100 Subject: [PATCH] Disabling the progress status bar if more biddings are placed than expected. (Easy way to indicate a problem in the GUI). --- .../widgets/biddingroundprogresslayout.cpp | 38 ++++++++++++------- .../widgets/biddingroundprogresslayout.h | 8 ++-- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/UIs/BeetRoundWidgets/widgets/biddingroundprogresslayout.cpp b/UIs/BeetRoundWidgets/widgets/biddingroundprogresslayout.cpp index 7dd7c84..bc971a6 100644 --- a/UIs/BeetRoundWidgets/widgets/biddingroundprogresslayout.cpp +++ b/UIs/BeetRoundWidgets/widgets/biddingroundprogresslayout.cpp @@ -12,33 +12,45 @@ BiddingRoundProgressLayout::BiddingRoundProgressLayout(const int nCurrentBidding QLabel* nBidsText = new QLabel("Abgegeben:"); addWidget(nBidsText); - m_nBiddings1Label = new QLabel(QString::number(m_nCurrentBiddings)); - addWidget(m_nBiddings1Label); + m_nBiddingsLabel = new QLabel(QString::number(m_nCurrentBiddings)); + addWidget(m_nBiddingsLabel); QLabel* nExpectedText = new QLabel("Erwartet:"); addWidget(nExpectedText); - m_nExpectedBidding1Label = new QLabel(QString::number(m_nExpectedBiddings)); - addWidget(m_nExpectedBidding1Label); + m_nExpectedBiddingLabel = new QLabel(QString::number(m_nExpectedBiddings)); + addWidget(m_nExpectedBiddingLabel); - m_biddingRound1ProgressBar = new QProgressBar(parent); - m_biddingRound1ProgressBar->setMinimum(0); - m_biddingRound1ProgressBar->setMaximum(m_nExpectedBiddings); - m_biddingRound1ProgressBar->setValue(m_nCurrentBiddings); + m_biddingRoundProgressBar = new QProgressBar(parent); + m_biddingRoundProgressBar->setMinimum(0); + m_biddingRoundProgressBar->setMaximum(m_nExpectedBiddings); + m_biddingRoundProgressBar->setValue(m_nCurrentBiddings); - addWidget(m_biddingRound1ProgressBar); + addWidget(m_biddingRoundProgressBar); + + updateEnabledStatus(); } void BiddingRoundProgressLayout::setCurrentBiddings(const int value) { m_nCurrentBiddings = value; const QString bidCountString = QString::number(value); - m_nBiddings1Label->setText(bidCountString); - m_biddingRound1ProgressBar->setValue(value); + m_nBiddingsLabel->setText(bidCountString); + m_biddingRoundProgressBar->setValue(value); + updateEnabledStatus(); } void BiddingRoundProgressLayout::setExpectedBiddings(const int value) { m_nExpectedBiddings = value; const QString expectedBiddingsString = QString::number(value); - m_nExpectedBidding1Label->setText(expectedBiddingsString); - m_biddingRound1ProgressBar->setMaximum(value); + m_nExpectedBiddingLabel->setText(expectedBiddingsString); + m_biddingRoundProgressBar->setMaximum(value); + updateEnabledStatus(); +} + +void BiddingRoundProgressLayout::updateEnabledStatus() { + if (m_nCurrentBiddings > m_nExpectedBiddings) { + m_biddingRoundProgressBar->setEnabled(false); + } else { + m_biddingRoundProgressBar->setEnabled(true); + } } diff --git a/UIs/BeetRoundWidgets/widgets/biddingroundprogresslayout.h b/UIs/BeetRoundWidgets/widgets/biddingroundprogresslayout.h index a25e18d..ecb8456 100644 --- a/UIs/BeetRoundWidgets/widgets/biddingroundprogresslayout.h +++ b/UIs/BeetRoundWidgets/widgets/biddingroundprogresslayout.h @@ -20,9 +20,11 @@ class BiddingRoundProgressLayout : public QHBoxLayout { int m_nCurrentBiddings; int m_nExpectedBiddings; - QLabel* m_nBiddings1Label = nullptr; - QLabel* m_nExpectedBidding1Label = nullptr; - QProgressBar* m_biddingRound1ProgressBar = nullptr; + QLabel* m_nBiddingsLabel = nullptr; + QLabel* m_nExpectedBiddingLabel = nullptr; + QProgressBar* m_biddingRoundProgressBar = nullptr; + + void updateEnabledStatus(); }; #endif // BIDDINGROUNDPROGRESSLAYOUT_H