Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezestyle.cpp
Context not available. | |||||
2957 | 2957 | | |||
---|---|---|---|---|---|
2958 | // copy palette and rect | 2958 | // copy palette and rect | ||
2959 | const auto& palette( option->palette ); | 2959 | const auto& palette( option->palette ); | ||
2960 | const auto& rect( option->rect ); | 2960 | const auto& rect( option->rect ); | ||
2961 | if(widget) | ||||
2962 | painter->setFont(widget->font()); | ||||
2961 | 2963 | | |||
2962 | // detect title widgets | 2964 | // detect title widgets | ||
2963 | const bool isTitleWidget( | 2965 | const bool isTitleWidget( | ||
Context not available. | |||||
3021 | // copy palette and rect | 3023 | // copy palette and rect | ||
3022 | const auto& palette( option->palette ); | 3024 | const auto& palette( option->palette ); | ||
3023 | const auto& rect( option->rect ); | 3025 | const auto& rect( option->rect ); | ||
3024 | 3026 | | |||
3027 | const auto lineEdit = qobject_cast<const QLineEdit*>( widget ); | ||||
3028 | if(lineEdit) | ||||
3029 | painter->setFont(lineEdit->font()); | ||||
3030 | | ||||
3025 | // make sure there is enough room to render frame | 3031 | // make sure there is enough room to render frame | ||
3026 | if( rect.height() < 2*Metrics::LineEdit_FrameWidth + option->fontMetrics.height()) | 3032 | if( rect.height() < 2*Metrics::LineEdit_FrameWidth + option->fontMetrics.height()) | ||
3027 | { | 3033 | { | ||
Context not available. | |||||
3055 | _helper->renderFrame( painter, rect, background, outline ); | 3061 | _helper->renderFrame( painter, rect, background, outline ); | ||
3056 | 3062 | | |||
3057 | } | 3063 | } | ||
3058 | | ||||
3059 | return true; | 3064 | return true; | ||
3060 | 3065 | | |||
3061 | } | 3066 | } | ||
Context not available. | |||||
3064 | bool Style::drawFrameFocusRectPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3069 | bool Style::drawFrameFocusRectPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3065 | { | 3070 | { | ||
3066 | // no focus indicator on buttons / scrollbars, since it is rendered elsewhere | 3071 | // no focus indicator on buttons / scrollbars, since it is rendered elsewhere | ||
3067 | if ( qobject_cast<const QAbstractButton*>( widget ) || qobject_cast<const QScrollBar*>( widget ) || qobject_cast<const QGroupBox*>( widget ) ) | 3072 | const auto abstractButton = qobject_cast<const QAbstractButton*>( widget ); | ||
3073 | const auto scrollBar = qobject_cast<const QScrollBar*>( widget ) ; | ||||
3074 | const auto groupBox = qobject_cast<const QGroupBox*>( widget ); | ||||
3075 | if ( abstractButton || scrollBar || groupBox ) | ||||
3068 | { return true; } | 3076 | { return true; } | ||
3069 | 3077 | | |||
3070 | // no focus indicator on ComboBox list items | 3078 | // no focus indicator on ComboBox list items | ||
Context not available. | |||||
3089 | painter->setRenderHint( QPainter::Antialiasing, false ); | 3097 | painter->setRenderHint( QPainter::Antialiasing, false ); | ||
3090 | painter->setPen( outlineColor ); | 3098 | painter->setPen( outlineColor ); | ||
3091 | painter->drawLine( QPoint( rect.bottomLeft() - QPoint( 0,1 ) ), QPoint( rect.bottomRight() - QPoint( 0,1 ) ) ); | 3099 | painter->drawLine( QPoint( rect.bottomLeft() - QPoint( 0,1 ) ), QPoint( rect.bottomRight() - QPoint( 0,1 ) ) ); | ||
3100 | | ||||
3101 | //Set font | ||||
3102 | if(abstractButton) | ||||
3103 | painter->setFont(abstractButton->font()); | ||||
3104 | | ||||
3105 | if(scrollBar) | ||||
3106 | painter->setFont(scrollBar->font()); | ||||
3107 | | ||||
3108 | if(groupBox) | ||||
3109 | painter->setFont(groupBox->font()); | ||||
3092 | 3110 | | |||
3093 | return true; | 3111 | return true; | ||
3094 | 3112 | | |||
Context not available. | |||||
3099 | { | 3117 | { | ||
3100 | // only draw frame for (expanded) toolbars and QtQuick controls | 3118 | // only draw frame for (expanded) toolbars and QtQuick controls | ||
3101 | // do nothing for other cases, for which frame is rendered via drawPanelMenuPrimitive | 3119 | // do nothing for other cases, for which frame is rendered via drawPanelMenuPrimitive | ||
3102 | if( qobject_cast<const QToolBar*>( widget ) ) | 3120 | const auto toolBar = qobject_cast<const QToolBar*>( widget ); | ||
3121 | if( toolBar ) | ||||
3103 | { | 3122 | { | ||
3104 | 3123 | | |||
3105 | const auto& palette( option->palette ); | 3124 | const auto& palette( option->palette ); | ||
Context not available. | |||||
3108 | 3127 | | |||
3109 | const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); | 3128 | const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); | ||
3110 | _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); | 3129 | _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); | ||
3130 | | ||||
3131 | painter->setFont(toolBar->font()); | ||||
3111 | 3132 | | |||
3112 | } else if( isQtQuickControl( option, widget ) ) { | 3133 | } else if( isQtQuickControl( option, widget ) ) { | ||
3113 | 3134 | | |||
Context not available. | |||||
3134 | 3155 | | |||
3135 | // no frame for flat groupboxes | 3156 | // no frame for flat groupboxes | ||
3136 | if( frameOption->features & QStyleOptionFrame::Flat ) return true; | 3157 | if( frameOption->features & QStyleOptionFrame::Flat ) return true; | ||
3137 | 3158 | | |||
3138 | // normal frame | 3159 | // normal frame | ||
3139 | const auto& palette( option->palette ); | 3160 | const auto& palette( option->palette ); | ||
3140 | const auto background( _helper->frameBackgroundColor( palette ) ); | 3161 | const auto background( _helper->frameBackgroundColor( palette ) ); | ||
Context not available. | |||||
3147 | 3168 | | |||
3148 | painter->setClipRegion( option->rect ); | 3169 | painter->setClipRegion( option->rect ); | ||
3149 | _helper->renderFrame( painter, option->rect, background, outline ); | 3170 | _helper->renderFrame( painter, option->rect, background, outline ); | ||
3150 | | ||||
3151 | return true; | 3171 | return true; | ||
3152 | 3172 | | |||
3153 | } | 3173 | } | ||
Context not available. | |||||
3214 | const auto background( _helper->frameBackgroundColor( palette ) ); | 3234 | const auto background( _helper->frameBackgroundColor( palette ) ); | ||
3215 | const auto outline( _helper->frameOutlineColor( palette ) ); | 3235 | const auto outline( _helper->frameOutlineColor( palette ) ); | ||
3216 | _helper->renderTabWidgetFrame( painter, rect, background, outline, corners ); | 3236 | _helper->renderTabWidgetFrame( painter, rect, background, outline, corners ); | ||
3217 | 3237 | | |||
3238 | //Widget font | ||||
3239 | if(widget) | ||||
3240 | painter->setFont(widget->font()); | ||||
3241 | | ||||
3218 | return true; | 3242 | return true; | ||
3219 | } | 3243 | } | ||
3220 | 3244 | | |||
Context not available. | |||||
3236 | painter->setBrush( Qt::NoBrush ); | 3260 | painter->setBrush( Qt::NoBrush ); | ||
3237 | painter->setRenderHint( QPainter::Antialiasing, false ); | 3261 | painter->setRenderHint( QPainter::Antialiasing, false ); | ||
3238 | painter->setPen( QPen( outline, 1 ) ); | 3262 | painter->setPen( QPen( outline, 1 ) ); | ||
3263 | | ||||
3264 | | ||||
3239 | 3265 | | |||
3240 | // render | 3266 | // render | ||
3241 | switch( tabOption->shape ) | 3267 | switch( tabOption->shape ) | ||
Context not available. | |||||
3282 | // render frame outline | 3308 | // render frame outline | ||
3283 | const auto outline( _helper->frameOutlineColor( palette, false, selected ) ); | 3309 | const auto outline( _helper->frameOutlineColor( palette, false, selected ) ); | ||
3284 | _helper->renderMenuFrame( painter, rect, QColor(), outline ); | 3310 | _helper->renderMenuFrame( painter, rect, QColor(), outline ); | ||
3285 | 3311 | | |||
3286 | return true; | 3312 | return true; | ||
3287 | 3313 | | |||
3288 | } | 3314 | } | ||
Context not available. | |||||
3370 | 3396 | | |||
3371 | // render | 3397 | // render | ||
3372 | _helper->renderArrow( painter, rect, color, orientation ); | 3398 | _helper->renderArrow( painter, rect, color, orientation ); | ||
3399 | | ||||
3400 | if(widget) | ||||
3401 | painter->setFont(widget->font()); | ||||
3373 | 3402 | | |||
3374 | return true; | 3403 | return true; | ||
3375 | } | 3404 | } | ||
Context not available. | |||||
3410 | const auto buttonOption( qstyleoption_cast< const QStyleOptionButton* >( option ) ); | 3439 | const auto buttonOption( qstyleoption_cast< const QStyleOptionButton* >( option ) ); | ||
3411 | if( !buttonOption ) return true; | 3440 | if( !buttonOption ) return true; | ||
3412 | 3441 | | |||
3442 | //Widget font | ||||
3443 | if(widget) | ||||
3444 | painter->setFont(widget->font()); | ||||
3445 | | ||||
3413 | // rect and palette | 3446 | // rect and palette | ||
3414 | const auto& rect( option->rect ); | 3447 | const auto& rect( option->rect ); | ||
3415 | 3448 | | |||
Context not available. | |||||
3454 | 3487 | | |||
3455 | // render | 3488 | // render | ||
3456 | _helper->renderButtonFrame( painter, rect, background, outline, shadow, hasFocus, sunken ); | 3489 | _helper->renderButtonFrame( painter, rect, background, outline, shadow, hasFocus, sunken ); | ||
3457 | | ||||
3458 | } | 3490 | } | ||
3459 | 3491 | | |||
3492 | | ||||
3460 | return true; | 3493 | return true; | ||
3461 | 3494 | | |||
3462 | } | 3495 | } | ||
Context not available. | |||||
3469 | const auto& palette( option->palette ); | 3502 | const auto& palette( option->palette ); | ||
3470 | auto rect( option->rect ); | 3503 | auto rect( option->rect ); | ||
3471 | 3504 | | |||
3505 | //Widget font | ||||
3506 | if(widget) | ||||
3507 | painter->setFont(widget->font()); | ||||
3508 | | ||||
3472 | // store relevant flags | 3509 | // store relevant flags | ||
3473 | const State& state( option->state ); | 3510 | const State& state( option->state ); | ||
3474 | const bool autoRaise( state & State_AutoRaise ); | 3511 | const bool autoRaise( state & State_AutoRaise ); | ||
Context not available. | |||||
3495 | const auto shadow( _helper->shadowColor( palette ) ); | 3532 | const auto shadow( _helper->shadowColor( palette ) ); | ||
3496 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); | 3533 | const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); | ||
3497 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | 3534 | const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); | ||
3535 | painter->setFont(toolButton->font()); | ||||
3498 | 3536 | | |||
3499 | // adjust frame in case of menu | 3537 | // adjust frame in case of menu | ||
3500 | if( hasPopupMenu ) | 3538 | if( hasPopupMenu ) | ||
Context not available. | |||||
3502 | painter->setClipRect( rect ); | 3540 | painter->setClipRect( rect ); | ||
3503 | rect.adjust( 0, 0, Metrics::Frame_FrameRadius + 2, 0 ); | 3541 | rect.adjust( 0, 0, Metrics::Frame_FrameRadius + 2, 0 ); | ||
3504 | rect = visualRect( option, rect ); | 3542 | rect = visualRect( option, rect ); | ||
3543 | painter->setFont(toolButton->font()); | ||||
3505 | } | 3544 | } | ||
3506 | 3545 | | |||
3507 | // render | 3546 | // render | ||
Context not available. | |||||
3513 | _helper->renderToolButtonFrame( painter, rect, color, sunken ); | 3552 | _helper->renderToolButtonFrame( painter, rect, color, sunken ); | ||
3514 | 3553 | | |||
3515 | } | 3554 | } | ||
3516 | 3555 | | |||
3517 | return true; | 3556 | return true; | ||
3518 | } | 3557 | } | ||
3519 | 3558 | | |||
Context not available. | |||||
3523 | 3562 | | |||
3524 | // copy palette and rect | 3563 | // copy palette and rect | ||
3525 | auto rect( option->rect ); | 3564 | auto rect( option->rect ); | ||
3526 | 3565 | | |||
3527 | // static_cast is safe here since check was already performed in calling function | 3566 | // static_cast is safe here since check was already performed in calling function | ||
3528 | const QTabBar* tabBar( static_cast<QTabBar*>( widget->parentWidget() ) ); | 3567 | const QTabBar* tabBar( static_cast<QTabBar*>( widget->parentWidget() ) ); | ||
3529 | 3568 | | |||
3530 | // overlap. | 3569 | // overlap. | ||
3531 | // subtract 1, because of the empty pixel left the tabwidget frame | 3570 | // subtract 1, because of the empty pixel left the tabwidget frame | ||
3532 | const int overlap( Metrics::TabBar_BaseOverlap - 1 ); | 3571 | const int overlap( Metrics::TabBar_BaseOverlap - 1 ); | ||
Context not available. | |||||
3568 | painter->setPen( Qt::NoPen ); | 3607 | painter->setPen( Qt::NoPen ); | ||
3569 | painter->setBrush( color ); | 3608 | painter->setBrush( color ); | ||
3570 | painter->drawRect( rect ); | 3609 | painter->drawRect( rect ); | ||
3571 | 3610 | painter->setFont(parent->font()); | |||
3572 | return true; | 3611 | return true; | ||
3573 | 3612 | | |||
3574 | } | 3613 | } | ||
Context not available. | |||||
3588 | painter->setBrush( scrollArea->viewport()->palette().color( scrollArea->viewport()->backgroundRole() ) ); | 3627 | painter->setBrush( scrollArea->viewport()->palette().color( scrollArea->viewport()->backgroundRole() ) ); | ||
3589 | painter->setPen( Qt::NoPen ); | 3628 | painter->setPen( Qt::NoPen ); | ||
3590 | painter->drawRect( option->rect ); | 3629 | painter->drawRect( option->rect ); | ||
3630 | painter->setFont(scrollArea->font()); | ||||
3591 | return true; | 3631 | return true; | ||
3592 | 3632 | | |||
3593 | } else { | 3633 | } else { | ||
Context not available. | |||||
3600 | //___________________________________________________________________________________ | 3640 | //___________________________________________________________________________________ | ||
3601 | bool Style::drawPanelMenuPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3641 | bool Style::drawPanelMenuPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3602 | { | 3642 | { | ||
3643 | //Set font | ||||
3644 | if(widget) | ||||
3645 | painter->setFont(widget->font()); | ||||
3603 | /* | 3646 | /* | ||
3604 | * do nothing if menu is embedded in another widget | 3647 | * do nothing if menu is embedded in another widget | ||
3605 | * this corresponds to having a transparent background | 3648 | * this corresponds to having a transparent background | ||
Context not available. | |||||
3616 | } | 3659 | } | ||
3617 | 3660 | | |||
3618 | _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); | 3661 | _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); | ||
3619 | 3662 | painter->setFont(widget->font()); | |||
3620 | return true; | 3663 | return true; | ||
3621 | 3664 | | |||
3622 | } | 3665 | } | ||
Context not available. | |||||
3627 | 3670 | | |||
3628 | // force registration of widget | 3671 | // force registration of widget | ||
3629 | if( widget && widget->window() ) | 3672 | if( widget && widget->window() ) | ||
3630 | { _shadowHelper->registerWidget( widget->window(), true ); } | 3673 | { | ||
3674 | _shadowHelper->registerWidget( widget->window(), true ); | ||||
3675 | //font widget | ||||
3676 | painter->setFont(widget->font()); | ||||
3677 | } | ||||
3631 | 3678 | | |||
3632 | const auto& palette( option->palette ); | 3679 | const auto& palette( option->palette ); | ||
3633 | const auto &background = palette.color( QPalette::ToolTipBase ); | 3680 | const auto &background = palette.color( QPalette::ToolTipBase ); | ||
Context not available. | |||||
3646 | // cast option and check | 3693 | // cast option and check | ||
3647 | const auto viewItemOption = qstyleoption_cast<const QStyleOptionViewItem*>( option ); | 3694 | const auto viewItemOption = qstyleoption_cast<const QStyleOptionViewItem*>( option ); | ||
3648 | if( !viewItemOption ) return false; | 3695 | if( !viewItemOption ) return false; | ||
3696 | else painter->setFont(viewItemOption->font); | ||||
3649 | 3697 | | |||
3650 | // try cast widget | 3698 | // try cast widget | ||
3651 | const auto abstractItemView = qobject_cast<const QAbstractItemView *>( widget ); | 3699 | const auto abstractItemView = qobject_cast<const QAbstractItemView *>( widget ); | ||
3652 | 3700 | if(abstractItemView) | |||
3701 | painter->setFont(abstractItemView->font()); | ||||
3702 | | ||||
3653 | // store palette and rect | 3703 | // store palette and rect | ||
3654 | const auto& palette( option->palette ); | 3704 | const auto& palette( option->palette ); | ||
3655 | auto rect( option->rect ); | 3705 | auto rect( option->rect ); | ||
Context not available. | |||||
3720 | //___________________________________________________________________________________ | 3770 | //___________________________________________________________________________________ | ||
3721 | bool Style::drawIndicatorCheckBoxPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3771 | bool Style::drawIndicatorCheckBoxPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3722 | { | 3772 | { | ||
3723 | 3773 | //Set font | |||
3774 | if(widget) | ||||
3775 | painter->setFont(widget->font()); | ||||
3776 | | ||||
3724 | // copy rect and palette | 3777 | // copy rect and palette | ||
3725 | const auto& rect( option->rect ); | 3778 | const auto& rect( option->rect ); | ||
3726 | const auto& palette( option->palette ); | 3779 | const auto& palette( option->palette ); | ||
Context not available. | |||||
3761 | bool Style::drawIndicatorRadioButtonPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3814 | bool Style::drawIndicatorRadioButtonPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3762 | { | 3815 | { | ||
3763 | 3816 | | |||
3817 | //Set font | ||||
3818 | if(widget) | ||||
3819 | painter->setFont(widget->font()); | ||||
3820 | | ||||
3764 | // copy rect and palette | 3821 | // copy rect and palette | ||
3765 | const auto& rect( option->rect ); | 3822 | const auto& rect( option->rect ); | ||
3766 | const auto& palette( option->palette ); | 3823 | const auto& palette( option->palette ); | ||
Context not available. | |||||
3800 | bool Style::drawIndicatorButtonDropDownPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3857 | bool Style::drawIndicatorButtonDropDownPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3801 | { | 3858 | { | ||
3802 | 3859 | | |||
3860 | //Set font | ||||
3861 | if(widget) | ||||
3862 | painter->setFont(widget->font()); | ||||
3863 | | ||||
3803 | // cast option and check | 3864 | // cast option and check | ||
3804 | const auto toolButtonOption( qstyleoption_cast<const QStyleOptionToolButton*>( option ) ); | 3865 | const auto toolButtonOption( qstyleoption_cast<const QStyleOptionToolButton*>( option ) ); | ||
3805 | if( !toolButtonOption ) return true; | 3866 | if( !toolButtonOption ) return true; | ||
Context not available. | |||||
3857 | bool Style::drawIndicatorTabClosePrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3918 | bool Style::drawIndicatorTabClosePrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3858 | { | 3919 | { | ||
3859 | 3920 | | |||
3921 | //Set font | ||||
3922 | if(widget) | ||||
3923 | painter->setFont(widget->font()); | ||||
3924 | | ||||
3860 | // get icon and check | 3925 | // get icon and check | ||
3861 | QIcon icon( standardIcon( SP_TitleBarCloseButton, option, widget ) ); | 3926 | QIcon icon( standardIcon( SP_TitleBarCloseButton, option, widget ) ); | ||
3862 | if( icon.isNull() ) return false; | 3927 | if( icon.isNull() ) return false; | ||
Context not available. | |||||
3996 | bool Style::drawIndicatorToolBarSeparatorPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 4061 | bool Style::drawIndicatorToolBarSeparatorPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3997 | { | 4062 | { | ||
3998 | 4063 | | |||
4064 | //Set font | ||||
4065 | if(widget) | ||||
4066 | painter->setFont(widget->font()); | ||||
4067 | | ||||
3999 | /* | 4068 | /* | ||
4000 | * do nothing if disabled from options | 4069 | * do nothing if disabled from options | ||
4001 | * also need to check if widget is a combobox, because of Qt hack using 'toolbar' separator primitive | 4070 | * also need to check if widget is a combobox, because of Qt hack using 'toolbar' separator primitive | ||
Context not available. | |||||
4100 | bool Style::drawPushButtonLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 4169 | bool Style::drawPushButtonLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
4101 | { | 4170 | { | ||
4102 | 4171 | | |||
4172 | //Set font | ||||
4173 | if(widget) | ||||
4174 | painter->setFont(widget->font()); | ||||
4175 | | ||||
4103 | // cast option and check | 4176 | // cast option and check | ||
4104 | const auto buttonOption( qstyleoption_cast<const QStyleOptionButton*>( option ) ); | 4177 | const auto buttonOption( qstyleoption_cast<const QStyleOptionButton*>( option ) ); | ||
4105 | if( !buttonOption ) return true; | 4178 | if( !buttonOption ) return true; | ||
Context not available. | |||||
4222 | 4295 | | |||
4223 | // cast option and check | 4296 | // cast option and check | ||
4224 | const auto toolButtonOption( qstyleoption_cast<const QStyleOptionToolButton*>(option) ); | 4297 | const auto toolButtonOption( qstyleoption_cast<const QStyleOptionToolButton*>(option) ); | ||
4225 | 4298 | | |||
4299 | //Set font | ||||
4300 | if(toolButtonOption) | ||||
4301 | painter->setFont(toolButtonOption->font); | ||||
4302 | | ||||
4226 | // copy rect and palette | 4303 | // copy rect and palette | ||
4227 | const auto& rect = option->rect; | 4304 | const auto& rect = option->rect; | ||
4228 | const auto& palette = option->palette; | 4305 | const auto& palette = option->palette; | ||
Context not available. | |||||
4355 | bool Style::drawCheckBoxLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 4432 | bool Style::drawCheckBoxLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
4356 | { | 4433 | { | ||
4357 | 4434 | | |||
4435 | //Set font | ||||
4436 | if(widget) | ||||
4437 | painter->setFont(widget->font()); | ||||
4438 | | ||||
4358 | // cast option and check | 4439 | // cast option and check | ||
4359 | const auto buttonOption( qstyleoption_cast<const QStyleOptionButton*>(option) ); | 4440 | const auto buttonOption( qstyleoption_cast<const QStyleOptionButton*>(option) ); | ||
4360 | if( !buttonOption ) return true; | 4441 | if( !buttonOption ) return true; | ||
Context not available. | |||||
4419 | //___________________________________________________________________________________ | 4500 | //___________________________________________________________________________________ | ||
4420 | bool Style::drawComboBoxLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 4501 | bool Style::drawComboBoxLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
4421 | { | 4502 | { | ||
4503 | //Set font | ||||
4504 | if(widget) | ||||
4505 | painter->setFont(widget->font()); | ||||
4506 | | ||||
4422 | const auto comboBoxOption( qstyleoption_cast<const QStyleOptionComboBox*>( option ) ); | 4507 | const auto comboBoxOption( qstyleoption_cast<const QStyleOptionComboBox*>( option ) ); | ||
4423 | if( !comboBoxOption ) return false; | 4508 | if( !comboBoxOption ) return false; | ||
4424 | if( comboBoxOption->editable ) return false; | 4509 | if( comboBoxOption->editable ) return false; | ||
Context not available. | |||||
4491 | bool Style::drawMenuBarItemControl( const QStyleOption* option, QPainter* painter, const QWidget* widget) const | 4576 | bool Style::drawMenuBarItemControl( const QStyleOption* option, QPainter* painter, const QWidget* widget) const | ||
4492 | { | 4577 | { | ||
4493 | 4578 | | |||
4579 | //Set font | ||||
4580 | if(widget) | ||||
4581 | painter->setFont(widget->font()); | ||||
4582 | | ||||
4494 | // cast option and check | 4583 | // cast option and check | ||
4495 | const auto menuItemOption = qstyleoption_cast<const QStyleOptionMenuItem*>( option ); | 4584 | const auto menuItemOption = qstyleoption_cast<const QStyleOptionMenuItem*>( option ); | ||
4496 | if( !menuItemOption ) return true; | 4585 | if( !menuItemOption ) return true; | ||
Context not available. | |||||
4809 | bool Style::drawProgressBarControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 4898 | bool Style::drawProgressBarControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
4810 | { | 4899 | { | ||
4811 | 4900 | | |||
4901 | //Set font | ||||
4902 | if(widget) | ||||
4903 | painter->setFont(widget->font()); | ||||
4904 | | ||||
4812 | const auto progressBarOption( qstyleoption_cast<const QStyleOptionProgressBar*>( option ) ); | 4905 | const auto progressBarOption( qstyleoption_cast<const QStyleOptionProgressBar*>( option ) ); | ||
4813 | if( !progressBarOption ) return true; | 4906 | if( !progressBarOption ) return true; | ||
4814 | 4907 | | |||
Context not available. | |||||
4958 | bool Style::drawScrollBarSliderControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5051 | bool Style::drawScrollBarSliderControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
4959 | { | 5052 | { | ||
4960 | 5053 | | |||
5054 | //Set font | ||||
5055 | if(widget) | ||||
5056 | painter->setFont(widget->font()); | ||||
5057 | | ||||
4961 | // cast option and check | 5058 | // cast option and check | ||
4962 | const auto sliderOption( qstyleoption_cast<const QStyleOptionSlider*>( option ) ); | 5059 | const auto sliderOption( qstyleoption_cast<const QStyleOptionSlider*>( option ) ); | ||
4963 | if( !sliderOption ) return true; | 5060 | if( !sliderOption ) return true; | ||
Context not available. | |||||
5020 | bool Style::drawScrollBarAddLineControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5117 | bool Style::drawScrollBarAddLineControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
5021 | { | 5118 | { | ||
5022 | 5119 | | |||
5120 | //Set font | ||||
5121 | if(widget) | ||||
5122 | painter->setFont(widget->font()); | ||||
5123 | | ||||
5023 | // do nothing if no buttons are defined | 5124 | // do nothing if no buttons are defined | ||
5024 | if( _addLineButtons == NoButton ) return true; | 5125 | if( _addLineButtons == NoButton ) return true; | ||
5025 | 5126 | | |||
Context not available. | |||||
5102 | bool Style::drawScrollBarSubLineControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5203 | bool Style::drawScrollBarSubLineControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
5103 | { | 5204 | { | ||
5104 | 5205 | | |||
5206 | //Set font | ||||
5207 | if(widget) | ||||
5208 | painter->setFont(widget->font()); | ||||
5209 | | ||||
5105 | // do nothing if no buttons are set | 5210 | // do nothing if no buttons are set | ||
5106 | if( _subLineButtons == NoButton ) return true; | 5211 | if( _subLineButtons == NoButton ) return true; | ||
5107 | 5212 | | |||
Context not available. | |||||
5183 | bool Style::drawShapedFrameControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5288 | bool Style::drawShapedFrameControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
5184 | { | 5289 | { | ||
5185 | 5290 | | |||
5291 | //Set font | ||||
5292 | if(widget) | ||||
5293 | painter->setFont(widget->font()); | ||||
5294 | | ||||
5186 | // cast option and check | 5295 | // cast option and check | ||
5187 | const auto frameOpt = qstyleoption_cast<const QStyleOptionFrame*>( option ); | 5296 | const auto frameOpt = qstyleoption_cast<const QStyleOptionFrame*>( option ); | ||
5188 | if( !frameOpt ) return false; | 5297 | if( !frameOpt ) return false; | ||
Context not available. | |||||
5288 | painter->setBrush( color ); | 5397 | painter->setBrush( color ); | ||
5289 | painter->setPen( Qt::NoPen ); | 5398 | painter->setPen( Qt::NoPen ); | ||
5290 | painter->drawRect( rect ); | 5399 | painter->drawRect( rect ); | ||
5400 | //Set font | ||||
5401 | if(widget) | ||||
5402 | painter->setFont(widget->font()); | ||||
5291 | 5403 | | |||
5292 | // outline | 5404 | // outline | ||
5293 | painter->setBrush( Qt::NoBrush ); | 5405 | painter->setBrush( Qt::NoBrush ); | ||
Context not available. | |||||
5375 | bool Style::drawTabBarTabLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5487 | bool Style::drawTabBarTabLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
5376 | { | 5488 | { | ||
5377 | 5489 | | |||
5490 | //Set font | ||||
5491 | if(widget) | ||||
5492 | painter->setFont(widget->font()); | ||||
5493 | | ||||
5378 | // call parent style method | 5494 | // call parent style method | ||
5379 | ParentStyleClass::drawControl( CE_TabBarTabLabel, option, painter, widget ); | 5495 | ParentStyleClass::drawControl( CE_TabBarTabLabel, option, painter, widget ); | ||
5380 | 5496 | | |||
Context not available. | |||||
5456 | bool Style::drawTabBarTabShapeControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5572 | bool Style::drawTabBarTabShapeControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
5457 | { | 5573 | { | ||
5458 | 5574 | | |||
5575 | //Set font | ||||
5576 | if(widget) | ||||
5577 | painter->setFont(widget->font()); | ||||
5578 | | ||||
5459 | const auto tabOption( qstyleoption_cast<const QStyleOptionTab*>( option ) ); | 5579 | const auto tabOption( qstyleoption_cast<const QStyleOptionTab*>( option ) ); | ||
5460 | if( !tabOption ) return true; | 5580 | if( !tabOption ) return true; | ||
5461 | 5581 | | |||
Context not available. | |||||
5645 | bool Style::drawToolBoxTabLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5765 | bool Style::drawToolBoxTabLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
5646 | { | 5766 | { | ||
5647 | 5767 | | |||
5768 | //Set font | ||||
5769 | if(widget) | ||||
5770 | painter->setFont(widget->font()); | ||||
5771 | | ||||
5648 | // rendering is similar to drawPushButtonLabelControl | 5772 | // rendering is similar to drawPushButtonLabelControl | ||
5649 | // cast option and check | 5773 | // cast option and check | ||
5650 | const auto toolBoxOption( qstyleoption_cast<const QStyleOptionToolBox *>( option ) ); | 5774 | const auto toolBoxOption( qstyleoption_cast<const QStyleOptionToolBox *>( option ) ); | ||
Context not available. | |||||
5723 | bool Style::drawToolBoxTabShapeControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5847 | bool Style::drawToolBoxTabShapeControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
5724 | { | 5848 | { | ||
5725 | 5849 | | |||
5850 | //Set font | ||||
5851 | if(widget) | ||||
5852 | painter->setFont(widget->font()); | ||||
5853 | | ||||
5726 | // cast option and check | 5854 | // cast option and check | ||
5727 | const auto toolBoxOption( qstyleoption_cast<const QStyleOptionToolBox *>( option ) ); | 5855 | const auto toolBoxOption( qstyleoption_cast<const QStyleOptionToolBox *>( option ) ); | ||
5728 | if( !toolBoxOption ) return true; | 5856 | if( !toolBoxOption ) return true; | ||
Context not available. | |||||
5774 | bool Style::drawDockWidgetTitleControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 5902 | bool Style::drawDockWidgetTitleControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
5775 | { | 5903 | { | ||
5776 | 5904 | | |||
5905 | //Set font | ||||
5906 | if(widget) | ||||
5907 | painter->setFont(widget->font()); | ||||
5908 | | ||||
5777 | // cast option and check | 5909 | // cast option and check | ||
5778 | const auto dockWidgetOption = qstyleoption_cast<const QStyleOptionDockWidget*>( option ); | 5910 | const auto dockWidgetOption = qstyleoption_cast<const QStyleOptionDockWidget*>( option ); | ||
5779 | if( !dockWidgetOption ) return true; | 5911 | if( !dockWidgetOption ) return true; | ||
Context not available. | |||||
5842 | bool Style::drawGroupBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | 5974 | bool Style::drawGroupBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | ||
5843 | { | 5975 | { | ||
5844 | 5976 | | |||
5977 | //Set font | ||||
5978 | if(widget) | ||||
5979 | painter->setFont(widget->font()); | ||||
5980 | | ||||
5845 | // base class method | 5981 | // base class method | ||
5846 | ParentStyleClass::drawComplexControl( CC_GroupBox, option, painter, widget ); | 5982 | ParentStyleClass::drawComplexControl( CC_GroupBox, option, painter, widget ); | ||
5847 | 5983 | | |||
Context not available. | |||||
5890 | bool Style::drawToolButtonComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | 6026 | bool Style::drawToolButtonComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | ||
5891 | { | 6027 | { | ||
5892 | 6028 | | |||
6029 | //Set font | ||||
6030 | if(widget) | ||||
6031 | painter->setFont(widget->font()); | ||||
6032 | | ||||
5893 | // cast option and check | 6033 | // cast option and check | ||
5894 | const auto toolButtonOption( qstyleoption_cast<const QStyleOptionToolButton*>( option ) ); | 6034 | const auto toolButtonOption( qstyleoption_cast<const QStyleOptionToolButton*>( option ) ); | ||
5895 | if( !toolButtonOption ) return true; | 6035 | if( !toolButtonOption ) return true; | ||
Context not available. | |||||
6003 | bool Style::drawComboBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | 6143 | bool Style::drawComboBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | ||
6004 | { | 6144 | { | ||
6005 | 6145 | | |||
6146 | //Set font | ||||
6147 | if(widget) | ||||
6148 | painter->setFont(widget->font()); | ||||
6149 | | ||||
6006 | // cast option and check | 6150 | // cast option and check | ||
6007 | const auto comboBoxOption( qstyleoption_cast<const QStyleOptionComboBox*>( option ) ); | 6151 | const auto comboBoxOption( qstyleoption_cast<const QStyleOptionComboBox*>( option ) ); | ||
6008 | if( !comboBoxOption ) return true; | 6152 | if( !comboBoxOption ) return true; | ||
Context not available. | |||||
6142 | bool Style::drawSpinBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | 6286 | bool Style::drawSpinBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | ||
6143 | { | 6287 | { | ||
6144 | 6288 | | |||
6289 | //Set font | ||||
6290 | if(widget) | ||||
6291 | painter->setFont(widget->font()); | ||||
6292 | | ||||
6145 | const auto spinBoxOption( qstyleoption_cast<const QStyleOptionSpinBox*>( option ) ); | 6293 | const auto spinBoxOption( qstyleoption_cast<const QStyleOptionSpinBox*>( option ) ); | ||
6146 | if( !spinBoxOption ) return true; | 6294 | if( !spinBoxOption ) return true; | ||
6147 | 6295 | | |||
Context not available. | |||||
6184 | bool Style::drawSliderComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | 6332 | bool Style::drawSliderComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | ||
6185 | { | 6333 | { | ||
6186 | 6334 | | |||
6335 | //Set font | ||||
6336 | if(widget) | ||||
6337 | painter->setFont(widget->font()); | ||||
6338 | | ||||
6187 | // cast option and check | 6339 | // cast option and check | ||
6188 | const auto sliderOption( qstyleoption_cast<const QStyleOptionSlider*>( option ) ); | 6340 | const auto sliderOption( qstyleoption_cast<const QStyleOptionSlider*>( option ) ); | ||
6189 | if( !sliderOption ) return true; | 6341 | if( !sliderOption ) return true; | ||
Context not available. | |||||
6337 | bool Style::drawDialComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | 6489 | bool Style::drawDialComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | ||
6338 | { | 6490 | { | ||
6339 | 6491 | | |||
6492 | //Set font | ||||
6493 | if(widget) | ||||
6494 | painter->setFont(widget->font()); | ||||
6495 | | ||||
6340 | // cast option and check | 6496 | // cast option and check | ||
6341 | const auto sliderOption( qstyleoption_cast<const QStyleOptionSlider*>( option ) ); | 6497 | const auto sliderOption( qstyleoption_cast<const QStyleOptionSlider*>( option ) ); | ||
6342 | if( !sliderOption ) return true; | 6498 | if( !sliderOption ) return true; | ||
Context not available. | |||||
6419 | //______________________________________________________________ | 6575 | //______________________________________________________________ | ||
6420 | bool Style::drawScrollBarComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | 6576 | bool Style::drawScrollBarComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | ||
6421 | { | 6577 | { | ||
6578 | //Set font | ||||
6579 | if(widget) | ||||
6580 | painter->setFont(widget->font()); | ||||
6581 | | ||||
6422 | //the animation for QStyle::SC_ScrollBarGroove is special: it will animate | 6582 | //the animation for QStyle::SC_ScrollBarGroove is special: it will animate | ||
6423 | //the opacity of everything else as well, included slider and arrows | 6583 | //the opacity of everything else as well, included slider and arrows | ||
6424 | qreal opacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); | 6584 | qreal opacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); | ||
Context not available. | |||||
6475 | bool Style::drawTitleBarComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | 6635 | bool Style::drawTitleBarComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const | ||
6476 | { | 6636 | { | ||
6477 | 6637 | | |||
6638 | //Set font | ||||
6639 | if(widget) | ||||
6640 | painter->setFont(widget->font()); | ||||
6641 | | ||||
6478 | // cast option and check | 6642 | // cast option and check | ||
6479 | const auto titleBarOption( qstyleoption_cast<const QStyleOptionTitleBar *>( option ) ); | 6643 | const auto titleBarOption( qstyleoption_cast<const QStyleOptionTitleBar *>( option ) ); | ||
6480 | if( !titleBarOption ) return true; | 6644 | if( !titleBarOption ) return true; | ||
Context not available. |