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 2722 Lines • ▼ Show 20 Line(s) | 2720 | { | |||
---|---|---|---|---|---|
2723 | if( showIconsInMenuItems() ) iconWidth = isQtQuickControl( option, widget ) ? qMax( pixelMetric(PM_SmallIconSize, option, widget ), menuItemOption->maxIconWidth ) : menuItemOption->maxIconWidth; | 2723 | if( showIconsInMenuItems() ) iconWidth = isQtQuickControl( option, widget ) ? qMax( pixelMetric(PM_SmallIconSize, option, widget ), menuItemOption->maxIconWidth ) : menuItemOption->maxIconWidth; | ||
2724 | 2724 | | |||
2725 | int leftColumnWidth( iconWidth ); | 2725 | int leftColumnWidth( iconWidth ); | ||
2726 | 2726 | | |||
2727 | // add space with respect to text | 2727 | // add space with respect to text | ||
2728 | leftColumnWidth += Metrics::MenuItem_ItemSpacing; | 2728 | leftColumnWidth += Metrics::MenuItem_ItemSpacing; | ||
2729 | 2729 | | |||
2730 | // add checkbox indicator width | 2730 | // add checkbox indicator width | ||
2731 | if( menuItemOption->menuHasCheckableItems ) | 2731 | leftColumnWidth += Metrics::CheckBox_Size + Metrics::MenuItem_ItemSpacing; | ||
2732 | { leftColumnWidth += Metrics::CheckBox_Size + Metrics::MenuItem_ItemSpacing; } | | |||
2733 | 2732 | | |||
2734 | // add spacing for accelerator | 2733 | // add spacing for accelerator | ||
2735 | /* | 2734 | /* | ||
2736 | * Note: | 2735 | * Note: | ||
2737 | * The width of the accelerator itself is not included here since | 2736 | * The width of the accelerator itself is not included here since | ||
2738 | * Qt will add that on separately after obtaining the | 2737 | * Qt will add that on separately after obtaining the | ||
2739 | * sizeFromContents() for each menu item in the menu to be shown | 2738 | * sizeFromContents() for each menu item in the menu to be shown | ||
2740 | * ( see QMenuPrivate::calcActionRects() ) | 2739 | * ( see QMenuPrivate::calcActionRects() ) | ||
▲ Show 20 Lines • Show All 1952 Lines • ▼ Show 20 Line(s) | 4628 | { | |||
4693 | } | 4692 | } | ||
4694 | 4693 | | |||
4695 | // get rect available for contents | 4694 | // get rect available for contents | ||
4696 | auto contentsRect( insideMargin( rect, Metrics::MenuItem_MarginWidth ) ); | 4695 | auto contentsRect( insideMargin( rect, Metrics::MenuItem_MarginWidth ) ); | ||
4697 | 4696 | | |||
4698 | // define relevant rectangles | 4697 | // define relevant rectangles | ||
4699 | // checkbox | 4698 | // checkbox | ||
4700 | QRect checkBoxRect; | 4699 | QRect checkBoxRect; | ||
4701 | if( menuItemOption->menuHasCheckableItems ) | | |||
4702 | { | | |||
4703 | checkBoxRect = QRect( contentsRect.left(), contentsRect.top() + (contentsRect.height()-Metrics::CheckBox_Size)/2, Metrics::CheckBox_Size, Metrics::CheckBox_Size ); | 4700 | checkBoxRect = QRect( contentsRect.left(), contentsRect.top() + (contentsRect.height()-Metrics::CheckBox_Size)/2, Metrics::CheckBox_Size, Metrics::CheckBox_Size ); | ||
4704 | contentsRect.setLeft( checkBoxRect.right() + Metrics::MenuItem_ItemSpacing + 1 ); | 4701 | contentsRect.setLeft( checkBoxRect.right() + Metrics::MenuItem_ItemSpacing + 1 ); | ||
4705 | } | | |||
4706 | 4702 | | |||
4707 | // render checkbox indicator | 4703 | // render checkbox indicator | ||
4708 | if( menuItemOption->checkType == QStyleOptionMenuItem::NonExclusive ) | 4704 | if( menuItemOption->checkType == QStyleOptionMenuItem::NonExclusive ) | ||
4709 | { | 4705 | { | ||
4710 | 4706 | | |||
4711 | checkBoxRect = visualRect( option, checkBoxRect ); | 4707 | checkBoxRect = visualRect( option, checkBoxRect ); | ||
4712 | 4708 | | |||
4713 | // checkbox state | 4709 | // checkbox state | ||
▲ Show 20 Lines • Show All 2428 Lines • Show Last 20 Lines |