get rid of misleading trackColor property
This commit is contained in:
parent
5a76f719b9
commit
41646d069c
|
@ -50,21 +50,6 @@ bool Slider::pageStepMode() const
|
|||
return d->pageStepMode;
|
||||
}
|
||||
|
||||
void Slider::setTrackColor(const QColor &color)
|
||||
{
|
||||
Q_D(Slider);
|
||||
|
||||
d->trackColor = color;
|
||||
update();
|
||||
}
|
||||
|
||||
QColor Slider::trackColor() const
|
||||
{
|
||||
Q_D(const Slider);
|
||||
|
||||
return d->trackColor;
|
||||
}
|
||||
|
||||
void Slider::setTrackWidth(int width)
|
||||
{
|
||||
Q_D(Slider);
|
||||
|
|
|
@ -10,7 +10,6 @@ class Slider : public QAbstractSlider
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor trackColor WRITE setTrackColor READ trackColor)
|
||||
Q_PROPERTY(int trackWidth WRITE setTrackWidth READ trackWidth)
|
||||
|
||||
public:
|
||||
|
@ -24,19 +23,16 @@ public:
|
|||
void setPageStepMode(bool pageStep);
|
||||
bool pageStepMode() const;
|
||||
|
||||
void setTrackColor(const QColor &color);
|
||||
QColor trackColor() const;
|
||||
|
||||
void setTrackWidth(int width);
|
||||
int trackWidth() const;
|
||||
|
||||
signals:
|
||||
void changedToMinimum(); // @TODO: create custom event
|
||||
void changedFromMinimum();
|
||||
void sliderEnabled();
|
||||
void sliderDisabled();
|
||||
void mouseEnter(); // rename/change
|
||||
void mouseLeave(); // rename/change
|
||||
void changedToMinimum(); // @TODO: create custom event type
|
||||
void changedFromMinimum(); // @TODO: create custom event type
|
||||
void sliderEnabled(); //
|
||||
void sliderDisabled(); //
|
||||
void mouseEnter(); //
|
||||
void mouseLeave(); //
|
||||
|
||||
protected:
|
||||
void sliderChange(SliderChange change) Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -42,7 +42,6 @@ public:
|
|||
int stepTo;
|
||||
int oldValue;
|
||||
int trackWidth;
|
||||
QColor trackColor;
|
||||
};
|
||||
|
||||
SliderPrivate::SliderPrivate(Slider *parent)
|
||||
|
@ -84,22 +83,13 @@ void SliderPrivate::init(Slider *slider)
|
|||
pulseOutState->assignProperty(thumb, "haloSize", 35);
|
||||
pulseInState->assignProperty(thumb, "haloSize", 28);
|
||||
|
||||
QColor disabledColor = style.themeColor("disabled");
|
||||
|
||||
disabledState->assignProperty(thumb, "diameter", 7);
|
||||
disabledState->assignProperty(thumb, "fillColor", disabledColor);
|
||||
disabledState->assignProperty(slider, "trackColor", disabledColor);
|
||||
disabledState->assignProperty(thumb, "fillColor", style.themeColor("disabled"));
|
||||
|
||||
inactiveState->assignProperty(thumb, "diameter", 11);
|
||||
focusState->assignProperty(thumb, "diameter", 11);
|
||||
slidingState->assignProperty(thumb, "diameter", 17);
|
||||
|
||||
QColor trackColor = style.themeColor("accent3");
|
||||
|
||||
inactiveState->assignProperty(slider, "trackColor", trackColor);
|
||||
focusState->assignProperty(slider, "trackColor", trackColor);
|
||||
slidingState->assignProperty(slider, "trackColor", trackColor);
|
||||
|
||||
QColor fillColor = style.themeColor("primary1");
|
||||
|
||||
inactiveState->assignProperty(thumb, "fillColor", fillColor);
|
||||
|
@ -320,18 +310,18 @@ void SliderPrivate::paintTrack(QPainter *painter)
|
|||
{
|
||||
Q_Q(const Slider);
|
||||
|
||||
Style &style = Style::instance();
|
||||
|
||||
painter->save();
|
||||
|
||||
QBrush fg;
|
||||
fg.setStyle(Qt::SolidPattern);
|
||||
fg.setColor(q->isEnabled() ? Style::instance().themeColor("primary1")
|
||||
: trackColor);
|
||||
// @TODO -- clean up this
|
||||
|
||||
fg.setColor(q->isEnabled() ? style.themeColor("primary1")
|
||||
: style.themeColor("disabled"));
|
||||
QBrush bg;
|
||||
bg.setStyle(Qt::SolidPattern);
|
||||
bg.setColor(hover ? QColor(0, 0, 0, 150)
|
||||
: trackColor);
|
||||
bg.setColor(hover ? QColor(0, 0, 0, 150) // @TODO: set theme color
|
||||
: style.themeColor("accent3"));
|
||||
|
||||
qreal offset = q->thumbOffset() + SLIDER_MARGIN;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void SliderThumb::paintEvent(QPaintEvent *event)
|
|||
|
||||
if (_borderWidth > 0) {
|
||||
QPen pen;
|
||||
pen.setColor(slider->trackColor());
|
||||
pen.setColor(Style::instance().themeColor("accent3"));
|
||||
pen.setWidthF(_borderWidth);
|
||||
painter.setPen(pen);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue