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 3738 Lines • ▼ Show 20 Line(s) | 3721 | { | |||
---|---|---|---|---|---|
3739 | const State& state( option->state ); | 3739 | const State& state( option->state ); | ||
3740 | const bool mouseOver( ( state & State_MouseOver ) && ( !abstractItemView || abstractItemView->selectionMode() != QAbstractItemView::NoSelection ) ); | 3740 | const bool mouseOver( ( state & State_MouseOver ) && ( !abstractItemView || abstractItemView->selectionMode() != QAbstractItemView::NoSelection ) ); | ||
3741 | const bool selected( state & State_Selected ); | 3741 | const bool selected( state & State_Selected ); | ||
3742 | const bool enabled( state & State_Enabled ); | 3742 | const bool enabled( state & State_Enabled ); | ||
3743 | const bool active( state & State_Active ); | 3743 | const bool active( state & State_Active ); | ||
3744 | 3744 | | |||
3745 | const bool hasCustomBackground = viewItemOption->backgroundBrush.style() != Qt::NoBrush && !( state & State_Selected ); | 3745 | const bool hasCustomBackground = viewItemOption->backgroundBrush.style() != Qt::NoBrush && !( state & State_Selected ); | ||
3746 | const bool hasSolidBackground = !hasCustomBackground || viewItemOption->backgroundBrush.style() == Qt::SolidPattern; | 3746 | const bool hasSolidBackground = !hasCustomBackground || viewItemOption->backgroundBrush.style() == Qt::SolidPattern; | ||
3747 | #if BREEZE_USE_KDE4 | ||||
3747 | const bool hasAlternateBackground( viewItemOption->features & QStyleOptionViewItemV2::Alternate ); | 3748 | const bool hasAlternateBackground( viewItemOption->features & QStyleOptionViewItemV2::Alternate ); | ||
3749 | #else | ||||
3750 | const bool hasAlternateBackground( viewItemOption->features & QStyleOptionViewItem::Alternate ); | ||||
3751 | #endif | ||||
3748 | 3752 | | |||
3749 | // do nothing if no background is to be rendered | 3753 | // do nothing if no background is to be rendered | ||
3750 | if( !( mouseOver || selected || hasCustomBackground || hasAlternateBackground ) ) | 3754 | if( !( mouseOver || selected || hasCustomBackground || hasAlternateBackground ) ) | ||
3751 | { return true; } | 3755 | { return true; } | ||
3752 | 3756 | | |||
3753 | // define color group | 3757 | // define color group | ||
3754 | QPalette::ColorGroup colorGroup; | 3758 | QPalette::ColorGroup colorGroup; | ||
3755 | if( enabled ) colorGroup = active ? QPalette::Active : QPalette::Inactive; | 3759 | if( enabled ) colorGroup = active ? QPalette::Active : QPalette::Inactive; | ||
3756 | else colorGroup = QPalette::Disabled; | 3760 | else colorGroup = QPalette::Disabled; | ||
3757 | 3761 | | |||
3758 | // render alternate background | 3762 | // render alternate background | ||
3759 | if( viewItemOption && ( viewItemOption->features & QStyleOptionViewItemV2::Alternate ) ) | 3763 | if( hasAlternateBackground ) | ||
3760 | { | 3764 | { | ||
3761 | painter->setPen( Qt::NoPen ); | 3765 | painter->setPen( Qt::NoPen ); | ||
3762 | painter->setBrush( palette.brush( colorGroup, QPalette::AlternateBase ) ); | 3766 | painter->setBrush( palette.brush( colorGroup, QPalette::AlternateBase ) ); | ||
3763 | painter->drawRect( rect ); | 3767 | painter->drawRect( rect ); | ||
3764 | } | 3768 | } | ||
3765 | 3769 | | |||
3766 | // stop here if no highlight is needed | 3770 | // stop here if no highlight is needed | ||
3767 | if( !( mouseOver || selected ||hasCustomBackground ) ) | 3771 | if( !( mouseOver || selected ||hasCustomBackground ) ) | ||
▲ Show 20 Lines • Show All 3472 Lines • Show Last 20 Lines |