92 QSlider::paintEvent(e);
93 double w = this->width() - 30;
94 int totValues = this->maximum() + abs(this->minimum());
99 double newX = ((double)w / (
double)totValues) * (
target*
sliderStep + abs(this->minimum()));
100 QRect r(newX, 17, 30, 15);
101 p.fillRect(r, QBrush(QColor(128, 128, 255, 128)));
106 double value = this->value();
107 double newX = ((double)w / (
double)totValues) * ((
double)value + abs(this->minimum()));
113 if (newX<0) newX = 0;
114 if (newX>w-30) newX = w-30;
119 double newX = ((double)w / (
double)totValues) * ((
double)
target + abs(this->minimum()));
125 if (newX < 0) newX = 0;
126 if (newX > w - 30) newX = w - 30;
137 if (event->button() == Qt::LeftButton)
139 double myx =
event->x();
140 QStyleOptionSlider opt;
141 initStyleOption(&opt);
142 QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle,
this);
147 if (myx<sr.left()+3 || myx>sr.right()-3)
156 QSlider::mousePressEvent(event);