changeset 23 | 89e065397ea6 |
parent 22 | 79de32ba3296 |
child 25 | e24348a560a6 |
22:79de32ba3296 | 23:89e065397ea6 |
---|---|
90 |
90 |
91 static const qreal goldenRatio = 1.618; |
91 static const qreal goldenRatio = 1.618; |
92 |
92 |
93 const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { |
93 const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { |
94 // *** generated layout data *** |
94 // *** generated layout data *** |
95 {240,320,1,17,"QVGA Landscape"}, |
95 {240,320,1,18,"QVGA Landscape"}, |
96 {320,240,1,17,"QVGA Portrait"}, |
96 {320,240,1,18,"QVGA Portrait"}, |
97 {360,640,1,17,"NHD Landscape"}, |
97 {360,640,1,18,"NHD Landscape"}, |
98 {640,360,1,17,"NHD Portrait"}, |
98 {640,360,1,18,"NHD Portrait"}, |
99 {352,800,1,12,"E90 Landscape"} |
99 {352,800,1,12,"E90 Landscape"} |
100 // *** End of generated data *** |
100 // *** End of generated data *** |
101 }; |
101 }; |
102 const int QS60StylePrivate::m_numberOfLayouts = |
102 const int QS60StylePrivate::m_numberOfLayouts = |
103 (int)sizeof(QS60StylePrivate::m_layoutHeaders)/sizeof(QS60StylePrivate::m_layoutHeaders[0]); |
103 (int)sizeof(QS60StylePrivate::m_layoutHeaders)/sizeof(QS60StylePrivate::m_layoutHeaders[0]); |
104 |
104 |
105 const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { |
105 const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { |
106 // *** generated pixel metrics *** |
106 // *** generated pixel metrics *** |
107 {5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,0,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1, 106}, |
107 {5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1, 106}, |
108 {5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,0,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1, 106}, |
108 {5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1, 106}, |
109 {7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,0,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, |
109 {7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, |
110 {7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,0,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, |
110 {7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, |
111 {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,0,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1, 106} |
111 {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1, 106} |
112 // *** End of generated data *** |
112 // *** End of generated data *** |
113 }; |
113 }; |
114 |
114 |
115 const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; |
115 const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; |
116 |
116 |
648 } else if (qobject_cast<QHeaderView *>(widget)){ |
648 } else if (qobject_cast<QHeaderView *>(widget)){ |
649 fontCategory = QS60StyleEnums::FC_Secondary; |
649 fontCategory = QS60StyleEnums::FC_Secondary; |
650 } else if (qobject_cast<QGroupBox *>(widget)){ |
650 } else if (qobject_cast<QGroupBox *>(widget)){ |
651 fontCategory = QS60StyleEnums::FC_Title; |
651 fontCategory = QS60StyleEnums::FC_Title; |
652 } else if (qobject_cast<QMessageBox *>(widget)){ |
652 } else if (qobject_cast<QMessageBox *>(widget)){ |
653 fontCategory = QS60StyleEnums::FC_Primary; |
|
654 } else if (qobject_cast<QMenu *>(widget)){ |
|
653 fontCategory = QS60StyleEnums::FC_Primary; |
655 fontCategory = QS60StyleEnums::FC_Primary; |
654 } |
656 } |
655 if (fontCategory != QS60StyleEnums::FC_Undefined) { |
657 if (fontCategory != QS60StyleEnums::FC_Undefined) { |
656 const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont) |
658 const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont) |
657 && (widget->font().resolve() & QFont::SizeResolved); |
659 && (widget->font().resolve() & QFont::SizeResolved); |
1742 const int hSpacing = QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing); |
1744 const int hSpacing = QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing); |
1743 QStyleOptionMenuItem optionCheckBox; |
1745 QStyleOptionMenuItem optionCheckBox; |
1744 optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); |
1746 optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); |
1745 optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); |
1747 optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); |
1746 optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); |
1748 optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); |
1749 optionCheckBox.rect.moveCenter(QPoint( |
|
1750 optionCheckBox.rect.center().x(), |
|
1751 menuItem->rect.center().y())); |
|
1747 const int moveByX = optionCheckBox.rect.width() + vSpacing; |
1752 const int moveByX = optionCheckBox.rect.width() + vSpacing; |
1748 if (optionMenuItem.direction == Qt::LeftToRight) { |
1753 if (optionMenuItem.direction == Qt::LeftToRight) { |
1749 textRect.translate(moveByX, 0); |
1754 textRect.translate(moveByX, 0); |
1750 iconRect.translate(moveByX, 0); |
1755 iconRect.translate(moveByX, 0); |
1751 iconRect.setWidth(iconRect.width() + vSpacing); |
1756 iconRect.setWidth(iconRect.width() + vSpacing); |
2422 { |
2427 { |
2423 int metricValue = QS60StylePrivate::pixelMetric(metric); |
2428 int metricValue = QS60StylePrivate::pixelMetric(metric); |
2424 if (metricValue == KNotFound) |
2429 if (metricValue == KNotFound) |
2425 metricValue = QCommonStyle::pixelMetric(metric, option, widget); |
2430 metricValue = QCommonStyle::pixelMetric(metric, option, widget); |
2426 |
2431 |
2432 // Menu scrollers should be set to zero height for combobox popups |
|
2433 if (metric == PM_MenuScrollerHeight && !qobject_cast<const QMenu *>(widget)) |
|
2434 metricValue = 0; |
|
2435 |
|
2427 //if layout direction is mirrored, switch left and right border margins |
2436 //if layout direction is mirrored, switch left and right border margins |
2428 if (option && option->direction == Qt::RightToLeft) { |
2437 if (option && option->direction == Qt::RightToLeft) { |
2429 if (metric == PM_LayoutLeftMargin) |
2438 if (metric == PM_LayoutLeftMargin) |
2430 metricValue = QS60StylePrivate::pixelMetric(PM_LayoutRightMargin); |
2439 metricValue = QS60StylePrivate::pixelMetric(PM_LayoutRightMargin); |
2431 else if (metric == PM_LayoutRightMargin) |
2440 else if (metric == PM_LayoutRightMargin) |
2481 sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); |
2490 sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); |
2482 if (naviPaneSize.height() > sz.height()) |
2491 if (naviPaneSize.height() > sz.height()) |
2483 sz.setHeight(naviPaneSize.height()); |
2492 sz.setHeight(naviPaneSize.height()); |
2484 } |
2493 } |
2485 break; |
2494 break; |
2495 case CT_MenuItem: |
|
2486 case CT_ItemViewItem: |
2496 case CT_ItemViewItem: |
2497 if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { |
|
2498 if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { |
|
2499 sz = QSize(); |
|
2500 break; |
|
2501 } |
|
2502 } |
|
2487 sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); |
2503 sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); |
2488 if (QS60StylePrivate::isTouchSupported()) |
2504 if (QS60StylePrivate::isTouchSupported()) |
2489 //Make itemview easier to use in touch devices |
2505 //Make itemview easier to use in touch devices |
2490 //QCommonStyle does not adjust height with horizontal margin, it only adjusts width |
2506 //QCommonStyle does not adjust height with horizontal margin, it only adjusts width |
2491 sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); |
2507 sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); |
2560 break; |
2576 break; |
2561 case SH_Menu_Scrollable: |
2577 case SH_Menu_Scrollable: |
2562 retValue = true; |
2578 retValue = true; |
2563 break; |
2579 break; |
2564 case SH_Menu_SelectionWrap: |
2580 case SH_Menu_SelectionWrap: |
2581 retValue = true; |
|
2582 break; |
|
2583 case SH_Menu_MouseTracking: |
|
2565 retValue = true; |
2584 retValue = true; |
2566 break; |
2585 break; |
2567 case SH_ItemView_ShowDecorationSelected: |
2586 case SH_ItemView_ShowDecorationSelected: |
2568 retValue = true; |
2587 retValue = true; |
2569 break; |
2588 break; |
3148 } |
3167 } |
3149 break; |
3168 break; |
3150 #ifdef QT_KEYPAD_NAVIGATION |
3169 #ifdef QT_KEYPAD_NAVIGATION |
3151 case QEvent::FocusIn: |
3170 case QEvent::FocusIn: |
3152 if (QWidget *focusWidget = QApplication::focusWidget()) { |
3171 if (QWidget *focusWidget = QApplication::focusWidget()) { |
3172 |
|
3173 // Menus and combobox popups do not draw focus frame around them |
|
3174 if (qobject_cast<QComboBoxListView *>(focusWidget) || |
|
3175 qobject_cast<QMenu *>(focusWidget)) |
|
3176 break; |
|
3177 |
|
3153 if (!d->m_focusFrame) |
3178 if (!d->m_focusFrame) |
3154 d->m_focusFrame = new QFocusFrame(focusWidget); |
3179 d->m_focusFrame = new QFocusFrame(focusWidget); |
3155 d->m_focusFrame->setWidget(focusWidget); |
3180 d->m_focusFrame->setWidget(focusWidget); |
3156 } else if (d->m_focusFrame) { |
3181 } else if (d->m_focusFrame) { |
3157 d->m_focusFrame->setWidget(0); |
3182 d->m_focusFrame->setWidget(0); |