Fixed slider painting, part II, before slider widget rewrite
This commit is contained in:
@@ -42,7 +42,7 @@ BCValueSlider::BCValueSlider( QWidget *parent )
|
||||
|
||||
// wir wollen ja modern sein
|
||||
_sliderStyle = std::make_unique<BCValueSliderStyle>();
|
||||
_slider->setStyle(_sliderStyle.get());
|
||||
//_slider->setStyle(_sliderStyle.get());
|
||||
setAutoFillBackground(true);
|
||||
|
||||
QSizePolicy sp = _commitButton->sizePolicy();
|
||||
@@ -83,13 +83,13 @@ void BCValueSlider::setValueAndRange( const BCValue::ValueRange& params )
|
||||
}
|
||||
|
||||
|
||||
QRect BCValueSlider::updateEditorRect( const QRect& rect)
|
||||
QRect BCValueSlider::clipToSliderRect( const QRect& rect)
|
||||
{
|
||||
return rect.adjusted
|
||||
(
|
||||
rect.width() - cTextBlockOffset, // Von rechts: cTextBlockOffset (==130) px (Breite der Progress Bar)
|
||||
0, // Oben: kein Offset
|
||||
-cPaddingRight, // Rechts: 8px Padding
|
||||
-(cPaddingRight +24 ), // Rechts: 8px Padding
|
||||
0 // Unten: kein Offset
|
||||
);
|
||||
}
|
||||
@@ -105,17 +105,13 @@ void BCValueSlider::paintSliderIndicator(QPainter* painter, const QRect& rect, d
|
||||
painter->save();
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
|
||||
QRect barRect = rect;//.adjusted( 0, 12, 0, -12 );
|
||||
QRect barRect2 = rect;//.adjusted( 0, 12, 0, -12 );
|
||||
QRect barRect = rect;
|
||||
|
||||
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));
|
||||
@@ -126,10 +122,6 @@ void BCValueSlider::paintSliderIndicator(QPainter* painter, const QRect& rect, d
|
||||
painter->setBrush(QColor(0x0078D4));
|
||||
painter->drawRoundedRect(barRect, 2, 2);
|
||||
|
||||
//painter->setPen(Qt::red);
|
||||
//painter->setBrush(Qt::blue);
|
||||
//painter->drawRoundedRect(barRect, 2, 2);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
@@ -168,7 +160,8 @@ int BCValueSlider::BCValueSliderStyle::pixelMetric(PixelMetric metric, const QSt
|
||||
|
||||
QRect BCValueSlider::BCValueSliderStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex* opt,SubControl sc, const QWidget* widget) const
|
||||
{
|
||||
if (cc == CC_Slider) {
|
||||
if (cc == CC_Slider)
|
||||
{
|
||||
if (const QStyleOptionSlider* slider = qstyleoption_cast<const QStyleOptionSlider*>(opt))
|
||||
{
|
||||
QRect rect = slider->rect;
|
||||
@@ -214,13 +207,17 @@ void BCValueSlider::BCValueSliderStyle::drawHorizontalFluentSlider(QPainter* pai
|
||||
QRect groove = slider->rect;
|
||||
|
||||
|
||||
|
||||
paintSliderIndicator(painter, groove, 0.5 );
|
||||
|
||||
painter->setBrush(Qt::red);
|
||||
QRect handleRect = subControlRect(CC_Slider, slider, SC_SliderHandle, nullptr);
|
||||
// Das 'subControlRect' für den SC_SliderHandle ist _nicht_ mittig
|
||||
|
||||
handleRect.setY( handleRect.y() + 2 );
|
||||
|
||||
qDebug() << " --- doPaint: drawHorizontalFluentSlider" << groove << " Handle: " << handleRect;
|
||||
paintSliderIndicator(painter, groove, 0.5 );
|
||||
painter->setBrush(Qt::red);
|
||||
qDebug() << " --- drawHorizontalFluentSlider" << groove << " Handle: " << handleRect;
|
||||
|
||||
painter->drawRect(handleRect);
|
||||
|
||||
return;
|
||||
@@ -250,8 +247,6 @@ void BCValueSlider::BCValueSliderStyle::drawHorizontalFluentSlider(QPainter* pai
|
||||
painter->setPen(QPen(activeColor, 2));
|
||||
painter->drawEllipse(thumbRect);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// Inner circle for pressed state
|
||||
if (slider->state & State_Sunken)
|
||||
|
||||
Reference in New Issue
Block a user