Created new painter bug.

This commit is contained in:
2026-01-22 22:16:19 +01:00
parent ab4abd214e
commit 37fcc5e888
8 changed files with 110 additions and 150 deletions

View File

@@ -31,6 +31,8 @@
#include <bcsliderstyle.h>
#include <bcvalueeditor.h>
BCSliderStyle::BCSliderStyle()
: QProxyStyle()
@@ -71,9 +73,11 @@ QRect BCSliderStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
QRect rect = slider->rect;
int handleSize = 16;
if (sc == SC_SliderHandle) {
if (sc == SC_SliderHandle)
{
// Handle Position korrekt berechnen
if (slider->orientation == Qt::Horizontal) {
if (slider->orientation == Qt::Horizontal)
{
int range = slider->maximum - slider->minimum;
int pos = slider->sliderPosition - slider->minimum;
int pixelRange = rect.width() - handleSize;
@@ -82,7 +86,9 @@ QRect BCSliderStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
return QRect(rect.x() + pixelPos,
rect.center().y() - handleSize / 2,
handleSize, handleSize);
} else {
}
else
{
int range = slider->maximum - slider->minimum;
int pos = slider->sliderPosition - slider->minimum;
int pixelRange = rect.height() - handleSize;
@@ -125,7 +131,13 @@ void BCSliderStyle::drawHorizontalFluentSlider(QPainter* painter, const QStyleOp
const QColor& bgColor) const
{
QRect groove = slider->rect;
QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, nullptr);
qDebug() << " ---WTF: " << groove;
BCValueEditor::paintSliderIndicator(painter, groove, 0.5 );
/*
int grooveHeight = 4;
// Track sollte im Widget-Zentrum sein, nicht im groove-Zentrum
int grooveY = groove.center().y() - grooveHeight / 2;
@@ -143,6 +155,10 @@ void BCSliderStyle::drawHorizontalFluentSlider(QPainter* painter, const QStyleOp
QRect activeTrack(groove.left(), grooveY, activeWidth, grooveHeight);
painter->setBrush(activeColor);
painter->drawRoundedRect(activeTrack, grooveHeight / 2, grooveHeight / 2);
*/
// Handle (Thumb) - Fluent style is more subtle
int handleSize = 16;
@@ -160,6 +176,8 @@ void BCSliderStyle::drawHorizontalFluentSlider(QPainter* painter, const QStyleOp
handle.center().y() - glowSize / 2,
glowSize, glowSize);
painter->drawEllipse(glow);
}
// Thumb
@@ -179,25 +197,3 @@ void BCSliderStyle::drawHorizontalFluentSlider(QPainter* painter, const QStyleOp
}
}
void BCSliderStyle::drawSliderIndicator( QPainter* painter, QRect& groove )
{
/*
int grooveHeight = 4;
// Track sollte im Widget-Zentrum sein, nicht im groove-Zentrum
int grooveY = groove.center().y() - grooveHeight / 2;
// Full background track
QRect fullTrack(groove.left(), grooveY, groove.width(), grooveHeight);
painter->setPen(Qt::NoPen);
painter->setBrush(inactiveColor.lighter(150));
painter->drawRoundedRect(fullTrack, grooveHeight / 2, grooveHeight / 2);
QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, nullptr);
// Active track (filled portion)
int activeWidth = handle.center().x() - groove.left();
QRect activeTrack(groove.left(), grooveY, activeWidth, grooveHeight);
painter->setBrush(activeColor);
painter->drawRoundedRect(activeTrack, grooveHeight / 2, grooveHeight / 2);
*/
}