draw additional debug information
This commit is contained in:
parent
227e269820
commit
d68dd2e6cf
|
@ -47,6 +47,10 @@ void Slider::paintEvent(QPaintEvent *event)
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
painter.setBrush(Qt::NoBrush);
|
painter.setBrush(Qt::NoBrush);
|
||||||
painter.drawRect(rect().adjusted(0, 0, -1, -1));
|
painter.drawRect(rect().adjusted(0, 0, -1, -1));
|
||||||
|
|
||||||
|
painter.setFont(QFont("monospace", 8));
|
||||||
|
painter.drawText(8, 18, "Value: ");
|
||||||
|
painter.drawText(8, 36, "Position: ");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,19 +59,17 @@ void Slider::mouseMoveEvent(QMouseEvent *event)
|
||||||
Q_D(Slider);
|
Q_D(Slider);
|
||||||
|
|
||||||
QRect track(d->trackGeometry().adjusted(-2, -2, 2, 2));
|
QRect track(d->trackGeometry().adjusted(-2, -2, 2, 2));
|
||||||
const bool onTrack = track.contains(event->pos());
|
|
||||||
|
|
||||||
if (onTrack != d->hoverTrack) {
|
if (track.contains(event->pos()) != d->hoverTrack) {
|
||||||
d->hoverTrack = onTrack;
|
d->hoverTrack = !d->hoverTrack;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF thumb(0, 0, 16, 16);
|
QRectF thumb(0, 0, 16, 16);
|
||||||
thumb.moveCenter(d->thumbGeometry().center());
|
thumb.moveCenter(d->thumbGeometry().center());
|
||||||
const bool onThumb = thumb.contains(event->pos());
|
|
||||||
|
|
||||||
if (onThumb != d->hoverThumb) {
|
if (thumb.contains(event->pos()) != d->hoverThumb) {
|
||||||
d->hoverThumb = onThumb;
|
d->hoverThumb = !d->hoverThumb;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue