Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezehelper.cpp
Show First 20 Lines • Show All 469 Lines • ▼ Show 20 Line(s) | 458 | } else { | |||
---|---|---|---|---|---|
470 | 470 | | |||
471 | painter->setPen( outline ); | 471 | painter->setPen( outline ); | ||
472 | // painter->setBrush( Qt::NoBrush ); | 472 | // painter->setBrush( Qt::NoBrush ); | ||
473 | painter->drawRoundedRect( copy, radius, radius ); | 473 | painter->drawRoundedRect( copy, radius, radius ); | ||
474 | 474 | | |||
475 | } | 475 | } | ||
476 | 476 | | |||
477 | painter->restore(); | 477 | painter->restore(); | ||
478 | return; | | |||
479 | } | 478 | } | ||
480 | 479 | | |||
481 | //______________________________________________________________________________ | 480 | //______________________________________________________________________________ | ||
482 | void Helper::renderFocusLine( QPainter* painter, const QRect& rect, const QColor& color ) const | 481 | void Helper::renderFocusLine( QPainter* painter, const QRect& rect, const QColor& color ) const | ||
483 | { | 482 | { | ||
484 | if( !color.isValid() ) return; | 483 | if( !color.isValid() ) return; | ||
485 | 484 | | |||
486 | painter->save(); | 485 | painter->save(); | ||
▲ Show 20 Lines • Show All 270 Lines • ▼ Show 20 Line(s) | 728 | { | |||
757 | 756 | | |||
758 | // render | 757 | // render | ||
759 | painter->setRenderHints( QPainter::Antialiasing ); | 758 | painter->setRenderHints( QPainter::Antialiasing ); | ||
760 | painter->setBrush( Qt::NoBrush ); | 759 | painter->setBrush( Qt::NoBrush ); | ||
761 | painter->setPen( outline ); | 760 | painter->setPen( outline ); | ||
762 | painter->translate( baseRect.topLeft() ); | 761 | painter->translate( baseRect.topLeft() ); | ||
763 | painter->drawPath( path ); | 762 | painter->drawPath( path ); | ||
764 | 763 | | |||
765 | return; | | |||
766 | | ||||
767 | } | 764 | } | ||
768 | 765 | | |||
769 | //______________________________________________________________________________ | 766 | //______________________________________________________________________________ | ||
770 | void Helper::renderTabWidgetFrame( | 767 | void Helper::renderTabWidgetFrame( | ||
771 | QPainter* painter, const QRect& rect, | 768 | QPainter* painter, const QRect& rect, | ||
772 | const QColor& color, const QColor& outline, Corners corners ) const | 769 | const QColor& color, const QColor& outline, Corners corners ) const | ||
773 | { | 770 | { | ||
774 | 771 | | |||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 815 | { | |||
830 | } else { | 827 | } else { | ||
831 | 828 | | |||
832 | painter->translate( 0, rect.height()/2 ); | 829 | painter->translate( 0, rect.height()/2 ); | ||
833 | painter->drawLine( rect.topLeft(), rect.topRight() ); | 830 | painter->drawLine( rect.topLeft(), rect.topRight() ); | ||
834 | 831 | | |||
835 | 832 | | |||
836 | } | 833 | } | ||
837 | 834 | | |||
838 | return; | | |||
839 | 835 | | |||
840 | } | 836 | } | ||
841 | 837 | | |||
842 | //______________________________________________________________________________ | 838 | //______________________________________________________________________________ | ||
843 | void Helper::renderCheckBoxBackground( | 839 | void Helper::renderCheckBoxBackground( | ||
844 | QPainter* painter, const QRect& rect, | 840 | QPainter* painter, const QRect& rect, | ||
845 | const QColor& color, bool sunken ) const | 841 | const QColor& color, bool sunken ) const | ||
846 | { | 842 | { | ||
▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Line(s) | 1037 | { | |||
1049 | // content | 1045 | // content | ||
1050 | if( color.isValid() ) | 1046 | if( color.isValid() ) | ||
1051 | { | 1047 | { | ||
1052 | painter->setPen( Qt::NoPen ); | 1048 | painter->setPen( Qt::NoPen ); | ||
1053 | painter->setBrush( color ); | 1049 | painter->setBrush( color ); | ||
1054 | painter->drawRoundedRect( baseRect, radius, radius ); | 1050 | painter->drawRoundedRect( baseRect, radius, radius ); | ||
1055 | } | 1051 | } | ||
1056 | 1052 | | |||
1057 | return; | | |||
1058 | 1053 | | |||
1059 | } | 1054 | } | ||
1060 | 1055 | | |||
1061 | //______________________________________________________________________________ | 1056 | //______________________________________________________________________________ | ||
1062 | void Helper::renderDialGroove( | 1057 | void Helper::renderDialGroove( | ||
1063 | QPainter* painter, const QRect& rect, | 1058 | QPainter* painter, const QRect& rect, | ||
1064 | const QColor& color ) const | 1059 | const QColor& color ) const | ||
1065 | { | 1060 | { | ||
Show All 9 Lines | 1069 | { | |||
1075 | const qreal penWidth( Metrics::Slider_GrooveThickness ); | 1070 | const qreal penWidth( Metrics::Slider_GrooveThickness ); | ||
1076 | const QRectF grooveRect( rect.adjusted( penWidth/2, penWidth/2, -penWidth/2, -penWidth/2 ) ); | 1071 | const QRectF grooveRect( rect.adjusted( penWidth/2, penWidth/2, -penWidth/2, -penWidth/2 ) ); | ||
1077 | 1072 | | |||
1078 | painter->setPen( QPen( color, penWidth ) ); | 1073 | painter->setPen( QPen( color, penWidth ) ); | ||
1079 | painter->setBrush( Qt::NoBrush ); | 1074 | painter->setBrush( Qt::NoBrush ); | ||
1080 | painter->drawEllipse( grooveRect ); | 1075 | painter->drawEllipse( grooveRect ); | ||
1081 | } | 1076 | } | ||
1082 | 1077 | | |||
1083 | return; | | |||
1084 | 1078 | | |||
1085 | } | 1079 | } | ||
1086 | 1080 | | |||
1087 | //______________________________________________________________________________ | 1081 | //______________________________________________________________________________ | ||
1088 | void Helper::renderDialContents( | 1082 | void Helper::renderDialContents( | ||
1089 | QPainter* painter, const QRect& rect, | 1083 | QPainter* painter, const QRect& rect, | ||
1090 | const QColor& color, | 1084 | const QColor& color, | ||
1091 | qreal first, qreal second ) const | 1085 | qreal first, qreal second ) const | ||
Show All 23 Lines | 1107 | { | |||
1115 | pen.setCapStyle( Qt::RoundCap ); | 1109 | pen.setCapStyle( Qt::RoundCap ); | ||
1116 | painter->setPen( pen ); | 1110 | painter->setPen( pen ); | ||
1117 | painter->setBrush( Qt::NoBrush ); | 1111 | painter->setBrush( Qt::NoBrush ); | ||
1118 | painter->drawArc( grooveRect, angleStart, angleSpan ); | 1112 | painter->drawArc( grooveRect, angleStart, angleSpan ); | ||
1119 | } | 1113 | } | ||
1120 | 1114 | | |||
1121 | } | 1115 | } | ||
1122 | 1116 | | |||
1123 | return; | | |||
1124 | 1117 | | |||
1125 | } | 1118 | } | ||
1126 | 1119 | | |||
1127 | //______________________________________________________________________________ | 1120 | //______________________________________________________________________________ | ||
1128 | void Helper::renderSliderHandle( | 1121 | void Helper::renderSliderHandle( | ||
1129 | QPainter* painter, const QRect& rect, | 1122 | QPainter* painter, const QRect& rect, | ||
1130 | const QColor& color, | 1123 | const QColor& color, | ||
1131 | const QColor& outline, | 1124 | const QColor& outline, | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 1168 | { | |||
1183 | // content | 1176 | // content | ||
1184 | if( color.isValid() ) | 1177 | if( color.isValid() ) | ||
1185 | { | 1178 | { | ||
1186 | painter->setPen( Qt::NoPen ); | 1179 | painter->setPen( Qt::NoPen ); | ||
1187 | painter->setBrush( color ); | 1180 | painter->setBrush( color ); | ||
1188 | painter->drawRoundedRect( baseRect, radius, radius ); | 1181 | painter->drawRoundedRect( baseRect, radius, radius ); | ||
1189 | } | 1182 | } | ||
1190 | 1183 | | |||
1191 | return; | | |||
1192 | 1184 | | |||
1193 | } | 1185 | } | ||
1194 | 1186 | | |||
1195 | 1187 | | |||
1196 | //______________________________________________________________________________ | 1188 | //______________________________________________________________________________ | ||
1197 | void Helper::renderProgressBarBusyContents( | 1189 | void Helper::renderProgressBarBusyContents( | ||
1198 | QPainter* painter, const QRect& rect, | 1190 | QPainter* painter, const QRect& rect, | ||
1199 | const QColor& first, | 1191 | const QColor& first, | ||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 1222 | } else { | |||
1241 | { painter.drawRect( QRect( 0, 0, 1, Metrics::ProgressBar_BusyIndicatorSize ).translated( 0, progress - 2*Metrics::ProgressBar_BusyIndicatorSize ) ); } | 1233 | { painter.drawRect( QRect( 0, 0, 1, Metrics::ProgressBar_BusyIndicatorSize ).translated( 0, progress - 2*Metrics::ProgressBar_BusyIndicatorSize ) ); } | ||
1242 | 1234 | | |||
1243 | } | 1235 | } | ||
1244 | 1236 | | |||
1245 | painter->setPen( Qt::NoPen ); | 1237 | painter->setPen( Qt::NoPen ); | ||
1246 | painter->setBrush( pixmap ); | 1238 | painter->setBrush( pixmap ); | ||
1247 | painter->drawRoundedRect( baseRect, radius, radius ); | 1239 | painter->drawRoundedRect( baseRect, radius, radius ); | ||
1248 | 1240 | | |||
1249 | return; | | |||
1250 | | ||||
1251 | } | 1241 | } | ||
1252 | 1242 | | |||
1253 | //______________________________________________________________________________ | 1243 | //______________________________________________________________________________ | ||
1254 | void Helper::renderScrollBarHandle( | 1244 | void Helper::renderScrollBarHandle( | ||
1255 | QPainter* painter, const QRect& rect, | 1245 | QPainter* painter, const QRect& rect, | ||
1256 | const QColor& color ) const | 1246 | const QColor& color ) const | ||
1257 | { | 1247 | { | ||
1258 | 1248 | | |||
1259 | // setup painter | 1249 | // setup painter | ||
1260 | painter->setRenderHint( QPainter::Antialiasing, true ); | 1250 | painter->setRenderHint( QPainter::Antialiasing, true ); | ||
1261 | 1251 | | |||
1262 | const QRectF baseRect( rect ); | 1252 | const QRectF baseRect( rect ); | ||
1263 | const qreal radius( 0.5 * std::min({baseRect.width(), baseRect.height(), (qreal)Metrics::ScrollBar_SliderWidth}) ); | 1253 | const qreal radius( 0.5 * std::min({baseRect.width(), baseRect.height(), (qreal)Metrics::ScrollBar_SliderWidth}) ); | ||
1264 | 1254 | | |||
1265 | // content | 1255 | // content | ||
1266 | if( color.isValid() ) | 1256 | if( color.isValid() ) | ||
1267 | { | 1257 | { | ||
1268 | painter->setPen( Qt::NoPen ); | 1258 | painter->setPen( Qt::NoPen ); | ||
1269 | painter->setBrush( color ); | 1259 | painter->setBrush( color ); | ||
1270 | painter->drawRoundedRect( baseRect, radius, radius ); | 1260 | painter->drawRoundedRect( baseRect, radius, radius ); | ||
1271 | } | 1261 | } | ||
1272 | 1262 | | |||
1273 | return; | | |||
1274 | 1263 | | |||
1275 | } | 1264 | } | ||
1276 | 1265 | | |||
1277 | //______________________________________________________________________________ | 1266 | //______________________________________________________________________________ | ||
1278 | void Helper::renderTabBarTab( QPainter* painter, const QRect& rect, const QColor& color, const QColor& outline, Corners corners ) const | 1267 | void Helper::renderTabBarTab( QPainter* painter, const QRect& rect, const QColor& color, const QColor& outline, Corners corners ) const | ||
1279 | { | 1268 | { | ||
1280 | 1269 | | |||
1281 | // setup painter | 1270 | // setup painter | ||
Show All 40 Lines | 1299 | { | |||
1322 | 1311 | | |||
1323 | painter->save(); | 1312 | painter->save(); | ||
1324 | painter->setRenderHints( QPainter::Antialiasing ); | 1313 | painter->setRenderHints( QPainter::Antialiasing ); | ||
1325 | painter->translate( QRectF( rect ).center() ); | 1314 | painter->translate( QRectF( rect ).center() ); | ||
1326 | painter->setBrush( Qt::NoBrush ); | 1315 | painter->setBrush( Qt::NoBrush ); | ||
1327 | painter->setPen( QPen( color, 1.1 ) ); | 1316 | painter->setPen( QPen( color, 1.1 ) ); | ||
1328 | painter->drawPolyline( arrow ); | 1317 | painter->drawPolyline( arrow ); | ||
1329 | painter->restore(); | 1318 | painter->restore(); | ||
1330 | | ||||
1331 | return; | | |||
1332 | } | 1319 | } | ||
1333 | 1320 | | |||
1334 | //______________________________________________________________________________ | 1321 | //______________________________________________________________________________ | ||
1335 | void Helper::renderDecorationButton( QPainter* painter, const QRect& rect, const QColor& color, ButtonType buttonType, bool inverted ) const | 1322 | void Helper::renderDecorationButton( QPainter* painter, const QRect& rect, const QColor& color, ButtonType buttonType, bool inverted ) const | ||
1336 | { | 1323 | { | ||
1337 | 1324 | | |||
1338 | painter->save(); | 1325 | painter->save(); | ||
1339 | painter->setViewport( rect ); | 1326 | painter->setViewport( rect ); | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 1391 | painter->drawPolygon( QPolygonF() | |||
1408 | << QPointF( 9, 13.5 ) ); | 1395 | << QPointF( 9, 13.5 ) ); | ||
1409 | break; | 1396 | break; | ||
1410 | } | 1397 | } | ||
1411 | 1398 | | |||
1412 | default: break; | 1399 | default: break; | ||
1413 | } | 1400 | } | ||
1414 | 1401 | | |||
1415 | painter->restore(); | 1402 | painter->restore(); | ||
1416 | return; | | |||
1417 | 1403 | | |||
1418 | } | 1404 | } | ||
1419 | 1405 | | |||
1420 | //______________________________________________________________________________ | 1406 | //______________________________________________________________________________ | ||
1421 | bool Helper::isX11() | 1407 | bool Helper::isX11() | ||
1422 | { | 1408 | { | ||
1423 | #if BREEZE_HAVE_X11 | 1409 | #if BREEZE_HAVE_X11 | ||
1424 | #if QT_VERSION >= 0x050000 | 1410 | #if QT_VERSION >= 0x050000 | ||
▲ Show 20 Lines • Show All 193 Lines • Show Last 20 Lines |