Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezehelper.cpp
Show First 20 Lines • Show All 1252 Lines • ▼ Show 20 Line(s) | 1252 | void Helper::renderScrollBarHandle( | |||
---|---|---|---|---|---|
1253 | QPainter* painter, const QRect& rect, | 1253 | QPainter* painter, const QRect& rect, | ||
1254 | const QColor& color ) const | 1254 | const QColor& color ) const | ||
1255 | { | 1255 | { | ||
1256 | 1256 | | |||
1257 | // setup painter | 1257 | // setup painter | ||
1258 | painter->setRenderHint( QPainter::Antialiasing, true ); | 1258 | painter->setRenderHint( QPainter::Antialiasing, true ); | ||
1259 | 1259 | | |||
1260 | const QRectF baseRect( rect ); | 1260 | const QRectF baseRect( rect ); | ||
1261 | const qreal radius( 0.5*Metrics::ScrollBar_SliderWidth ); | 1261 | const qreal radius( 0.5 * std::min({baseRect.width(), baseRect.height(), (qreal)Metrics::ScrollBar_SliderWidth}) ); | ||
1262 | 1262 | | |||
hpereiradacosta: std::min( { a, b, c } )
would look nicer than qMin( qMin)
Other than that ship it !
also… | |||||
1263 | // content | 1263 | // content | ||
1264 | if( color.isValid() ) | 1264 | if( color.isValid() ) | ||
1265 | { | 1265 | { | ||
1266 | painter->setPen( Qt::NoPen ); | 1266 | painter->setPen( Qt::NoPen ); | ||
1267 | painter->setBrush( color ); | 1267 | painter->setBrush( color ); | ||
1268 | painter->drawRoundedRect( baseRect, radius, radius ); | 1268 | painter->drawRoundedRect( baseRect, radius, radius ); | ||
1269 | } | 1269 | } | ||
1270 | 1270 | | |||
▲ Show 20 Lines • Show All 345 Lines • Show Last 20 Lines |
std::min( { a, b, c } )
would look nicer than qMin( qMin)
Other than that ship it !
also, rather than (qreal)( rect.width() ) you can use directly baseRect.width(), which is a qRectF.
0.5*qMin( ... ) would also do the job. (as in 0.5*Metrics:: ... )
But in any case, std::min( ... )