bounds checks
BUG:240724 svn path=/trunk/KDE/kdelibs/; revision=1134602
This commit is contained in:
parent
2729b466df
commit
89efdef96c
@ -145,8 +145,7 @@ void Slider::paint(QPainter *painter,
|
|||||||
style->drawComplexControl(QStyle::CC_Slider, &sliderOpt, painter, slider);
|
style->drawComplexControl(QStyle::CC_Slider, &sliderOpt, painter, slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect handleRect =
|
QRect handleRect = style->subControlRect(QStyle::CC_Slider, &sliderOpt, QStyle::SC_SliderHandle, slider);
|
||||||
style->subControlRect(QStyle::CC_Slider, &sliderOpt, QStyle::SC_SliderHandle, slider);
|
|
||||||
|
|
||||||
QString handle;
|
QString handle;
|
||||||
if (sliderOpt.orientation == Qt::Horizontal) {
|
if (sliderOpt.orientation == Qt::Horizontal) {
|
||||||
@ -157,6 +156,22 @@ void Slider::paint(QPainter *painter,
|
|||||||
|
|
||||||
QRect elementRect = d->background->elementRect(handle).toRect();
|
QRect elementRect = d->background->elementRect(handle).toRect();
|
||||||
elementRect.moveCenter(handleRect.center());
|
elementRect.moveCenter(handleRect.center());
|
||||||
|
if (elementRect.right() > rect().right()) {
|
||||||
|
elementRect.moveRight(rect().right());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elementRect.left() < rect().left()) {
|
||||||
|
elementRect.moveLeft(rect().left());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elementRect.top() < rect().top()) {
|
||||||
|
elementRect.moveTop(rect().top());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elementRect.bottom() > rect().bottom()) {
|
||||||
|
elementRect.moveBottom(rect().bottom());
|
||||||
|
}
|
||||||
|
|
||||||
if (orientation() == Qt::Vertical) {
|
if (orientation() == Qt::Vertical) {
|
||||||
d->focusIndicator->setCustomPrefix("vertical-slider");
|
d->focusIndicator->setCustomPrefix("vertical-slider");
|
||||||
} else {
|
} else {
|
||||||
@ -164,7 +179,6 @@ void Slider::paint(QPainter *painter,
|
|||||||
}
|
}
|
||||||
d->focusIndicator->setCustomGeometry(elementRect);
|
d->focusIndicator->setCustomGeometry(elementRect);
|
||||||
d->background->paint(painter, elementRect, handle);
|
d->background->paint(painter, elementRect, handle);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slider::wheelEvent(QGraphicsSceneWheelEvent *event)
|
void Slider::wheelEvent(QGraphicsSceneWheelEvent *event)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user