100 QPainter painter(
this );
102 painter.setRenderHint( QPainter::Antialiasing,
true );
104 QColor colorHighlightActive;
106 QColor colorArcCenterSet;
107 QColor colorArcCenterUnset;
109 colorHighlightActive = pPref->getColorTheme()->m_highlightColor;
111 colorArcCenterSet = Qt::green;
112 colorArcCenterUnset = Qt::gray;
114 colorHighlightActive = pPref->getColorTheme()->m_lightColor;
115 colorArc = Qt::darkGray;
116 colorArcCenterSet = Qt::darkGray;
117 colorArcCenterUnset = Qt::lightGray;
119 QColor colorHandle = Qt::black;
120 QColor colorFont = Qt::white;
125 if ( ! hasFocus() ) {
126 colorHighlightActive.setAlpha( 150 );
132 QRect rectRotary, rectArc;
133 float fArcLineWidth, fBlackMargin;
141 rectRotary = QRect( rectArc.x() + fArcLineWidth / 2,
142 rectArc.y() + fArcLineWidth / 2,
143 rectArc.width() - fArcLineWidth,
144 rectArc.height() - fArcLineWidth );
155 if (
m_knob !=
nullptr ) {
157 m_knob->render( &painter, rectBackground );
159 m_knob->render( &painter,
"layer2", rectRotary );
166 int nStartAngle = 210 * 16;
169 painter.setPen( QPen( colorArc, fArcLineWidth ) );
170 painter.drawArc( rectArc, nStartAngle, nSpanAngle );
179 painter.setPen( QPen( colorArcCenterSet, fArcLineWidth * 1.25 ) );
180 painter.drawArc( rectArc, 91 * 16, -3 * 16 );
184 painter.setPen( QPen( colorArcCenterUnset, fArcLineWidth * 1.25 ) );
185 painter.drawArc( rectArc, 91 * 16, -3 * 16 );
187 int nStartAngle = -18 * 16;
191 nStartAngle -= 2 * 16;
193 nStartAngle += 90 * 16;
195 painter.setPen( QPen( colorArc, fArcLineWidth ) );
196 painter.drawArc( rectArc, nStartAngle, nSpanAngle );
205 fStartAngle = -90 * M_PI / 180;
208 fStartAngle = -90 * M_PI / 180;
254 float fDistance, fRadius, fBaseX, fBaseY;
261 fBaseX = rectRotary.x() + rectRotary.width()/2;
262 fBaseY = rectRotary.y() + rectRotary.height()/2;
267 QPointF p1( fBaseX + std::cos( fCurrentAngle ) * fDistance,
268 fBaseY + std::sin( fCurrentAngle ) * fDistance );
269 painter.setPen( QPen( colorHandle, 1 ) );
270 painter.setBrush( QBrush( colorHandle ) );
271 painter.drawEllipse( p1, fRadius, fRadius );
275 QRectF leftTextRec( 2, 16, 7, 7 );
276 QRectF rightTextRec( 34, 16, 9, 7 );
279 painter.setPen( QPen( colorFont, 3 ) );
280 if ( std::fmod(
m_fMin, 1 ) == 0 && std::fabs(
m_fMin ) < 10 ) {
281 font.setPixelSize( 7 );
282 painter.setFont( font );
283 painter.drawText( leftTextRec, Qt::AlignCenter, QString::number(
m_fMin ) );
285 font.setPixelSize( 9 );
286 painter.setFont( font );
287 painter.drawText( leftTextRec, Qt::AlignCenter,
"-" );
289 if ( std::fmod(
m_fMax, 1 ) == 0 && std::fabs(
m_fMax ) < 10 ) {
290 font.setPixelSize( 7 );
291 painter.setFont( font );
292 painter.drawText( rightTextRec, Qt::AlignCenter, QString::number(
m_fMax ) );
294 font.setPixelSize( 9 );
295 painter.setFont( font );
296 painter.drawText( rightTextRec, Qt::AlignCenter,
"+" );