MCPcopy Create free account
hub / github.com/KDE/labplot / paintEvent

Method paintEvent

src/frontend/widgets/qxtspanslider.cpp:669–702  ·  view source on GitHub ↗

! \reimp */

Source from the content-addressed store, hash-verified

667 \reimp
668 */
669void QxtSpanSlider::paintEvent(QPaintEvent*) {
670 QStylePainter painter(this);
671
672 // groove & ticks
673 QStyleOptionSlider opt;
674 qxt_d().initStyleOption(&opt);
675 opt.sliderValue = 0;
676 opt.sliderPosition = 0;
677 opt.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderTickmarks;
678 painter.drawComplexControl(QStyle::CC_Slider, opt);
679
680 // handle rects
681 opt.sliderPosition = qxt_d().lowerPos;
682 const QRect lr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
683 const int lrv = qxt_d().pick(lr.center());
684 opt.sliderPosition = qxt_d().upperPos;
685 const QRect ur = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
686 const int urv = qxt_d().pick(ur.center());
687
688 // span
689 const int minv = qMin(lrv, urv);
690 const int maxv = qMax(lrv, urv);
691 const QPoint c = QRect(lr.center(), ur.center()).center();
692 QRect spanRect;
693 if (orientation() == Qt::Horizontal)
694 spanRect = QRect(QPoint(minv, c.y() - 2), QPoint(maxv, c.y() + 1));
695 else
696 spanRect = QRect(QPoint(c.x() - 2, minv), QPoint(c.x() + 1, maxv));
697 qxt_d().drawSpan(&painter, spanRect);
698
699 // handles
700 qxt_d().drawHandle(&painter, QxtSpanSlider::UpperHandle);
701 qxt_d().drawHandle(&painter, QxtSpanSlider::LowerHandle);
702}

Callers

nothing calls this directly

Calls 7

initStyleOptionMethod · 0.80
xMethod · 0.80
drawSpanMethod · 0.80
drawHandleMethod · 0.80
pickMethod · 0.45
centerMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected