From a57b45e21a29d7b28130427f10b49c68d88c45e7 Mon Sep 17 00:00:00 2001 From: "PANIK\\chris" Date: Tue, 6 Jan 2026 16:21:59 +0100 Subject: [PATCH] Fixed dummy progress bar. --- bcanimateddelegate.cpp | 71 ++++++++++++++++++++++++------------------ bcmainwindow.cpp | 14 ++++++--- bctransmitter.cpp | 2 +- bcvaluemodel.cpp | 3 +- 4 files changed, 53 insertions(+), 37 deletions(-) diff --git a/bcanimateddelegate.cpp b/bcanimateddelegate.cpp index 824ba4c..d04e83d 100644 --- a/bcanimateddelegate.cpp +++ b/bcanimateddelegate.cpp @@ -230,44 +230,53 @@ void BCAnimatedDelegate::paintSliderIndicator(QPainter* painter, const QStyleOpt { const BCValue& valueX = *(_valueList[ index.row()].get()); - int value = index.model()->data(index, Qt::DisplayRole).toInt(); + int value = 50;index.model()->data(index, Qt::DisplayRole).toInt(); - // Hintergrund - if (option.state & QStyle::State_Selected) { - painter->fillRect(option.rect, option.palette.highlight()); - } else if (index.row() % 2 == 1) { - painter->fillRect(option.rect, QColor(0xFAFAFA)); - } else { - painter->fillRect(option.rect, Qt::white); - } + // Hintergrund + if (option.state & QStyle::State_Selected) + { + painter->fillRect(option.rect, option.palette.highlight()); + } + else if (index.row() % 2 == 1) + { + painter->fillRect(option.rect, QColor(0xFAFAFA)); + } + else + { + painter->fillRect(option.rect, Qt::white); + } - // Text und kleiner Slider-Indikator zeichnen - painter->save(); - painter->setRenderHint(QPainter::Antialiasing); + // Text und kleiner Slider-Indikator zeichnen + painter->save(); + painter->setRenderHint(QPainter::Antialiasing); - QRect textRect = option.rect.adjusted(8, 0, -120, 0); - QRect barRect = option.rect.adjusted(option.rect.width() - 115, - option.rect.height() / 2 - 2, - -8, - -option.rect.height() / 2 + 2); + //QRect textRect = option.rect.adjusted(8, 0, -120, 0); - // Text - painter->setPen(option.state & QStyle::State_Selected ? - option.palette.highlightedText().color() : Qt::black); - painter->drawText(textRect, Qt::AlignVCenter | Qt::AlignLeft, - QString::number(value)); + QRect barRect = option.rect.adjusted + ( + 8, + option.rect.height() / 2 - 2, + -8, + -option.rect.height() / 2 + 2 + ); - // Mini Progress Bar - painter->setPen(Qt::NoPen); - painter->setBrush(QColor(0xE0E0E0)); - painter->drawRoundedRect(barRect, 2, 2); + //QRect barRect = option.rect; + // Text + //painter->setPen(option.state & QStyle::State_Selected ? option.palette.highlightedText().color() : Qt::black); + //painter->drawText(textRect, Qt::AlignVCenter | Qt::AlignLeft, + // QString::number(value)); - QRect fillRect = barRect; - fillRect.setWidth(barRect.width() * value / 100); - painter->setBrush(QColor(0x0078D4)); - painter->drawRoundedRect(fillRect, 2, 2); + // Mini Progress Bar + painter->setPen(Qt::NoPen); + painter->setBrush(QColor(0xE0E0E0)); + painter->drawRoundedRect(barRect, 2, 2); - painter->restore(); + QRect fillRect = barRect; + fillRect.setWidth(barRect.width() * value / 100); + painter->setBrush(QColor(0x0078D4)); + painter->drawRoundedRect(fillRect, 2, 2); + + painter->restore(); } diff --git a/bcmainwindow.cpp b/bcmainwindow.cpp index 1730fc1..4e551d4 100644 --- a/bcmainwindow.cpp +++ b/bcmainwindow.cpp @@ -157,10 +157,16 @@ void BCMainWindow::initMainWindow() // die Daten des eBikes laden _dataManager.loadXmlBikeData(":/bikeinfo.xml"_L1); - //_consoleAction->trigger(); - _batteryAction->trigger(); + _consoleAction->trigger(); + //_batteryAction->trigger(); -} + // Dummy sync beim starten + + QTimer::singleShot(1000, this, [this]() + { + onSyncDeviceView(); + }); + } /* // 2. Bild für den Zustand UNCHECKED (Off) hinzufügen @@ -199,7 +205,7 @@ void BCMainWindow::initStatusBar() statBar->showMessage("Ready"); setApplicationStyleSheet(":bionxcontrol.qss"_L1); - //setApplicationStyleSheet(":alt.qss"_L1); + } /* diff --git a/bctransmitter.cpp b/bctransmitter.cpp index d8d83b9..a17ed4c 100644 --- a/bctransmitter.cpp +++ b/bctransmitter.cpp @@ -183,7 +183,7 @@ void BCTransmitter::onUpdateValue( BCValuePtrConst valuePtr) // __fix //bc::processEventsFor(150); - bc::delay_millis(150); + bc::delay_millis(50); } diff --git a/bcvaluemodel.cpp b/bcvaluemodel.cpp index 5afcc59..2d9b78e 100644 --- a/bcvaluemodel.cpp +++ b/bcvaluemodel.cpp @@ -191,7 +191,8 @@ Das Model Gibt hier, unabhängig von der DataRole, immer das Qt::ItemFlags BCValueModel::flags(const QModelIndex& index) const { - if (!index.isValid()) + // die label spalte lässt sich nicht editieren + if (!index.isValid() || index.column() == 0 ) return Qt::NoItemFlags; return QAbstractTableModel::flags(index) | Qt::ItemIsEditable;