1092 Q_ASSERT(option); |
1092 Q_ASSERT(option); |
1093 |
1093 |
1094 QColor borderColor = option->palette.background().color().darker(178); |
1094 QColor borderColor = option->palette.background().color().darker(178); |
1095 QColor gradientStartColor = option->palette.button().color().lighter(104); |
1095 QColor gradientStartColor = option->palette.button().color().lighter(104); |
1096 QColor gradientStopColor = option->palette.button().color().darker(105); |
1096 QColor gradientStopColor = option->palette.button().color().darker(105); |
1097 QColor baseGradientStartColor = option->palette.base().color().darker(101); |
|
1098 QColor baseGradientStopColor = option->palette.base().color().darker(106); |
|
1099 QColor highlightedGradientStartColor = option->palette.button().color().lighter(101); |
1097 QColor highlightedGradientStartColor = option->palette.button().color().lighter(101); |
1100 QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85); |
1098 QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85); |
1101 QColor highlightedBaseGradientStartColor = option->palette.base().color(); |
1099 QColor highlightedBaseGradientStartColor = option->palette.base().color(); |
1102 QColor highlightedBaseGradientStopColor = mergedColors(option->palette.base().color().darker(105), option->palette.highlight().color(), 70); |
1100 QColor highlightedBaseGradientStopColor = mergedColors(option->palette.base().color().darker(105), option->palette.highlight().color(), 70); |
1103 QColor highlightedDarkInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 35); |
1101 QColor highlightedDarkInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 35); |
1976 // fill |
1974 // fill |
1977 QRect adjustedRect = fullRect; |
1975 QRect adjustedRect = fullRect; |
1978 QRect gradientRect(adjustedRect.left() + 1, adjustedRect.top() + 1, |
1976 QRect gradientRect(adjustedRect.left() + 1, adjustedRect.top() + 1, |
1979 adjustedRect.right() - adjustedRect.left() - 1, |
1977 adjustedRect.right() - adjustedRect.left() - 1, |
1980 adjustedRect.bottom() - adjustedRect.top() - 1); |
1978 adjustedRect.bottom() - adjustedRect.top() - 1); |
1981 qt_plastique_draw_gradient(painter, gradientRect, baseGradientStartColor, baseGradientStopColor); |
1979 if (option->palette.base().style() == Qt::SolidPattern) { |
|
1980 QColor baseGradientStartColor = option->palette.base().color().darker(101); |
|
1981 QColor baseGradientStopColor = option->palette.base().color().darker(106); |
|
1982 qt_plastique_draw_gradient(painter, gradientRect, baseGradientStartColor, baseGradientStopColor); |
|
1983 } else { |
|
1984 painter->fillRect(gradientRect, option->palette.base()); |
|
1985 } |
1982 // draw "+" or "-" |
1986 // draw "+" or "-" |
1983 painter->setPen(alphaTextColor); |
1987 painter->setPen(alphaTextColor); |
1984 painter->drawLine(center.x() - 2, center.y(), center.x() + 2, center.y()); |
1988 painter->drawLine(center.x() - 2, center.y(), center.x() + 2, center.y()); |
1985 if (!(option->state & State_Open)) |
1989 if (!(option->state & State_Open)) |
1986 painter->drawLine(center.x(), center.y() - 2, center.x(), center.y() + 2); |
1990 painter->drawLine(center.x(), center.y() - 2, center.x(), center.y() + 2); |
5025 break; |
5029 break; |
5026 #endif |
5030 #endif |
5027 case CT_MenuItem: |
5031 case CT_MenuItem: |
5028 if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { |
5032 if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { |
5029 if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) |
5033 if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) |
5030 newSize.setHeight(menuItem->text.isEmpty() ? 2 : menuItem->fontMetrics.lineSpacing()); |
5034 newSize.setHeight(menuItem->text.isEmpty() ? 2 : menuItem->fontMetrics.height()); |
5031 } |
5035 } |
5032 break; |
5036 break; |
5033 case CT_MenuBarItem: |
5037 case CT_MenuBarItem: |
5034 newSize.setHeight(newSize.height()); |
5038 newSize.setHeight(newSize.height()); |
5035 break; |
5039 break; |
5512 switch (metric) { |
5516 switch (metric) { |
5513 case PM_MenuVMargin: |
5517 case PM_MenuVMargin: |
5514 case PM_MenuHMargin: |
5518 case PM_MenuHMargin: |
5515 ret = 0; |
5519 ret = 0; |
5516 break; |
5520 break; |
5517 case PM_ToolBarIconSize: |
|
5518 ret = 24; |
|
5519 break; |
|
5520 case PM_ButtonShiftHorizontal: |
5521 case PM_ButtonShiftHorizontal: |
5521 case PM_ButtonShiftVertical: |
5522 case PM_ButtonShiftVertical: |
5522 ret = 1; |
5523 ret = 1; |
5523 break; |
5524 break; |
5524 case PM_ButtonDefaultIndicator: |
5525 case PM_ButtonDefaultIndicator: |
5605 break; |
5606 break; |
5606 case PM_TitleBarHeight: |
5607 case PM_TitleBarHeight: |
5607 #ifdef QT3_SUPPORT |
5608 #ifdef QT3_SUPPORT |
5608 if (widget && widget->inherits("Q3DockWindowTitleBar")) { |
5609 if (widget && widget->inherits("Q3DockWindowTitleBar")) { |
5609 // Q3DockWindow has smaller title bars than QDockWidget |
5610 // Q3DockWindow has smaller title bars than QDockWidget |
5610 ret = qMax(widget->fontMetrics().lineSpacing(), 20); |
5611 ret = qMax(widget->fontMetrics().height(), 20); |
5611 } else |
5612 } else |
5612 #endif |
5613 #endif |
5613 ret = qMax(widget ? widget->fontMetrics().lineSpacing() : |
5614 ret = qMax(widget ? widget->fontMetrics().height() : |
5614 (option ? option->fontMetrics.lineSpacing() : 0), 30); |
5615 (option ? option->fontMetrics.height() : 0), 30); |
5615 break; |
5616 break; |
5616 case PM_MaximumDragDistance: |
5617 case PM_MaximumDragDistance: |
5617 return -1; |
5618 return -1; |
5618 case PM_DockWidgetTitleMargin: |
5619 case PM_DockWidgetTitleMargin: |
5619 return 2; |
5620 return 2; |