Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezestyle.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1283 Lines • ▼ Show 20 Line(s) | 1266 | { | |||
---|---|---|---|---|---|
1284 | 1284 | | |||
1285 | // frame | 1285 | // frame | ||
1286 | drawControl(QStyle::CE_PushButton, &option, &painter, button ); | 1286 | drawControl(QStyle::CE_PushButton, &option, &painter, button ); | ||
1287 | 1287 | | |||
1288 | // offset | 1288 | // offset | ||
1289 | const int margin( Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); | 1289 | const int margin( Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); | ||
1290 | QPoint offset( margin, margin ); | 1290 | QPoint offset( margin, margin ); | ||
1291 | 1291 | | |||
1292 | if( button->isDown() && !isFlat ) painter.translate( 1, 1 ); | | |||
1293 | { offset += QPoint( 1, 1 ); } | | |||
1294 | | ||||
1295 | // state | 1292 | // state | ||
1296 | const State& state( option.state ); | 1293 | const State& state( option.state ); | ||
1297 | const bool enabled( state & State_Enabled ); | 1294 | const bool enabled( state & State_Enabled ); | ||
1298 | bool mouseOver( enabled && ( state & State_MouseOver ) ); | 1295 | bool mouseOver( enabled && ( state & State_MouseOver ) ); | ||
1299 | bool hasFocus( enabled && ( state & State_HasFocus ) ); | 1296 | bool hasFocus( enabled && ( state & State_HasFocus ) ); | ||
1300 | 1297 | | |||
1301 | // icon | 1298 | // icon | ||
1302 | if( !button->icon().isNull() ) | 1299 | if( !button->icon().isNull() ) | ||
▲ Show 20 Lines • Show All 2238 Lines • ▼ Show 20 Line(s) | 3534 | } else { | |||
3541 | if( enabled && buttonOption->features & QStyleOptionButton::DefaultButton ) | 3538 | if( enabled && buttonOption->features & QStyleOptionButton::DefaultButton ) | ||
3542 | { | 3539 | { | ||
3543 | const auto button( palette.color( QPalette::Button ) ); | 3540 | const auto button( palette.color( QPalette::Button ) ); | ||
3544 | const auto base( palette.color( QPalette::Base ) ); | 3541 | const auto base( palette.color( QPalette::Base ) ); | ||
3545 | palette.setColor( QPalette::Button, KColorUtils::mix( button, base, 0.7 ) ); | 3542 | palette.setColor( QPalette::Button, KColorUtils::mix( button, base, 0.7 ) ); | ||
3546 | } | 3543 | } | ||
3547 | 3544 | | |||
3548 | const auto shadow( _helper->shadowColor( palette ) ); | 3545 | const auto shadow( _helper->shadowColor( palette ) ); | ||
3549 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); | 3546 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
3550 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | 3547 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
3551 | 3548 | | |||
3552 | // render | 3549 | // render | ||
3553 | _helper->renderButtonFrame( painter, rect, background, outline, shadow, hasFocus, sunken ); | 3550 | _helper->renderButton( painter, rect, background, outline, shadow, hasFocus, sunken ); | ||
3554 | 3551 | | |||
3555 | } | 3552 | } | ||
3556 | 3553 | | |||
3557 | return true; | 3554 | return true; | ||
3558 | 3555 | | |||
3559 | } | 3556 | } | ||
3560 | 3557 | | |||
3561 | //______________________________________________________________ | 3558 | //______________________________________________________________ | ||
Show All 23 Lines | 3560 | { | |||
3585 | { | 3582 | { | ||
3586 | 3583 | | |||
3587 | // need to check widget for popup mode, because option is not set properly | 3584 | // need to check widget for popup mode, because option is not set properly | ||
3588 | const auto toolButton( qobject_cast<const QToolButton*>( widget ) ); | 3585 | const auto toolButton( qobject_cast<const QToolButton*>( widget ) ); | ||
3589 | const bool hasPopupMenu( toolButton && toolButton->popupMode() == QToolButton::MenuButtonPopup ); | 3586 | const bool hasPopupMenu( toolButton && toolButton->popupMode() == QToolButton::MenuButtonPopup ); | ||
3590 | 3587 | | |||
3591 | // render as push button | 3588 | // render as push button | ||
3592 | const auto shadow( _helper->shadowColor( palette ) ); | 3589 | const auto shadow( _helper->shadowColor( palette ) ); | ||
3593 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); | 3590 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
3594 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | 3591 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
3595 | 3592 | | |||
3596 | // adjust frame in case of menu | 3593 | // adjust frame in case of menu | ||
3597 | if( hasPopupMenu ) | 3594 | if( hasPopupMenu ) | ||
3598 | { | 3595 | { | ||
3599 | painter->setClipRect( rect ); | 3596 | painter->setClipRect( rect ); | ||
3600 | rect.adjust( 0, 0, Metrics::Frame_FrameRadius + 2, 0 ); | 3597 | rect.adjust( 0, 0, Metrics::Frame_FrameRadius + 2, 0 ); | ||
3601 | rect = visualRect( option, rect ); | 3598 | rect = visualRect( option, rect ); | ||
3602 | } | 3599 | } | ||
3603 | 3600 | | |||
3604 | // render | 3601 | // render | ||
3605 | _helper->renderButtonFrame( painter, rect, background, outline, shadow, hasFocus, sunken ); | 3602 | _helper->renderButton( painter, rect, background, outline, shadow, hasFocus, sunken ); | ||
3606 | 3603 | | |||
3607 | } else { | 3604 | } else { | ||
3608 | 3605 | | |||
3609 | const auto color( _helper->toolButtonColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | 3606 | const auto color( _helper->toolButtonColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
3610 | _helper->renderToolButtonFrame( painter, rect, color, sunken ); | 3607 | _helper->renderToolButtonFrame( painter, rect, color, sunken ); | ||
3611 | 3608 | | |||
3612 | } | 3609 | } | ||
3613 | 3610 | | |||
▲ Show 20 Lines • Show All 319 Lines • ▼ Show 20 Line(s) | 3905 | { | |||
3933 | _animations->widgetStateEngine().updateState( widget, AnimationHover, mouseOver ); | 3930 | _animations->widgetStateEngine().updateState( widget, AnimationHover, mouseOver ); | ||
3934 | _animations->widgetStateEngine().updateState( widget, AnimationFocus, hasFocus && !mouseOver ); | 3931 | _animations->widgetStateEngine().updateState( widget, AnimationFocus, hasFocus && !mouseOver ); | ||
3935 | 3932 | | |||
3936 | const AnimationMode mode( _animations->widgetStateEngine().buttonAnimationMode( widget ) ); | 3933 | const AnimationMode mode( _animations->widgetStateEngine().buttonAnimationMode( widget ) ); | ||
3937 | const qreal opacity( _animations->widgetStateEngine().buttonOpacity( widget ) ); | 3934 | const qreal opacity( _animations->widgetStateEngine().buttonOpacity( widget ) ); | ||
3938 | 3935 | | |||
3939 | // render as push button | 3936 | // render as push button | ||
3940 | const auto shadow( _helper->shadowColor( palette ) ); | 3937 | const auto shadow( _helper->shadowColor( palette ) ); | ||
3941 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); | 3938 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
3942 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, false, opacity, mode ) ); | 3939 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, false, opacity, mode ) ); | ||
3943 | 3940 | | |||
3944 | auto frameRect( rect ); | 3941 | auto frameRect( rect ); | ||
3945 | painter->setClipRect( rect ); | 3942 | painter->setClipRect( rect ); | ||
3946 | frameRect.adjust( -Metrics::Frame_FrameRadius - 1, 0, 0, 0 ); | 3943 | frameRect.adjust( -Metrics::Frame_FrameRadius - 1, 0, 0, 0 ); | ||
3947 | frameRect = visualRect( option, frameRect ); | 3944 | frameRect = visualRect( option, frameRect ); | ||
3948 | 3945 | | |||
3949 | // render | 3946 | // render | ||
3950 | _helper->renderButtonFrame( painter, frameRect, background, outline, shadow, hasFocus, sunken ); | 3947 | _helper->renderButton( painter, frameRect, background, outline, shadow, hasFocus, sunken ); | ||
3951 | 3948 | | |||
3952 | // also render separator | 3949 | // also render separator | ||
3953 | auto separatorRect( rect.adjusted( 0, 2, -2, -2 ) ); | 3950 | auto separatorRect( rect.adjusted( 0, 2, -2, -2 ) ); | ||
3954 | separatorRect.setWidth( 1 ); | 3951 | separatorRect.setWidth( 1 ); | ||
3955 | separatorRect = visualRect( option, separatorRect ); | 3952 | separatorRect = visualRect( option, separatorRect ); | ||
3956 | if( sunken ) separatorRect.translate( 1, 1 ); | | |||
3957 | _helper->renderSeparator( painter, separatorRect, outline, true ); | 3953 | _helper->renderSeparator( painter, separatorRect, outline, true ); | ||
3958 | 3954 | | |||
3959 | return true; | 3955 | return true; | ||
3960 | 3956 | | |||
3961 | } | 3957 | } | ||
3962 | 3958 | | |||
3963 | //___________________________________________________________________________________ | 3959 | //___________________________________________________________________________________ | ||
3964 | bool Style::drawIndicatorTabClosePrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3960 | bool Style::drawIndicatorTabClosePrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
▲ Show 20 Lines • Show All 259 Lines • ▼ Show 20 Line(s) | 4204 | { | |||
4224 | const bool flat( buttonOption->features & QStyleOptionButton::Flat ); | 4220 | const bool flat( buttonOption->features & QStyleOptionButton::Flat ); | ||
4225 | 4221 | | |||
4226 | // content | 4222 | // content | ||
4227 | const bool hasText( !buttonOption->text.isEmpty() ); | 4223 | const bool hasText( !buttonOption->text.isEmpty() ); | ||
4228 | const bool hasIcon( (showIconsOnPushButtons() || flat || !hasText ) && !buttonOption->icon.isNull() ); | 4224 | const bool hasIcon( (showIconsOnPushButtons() || flat || !hasText ) && !buttonOption->icon.isNull() ); | ||
4229 | 4225 | | |||
4230 | // contents | 4226 | // contents | ||
4231 | auto contentsRect( rect ); | 4227 | auto contentsRect( rect ); | ||
4232 | if( sunken && !flat ) contentsRect.translate( 1, 1 ); | | |||
4233 | 4228 | | |||
4234 | // color role | 4229 | // color role | ||
4235 | QPalette::ColorRole textRole; | 4230 | QPalette::ColorRole textRole; | ||
4236 | if( flat ) | 4231 | if( flat ) { | ||
4237 | { | | |||
4238 | 4232 | | |||
4239 | if( hasFocus && sunken ) textRole = QPalette::HighlightedText; | 4233 | if( hasFocus && sunken ) textRole = QPalette::HighlightedText; | ||
4240 | else textRole = QPalette::WindowText; | 4234 | else textRole = QPalette::WindowText; | ||
4241 | 4235 | | |||
4242 | } else if( hasFocus ) textRole = QPalette::HighlightedText; | 4236 | } else textRole = QPalette::ButtonText; | ||
4243 | else textRole = QPalette::ButtonText; | | |||
4244 | 4237 | | |||
4245 | // menu arrow | 4238 | // menu arrow | ||
4246 | if( buttonOption->features & QStyleOptionButton::HasMenu ) | 4239 | if( buttonOption->features & QStyleOptionButton::HasMenu ) | ||
4247 | { | 4240 | { | ||
4248 | 4241 | | |||
4249 | // define rect | 4242 | // define rect | ||
4250 | auto arrowRect( contentsRect ); | 4243 | auto arrowRect( contentsRect ); | ||
4251 | arrowRect.setLeft( contentsRect.right() - Metrics::MenuButton_IndicatorWidth + 1 ); | 4244 | arrowRect.setLeft( contentsRect.right() - Metrics::MenuButton_IndicatorWidth + 1 ); | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
4301 | 4294 | | |||
4302 | // render icon | 4295 | // render icon | ||
4303 | if( hasIcon && iconRect.isValid() ) { | 4296 | if( hasIcon && iconRect.isValid() ) { | ||
4304 | 4297 | | |||
4305 | // icon state and mode | 4298 | // icon state and mode | ||
4306 | const QIcon::State iconState( sunken ? QIcon::On : QIcon::Off ); | 4299 | const QIcon::State iconState( sunken ? QIcon::On : QIcon::Off ); | ||
4307 | QIcon::Mode iconMode; | 4300 | QIcon::Mode iconMode; | ||
4308 | if( !enabled ) iconMode = QIcon::Disabled; | 4301 | if( !enabled ) iconMode = QIcon::Disabled; | ||
4309 | else if( !flat && hasFocus ) iconMode = QIcon::Selected; | 4302 | // else if( !flat && hasFocus ) iconMode = QIcon::Selected; | ||
4310 | else if( mouseOver && flat ) iconMode = QIcon::Active; | 4303 | else if( mouseOver && flat ) iconMode = QIcon::Active; | ||
4311 | else iconMode = QIcon::Normal; | 4304 | else iconMode = QIcon::Normal; | ||
4312 | 4305 | | |||
4313 | const auto pixmap = buttonOption->icon.pixmap( iconSize, iconMode, iconState ); | 4306 | const auto pixmap = buttonOption->icon.pixmap( iconSize, iconMode, iconState ); | ||
4314 | drawItemPixmap( painter, iconRect, Qt::AlignCenter, pixmap ); | 4307 | drawItemPixmap( painter, iconRect, Qt::AlignCenter, pixmap ); | ||
4315 | 4308 | | |||
4316 | } | 4309 | } | ||
4317 | 4310 | | |||
Show All 29 Lines | 4321 | { | |||
4347 | else hasFocus = enabled && !mouseOver && (option->state & (State_HasFocus|State_Sunken) ); | 4340 | else hasFocus = enabled && !mouseOver && (option->state & (State_HasFocus|State_Sunken) ); | ||
4348 | 4341 | | |||
4349 | const bool hasArrow( toolButtonOption->features & QStyleOptionToolButton::Arrow ); | 4342 | const bool hasArrow( toolButtonOption->features & QStyleOptionToolButton::Arrow ); | ||
4350 | const bool hasIcon( !( hasArrow || toolButtonOption->icon.isNull() ) ); | 4343 | const bool hasIcon( !( hasArrow || toolButtonOption->icon.isNull() ) ); | ||
4351 | const bool hasText( !toolButtonOption->text.isEmpty() ); | 4344 | const bool hasText( !toolButtonOption->text.isEmpty() ); | ||
4352 | 4345 | | |||
4353 | // contents | 4346 | // contents | ||
4354 | auto contentsRect( rect ); | 4347 | auto contentsRect( rect ); | ||
4355 | if( sunken && !flat ) contentsRect.translate( 1, 1 ); | | |||
4356 | 4348 | | |||
4357 | // icon size | 4349 | // icon size | ||
4358 | const QSize iconSize( toolButtonOption->iconSize ); | 4350 | const QSize iconSize( toolButtonOption->iconSize ); | ||
4359 | 4351 | | |||
4360 | // text size | 4352 | // text size | ||
4361 | int textFlags( _mnemonics->textFlags() ); | 4353 | int textFlags( _mnemonics->textFlags() ); | ||
4362 | const QSize textSize( option->fontMetrics.size( textFlags, toolButtonOption->text ) ); | 4354 | const QSize textSize( option->fontMetrics.size( textFlags, toolButtonOption->text ) ); | ||
4363 | 4355 | | |||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 4408 | { | |||
4427 | } | 4419 | } | ||
4428 | 4420 | | |||
4429 | } else if( hasIcon && iconRect.isValid() ) { | 4421 | } else if( hasIcon && iconRect.isValid() ) { | ||
4430 | 4422 | | |||
4431 | // icon state and mode | 4423 | // icon state and mode | ||
4432 | const QIcon::State iconState( sunken ? QIcon::On : QIcon::Off ); | 4424 | const QIcon::State iconState( sunken ? QIcon::On : QIcon::Off ); | ||
4433 | QIcon::Mode iconMode; | 4425 | QIcon::Mode iconMode; | ||
4434 | if( !enabled ) iconMode = QIcon::Disabled; | 4426 | if( !enabled ) iconMode = QIcon::Disabled; | ||
4435 | else if( (!flat && hasFocus) || (flat && (state & State_Sunken) && !mouseOver) ) iconMode = QIcon::Selected; | 4427 | // else if( (!flat && hasFocus) || (flat && (state & State_Sunken) && !mouseOver) ) iconMode = QIcon::Selected; | ||
4436 | else if( mouseOver && flat ) iconMode = QIcon::Active; | 4428 | else if( mouseOver && flat ) iconMode = QIcon::Active; | ||
4437 | else iconMode = QIcon::Normal; | 4429 | else iconMode = QIcon::Normal; | ||
4438 | 4430 | | |||
4439 | const QPixmap pixmap = toolButtonOption->icon.pixmap( iconSize, iconMode, iconState ); | 4431 | const QPixmap pixmap = toolButtonOption->icon.pixmap( iconSize, iconMode, iconState ); | ||
4440 | drawItemPixmap( painter, iconRect, Qt::AlignCenter, pixmap ); | 4432 | drawItemPixmap( painter, iconRect, Qt::AlignCenter, pixmap ); | ||
4441 | 4433 | | |||
4442 | } | 4434 | } | ||
4443 | 4435 | | |||
4444 | // render text | 4436 | // render text | ||
4445 | if( hasText && textRect.isValid() ) | 4437 | if( hasText && textRect.isValid() ) | ||
4446 | { | 4438 | { | ||
4447 | 4439 | | |||
4448 | QPalette::ColorRole textRole( QPalette::ButtonText ); | 4440 | QPalette::ColorRole textRole( QPalette::ButtonText ); | ||
4449 | if( flat ) textRole = ( ((hasFocus&&sunken) || (state & State_Sunken))&&!mouseOver) ? QPalette::HighlightedText: QPalette::WindowText; | 4441 | if( flat ) textRole = ( ((hasFocus&&sunken) || (state & State_Sunken))&&!mouseOver) ? | ||
4450 | else if( hasFocus&&!mouseOver ) textRole = QPalette::HighlightedText; | 4442 | QPalette::HighlightedText : QPalette::WindowText; | ||
4451 | 4443 | | |||
4452 | painter->setFont(toolButtonOption->font); | 4444 | painter->setFont(toolButtonOption->font); | ||
4453 | drawItemText( painter, textRect, textFlags, palette, enabled, toolButtonOption->text, textRole ); | 4445 | drawItemText( painter, textRect, textFlags, palette, enabled, toolButtonOption->text, textRole ); | ||
4454 | 4446 | | |||
4455 | } | 4447 | } | ||
4456 | 4448 | | |||
4457 | return true; | 4449 | return true; | ||
4458 | 4450 | | |||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 4520 | { | |||
4539 | const bool flat( !comboBoxOption->frame ); | 4531 | const bool flat( !comboBoxOption->frame ); | ||
4540 | 4532 | | |||
4541 | QPalette::ColorRole textRole; | 4533 | QPalette::ColorRole textRole; | ||
4542 | if( flat ) { | 4534 | if( flat ) { | ||
4543 | 4535 | | |||
4544 | if( hasFocus && sunken ) textRole = QPalette::HighlightedText; | 4536 | if( hasFocus && sunken ) textRole = QPalette::HighlightedText; | ||
4545 | else textRole = QPalette::WindowText; | 4537 | else textRole = QPalette::WindowText; | ||
4546 | 4538 | | |||
4547 | } else if( hasFocus ) textRole = QPalette::HighlightedText; | 4539 | } else textRole = QPalette::ButtonText; | ||
4548 | else textRole = QPalette::ButtonText; | | |||
4549 | 4540 | | |||
4550 | // change pen color directly | 4541 | // change pen color directly | ||
4551 | painter->setPen( QPen( option->palette.color( textRole ), 1 ) ); | 4542 | painter->setPen( QPen( option->palette.color( textRole ), 1 ) ); | ||
4552 | 4543 | | |||
4553 | // translate painter for pressed down comboboxes | | |||
4554 | if( sunken && !flat ) | | |||
4555 | { painter->translate( 1, 1 ); } | | |||
4556 | | ||||
4557 | #if QT_VERSION >= 0x050000 | 4544 | #if QT_VERSION >= 0x050000 | ||
4558 | if (const auto cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) | 4545 | if (const auto cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) | ||
4559 | { | 4546 | { | ||
4560 | auto editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); | 4547 | auto editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); | ||
4561 | painter->save(); | 4548 | painter->save(); | ||
4562 | painter->setClipRect(editRect); | 4549 | painter->setClipRect(editRect); | ||
4563 | if (!cb->currentIcon.isNull()) { | 4550 | if (!cb->currentIcon.isNull()) { | ||
4564 | QIcon::Mode mode; | 4551 | QIcon::Mode mode; | ||
4565 | 4552 | | |||
4566 | if ((cb->state & QStyle::State_Selected) && (cb->state & QStyle::State_Active)) { | 4553 | /*if ((cb->state & QStyle::State_Selected) && (cb->state & QStyle::State_Active)) { | ||
4567 | mode = QIcon::Selected; | 4554 | mode = QIcon::Selected; | ||
4568 | } else if (cb->state & QStyle::State_Enabled) { | 4555 | } else */if (cb->state & QStyle::State_Enabled) { | ||
4569 | mode = QIcon::Normal; | 4556 | mode = QIcon::Normal; | ||
4570 | } else { | 4557 | } else { | ||
4571 | mode = QIcon::Disabled; | 4558 | mode = QIcon::Disabled; | ||
4572 | } | 4559 | } | ||
4573 | 4560 | | |||
4574 | QWindow *window = nullptr; | 4561 | QWindow *window = nullptr; | ||
4575 | if (widget && widget->window()) { | 4562 | if (widget && widget->window()) { | ||
4576 | window = widget->window()->windowHandle(); | 4563 | window = widget->window()->windowHandle(); | ||
▲ Show 20 Lines • Show All 1502 Lines • ▼ Show 20 Line(s) | 6013 | { | |||
6079 | 6066 | | |||
6080 | // arrow | 6067 | // arrow | ||
6081 | if( hasPopupMenu ) | 6068 | if( hasPopupMenu ) | ||
6082 | { | 6069 | { | ||
6083 | 6070 | | |||
6084 | copy.rect = menuRect; | 6071 | copy.rect = menuRect; | ||
6085 | if( !flat ) drawPrimitive( PE_IndicatorButtonDropDown, ©, painter, widget ); | 6072 | if( !flat ) drawPrimitive( PE_IndicatorButtonDropDown, ©, painter, widget ); | ||
6086 | 6073 | | |||
6087 | if( sunken && !flat ) copy.rect.translate( 1, 1 ); | | |||
6088 | drawPrimitive( PE_IndicatorArrowDown, ©, painter, widget ); | 6074 | drawPrimitive( PE_IndicatorArrowDown, ©, painter, widget ); | ||
6089 | 6075 | | |||
6090 | } else if( hasInlineIndicator ) { | 6076 | } else if( hasInlineIndicator ) { | ||
6091 | 6077 | | |||
6092 | copy.rect = menuRect; | 6078 | copy.rect = menuRect; | ||
6093 | 6079 | | |||
6094 | if( sunken && !flat ) copy.rect.translate( 1, 1 ); | 6080 | if( sunken && !flat ) copy.rect.translate( 1, 1 ); | ||
6095 | drawIndicatorArrowPrimitive( ArrowDown_Small, ©, painter, widget ); | 6081 | drawIndicatorArrowPrimitive( ArrowDown_Small, ©, painter, widget ); | ||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | 6176 | if( flat ) { | |||
6192 | // define colors and render | 6178 | // define colors and render | ||
6193 | const auto color( _helper->toolButtonColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | 6179 | const auto color( _helper->toolButtonColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
6194 | _helper->renderToolButtonFrame( painter, rect, color, sunken ); | 6180 | _helper->renderToolButtonFrame( painter, rect, color, sunken ); | ||
6195 | 6181 | | |||
6196 | } else { | 6182 | } else { | ||
6197 | 6183 | | |||
6198 | // define colors | 6184 | // define colors | ||
6199 | const auto shadow( _helper->shadowColor( palette ) ); | 6185 | const auto shadow( _helper->shadowColor( palette ) ); | ||
6200 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); | 6186 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
6201 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, false, opacity, mode ) ); | 6187 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, false, opacity, mode ) ); | ||
6202 | 6188 | | |||
6203 | // render | 6189 | // render | ||
6204 | _helper->renderButtonFrame( painter, rect, background, outline, shadow, hasFocus, sunken ); | 6190 | _helper->renderButton( painter, rect, background, outline, shadow, hasFocus, sunken ); | ||
6205 | 6191 | | |||
6206 | } | 6192 | } | ||
6207 | 6193 | | |||
6208 | } | 6194 | } | ||
6209 | 6195 | | |||
6210 | } | 6196 | } | ||
6211 | 6197 | | |||
6212 | // arrow | 6198 | // arrow | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 6200 | { | |||
6256 | 6242 | | |||
6257 | } else if( empty || !enabled ) arrowColor = _helper->arrowColor( palette, QPalette::Disabled, QPalette::ButtonText ); | 6243 | } else if( empty || !enabled ) arrowColor = _helper->arrowColor( palette, QPalette::Disabled, QPalette::ButtonText ); | ||
6258 | else if( hasFocus && !mouseOver ) arrowColor = palette.color( QPalette::HighlightedText ); | 6244 | else if( hasFocus && !mouseOver ) arrowColor = palette.color( QPalette::HighlightedText ); | ||
6259 | else arrowColor = _helper->arrowColor( palette, QPalette::ButtonText ); | 6245 | else arrowColor = _helper->arrowColor( palette, QPalette::ButtonText ); | ||
6260 | 6246 | | |||
6261 | // arrow rect | 6247 | // arrow rect | ||
6262 | auto arrowRect( subControlRect( CC_ComboBox, option, SC_ComboBoxArrow, widget ) ); | 6248 | auto arrowRect( subControlRect( CC_ComboBox, option, SC_ComboBoxArrow, widget ) ); | ||
6263 | 6249 | | |||
6264 | // translate for non editable, non flat, sunken comboboxes | | |||
6265 | if( sunken && !flat && !editable ) arrowRect.translate( 1, 1 ); | | |||
6266 | | ||||
6267 | // render | 6250 | // render | ||
6268 | _helper->renderArrow( painter, arrowRect, arrowColor, ArrowDown ); | 6251 | _helper->renderArrow( painter, arrowRect, arrowColor, ArrowDown ); | ||
6269 | 6252 | | |||
6270 | } | 6253 | } | ||
6271 | 6254 | | |||
6272 | return true; | 6255 | return true; | ||
6273 | 6256 | | |||
6274 | } | 6257 | } | ||
▲ Show 20 Lines • Show All 988 Lines • Show Last 20 Lines |