Fixed slider painting, part I

This commit is contained in:
2026-03-29 16:35:58 +02:00
parent 2192910e8e
commit c8a088173f
4 changed files with 15 additions and 212 deletions

View File

@@ -101,49 +101,22 @@ QRect BCValueSlider::updateEditorRect( const QRect& rect)
void BCValueSlider::paintSliderIndicator(QPainter* painter, const QRect& rect, double ratio )
{
return;
// Kleinen Slider-Indikator zeichnen
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
int adjX = rect.width() - 130; //cTextBlockOffset;
// Mini Progress Bar: der Gesamtbereich
QRect barRect = rect.adjusted( adjX, 12, -10-24, -12 );
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xE0E0E0));
painter->drawRoundedRect(barRect, 2, 2);
qDebug() << " --- doPaint: in paintSliderIndicator1: " << rect;
qDebug() << " --- doPaint: in paintSliderIndicator2: " << barRect;
// Mini Progress Bar: der Wertebereich
barRect.setWidth( ratio * barRect.width() );
painter->setBrush(QColor(0x0078D4));
painter->drawRoundedRect(barRect, 2, 2);
painter->restore();
}
void BCValueSlider::paintSliderIndicator2(QPainter* painter, const QRect& rect, double ratio )
{
// Kleinen Slider-Indikator zeichnen
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
qDebug() << " --- doPaint: in paintSliderIndicator: " <<rect;
QRect barRect = rect.adjusted( 0, 5, 0, -5 );
/*
// Mini Progress Bar: der Gesamtbereich
//QRect barRect = rect.adjusted( 0, 12, -10-24, -12 );
QRect barRect = rect;//.adjusted( 0, 12, 0, -12 );
QRect barRect2 = rect;//.adjusted( 0, 12, 0, -12 );
const int third = rect.height() / 3;
barRect.setY( rect.y() + third);
barRect.setHeight( third );
qDebug() << " --- doPaint: " << third << " rect:" << rect << " adj: " << barRect << " 2:" << barRect2;
// Mini Progress Bar: der Gesamtbereich
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xE0E0E0));
painter->drawRoundedRect(barRect, 2, 2);
@@ -152,14 +125,10 @@ void BCValueSlider::paintSliderIndicator2(QPainter* painter, const QRect& rect,
barRect.setWidth( ratio * barRect.width() );
painter->setBrush(QColor(0x0078D4));
painter->drawRoundedRect(barRect, 2, 2);
*/
BCValueSlider::updateEditorRect( rect );
painter->setBrush(Qt::gray);
painter->drawRoundedRect(rect, 2, 2);
painter->setBrush(Qt::blue);
painter->drawRoundedRect(barRect, 2, 2);
//painter->setPen(Qt::red);
//painter->setBrush(Qt::blue);
//painter->drawRoundedRect(barRect, 2, 2);
painter->restore();
}
@@ -250,7 +219,7 @@ void BCValueSlider::BCValueSliderStyle::drawHorizontalFluentSlider(QPainter* pai
handleRect.setY( handleRect.y() + 2 );
qDebug() << " --- doPaint: drawHorizontalFluentSlider" << groove << " Handle: " << handleRect;
paintSliderIndicator2(painter, groove, 0.5 );
paintSliderIndicator(painter, groove, 0.5 );
painter->setBrush(Qt::red);
painter->drawRect(handleRect);