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

Method pixelPosToRangeValue

src/frontend/widgets/qxtspanslider.cpp:109–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109int QxtSpanSliderPrivate::pixelPosToRangeValue(int pos) const {
110 QStyleOptionSlider opt;
111 initStyleOption(&opt);
112
113 int sliderMin = 0;
114 int sliderMax = 0;
115 int sliderLength = 0;
116 const QSlider* p = &qxt_p();
117 const QRect gr = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, p);
118 const QRect sr = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, p);
119 if (p->orientation() == Qt::Horizontal) {
120 sliderLength = sr.width();
121 sliderMin = gr.x();
122 sliderMax = gr.right() - sliderLength + 1;
123 } else {
124 sliderLength = sr.height();
125 sliderMin = gr.y();
126 sliderMax = gr.bottom() - sliderLength + 1;
127 }
128 return QStyle::sliderValueFromPosition(p->minimum(), p->maximum(), pos - sliderMin, sliderMax - sliderMin, opt.upsideDown);
129}
130
131void QxtSpanSliderPrivate::handleMousePress(QPoint pos, QStyle::SubControl& control, int value, QxtSpanSlider::SpanHandle handle) {
132 QStyleOptionSlider opt;

Callers 1

mouseMoveEventMethod · 0.80

Calls 7

xMethod · 0.80
heightMethod · 0.80
orientationMethod · 0.45
widthMethod · 0.45
yMethod · 0.45
minimumMethod · 0.45
maximumMethod · 0.45

Tested by

no test coverage detected