Changeset 561 for trunk/src/gui/styles/qmotifstyle.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/styles/qmotifstyle.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 299 299 QCommonStyle::unpolish(widget); 300 300 #ifndef QT_NO_PROGRESSBAR 301 if (qobject_cast<QProgressBar *>(widget)) 301 if (qobject_cast<QProgressBar *>(widget)) { 302 Q_D(QMotifStyle); 302 303 widget->removeEventFilter(this); 304 d->bars.removeAll(static_cast<QProgressBar*>(widget)); 305 } 303 306 #endif 304 307 } … … 384 387 case PE_FrameTabWidget: 385 388 case PE_FrameWindow: 386 qDrawShadePanel(p, opt->rect, opt->palette, QStyle::State_None, p ixelMetric(PM_DefaultFrameWidth));389 qDrawShadePanel(p, opt->rect, opt->palette, QStyle::State_None, proxy()->pixelMetric(PM_DefaultFrameWidth)); 387 390 break; 388 391 case PE_FrameFocusRect: … … 473 476 if ((opt->state & State_Enabled || opt->state & State_On) || !(opt->state & State_AutoRaise)) 474 477 qDrawShadePanel(p, opt->rect, opt->palette, bool(opt->state & (State_Sunken | State_On)), 475 p ixelMetric(PM_DefaultFrameWidth), &fill);478 proxy()->pixelMetric(PM_DefaultFrameWidth), &fill); 476 479 break; } 477 480 … … 488 491 } else { 489 492 qDrawShadePanel(p, opt->rect, opt->palette, !showUp, 490 p ixelMetric(PM_DefaultFrameWidth), &fill);491 } 492 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))493 proxy()->pixelMetric(PM_DefaultFrameWidth), &fill); 494 } 495 if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) 493 496 p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern)); 494 497 break; } … … 543 546 a.translate(opt->rect.x(), opt->rect.y()); 544 547 p->drawPolyline(a); 545 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))548 if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) 546 549 p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern)); 547 550 p->setPen(oldPen); … … 734 737 #undef CTOP 735 738 #undef CBOT 736 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))739 if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) 737 740 p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern)); 738 741 break; } … … 740 743 case PE_IndicatorDockWidgetResizeHandle: { 741 744 const int motifOffset = 10; 742 int sw = p ixelMetric(PM_SplitterWidth);745 int sw = proxy()->pixelMetric(PM_SplitterWidth); 743 746 if (opt->state & State_Horizontal) { 744 747 int yPos = opt->rect.y() + opt->rect.height() / 2; … … 767 770 int posX = opt->rect.x() + (opt->rect.width() - markW) / 2 - 1; 768 771 int posY = opt->rect.y() + (opt->rect.height() - markH) / 2; 769 int dfw = p ixelMetric(PM_DefaultFrameWidth);772 int dfw = proxy()->pixelMetric(PM_DefaultFrameWidth); 770 773 771 774 if (dfw < 2) { … … 841 844 else 842 845 handleOpt.state |= State_Horizontal; 843 drawPrimitive(PE_IndicatorDockWidgetResizeHandle, &handleOpt, p, widget);846 proxy()->drawPrimitive(PE_IndicatorDockWidgetResizeHandle, &handleOpt, p, widget); 844 847 break; } 845 848 … … 853 856 QStyleOption arrowOpt = *opt; 854 857 arrowOpt.state |= State_Enabled; 855 drawPrimitive(pe, &arrowOpt, p, widget);856 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) {857 int fw = p ixelMetric(PM_DefaultFrameWidth);858 proxy()->drawPrimitive(pe, &arrowOpt, p, widget); 859 if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) { 860 int fw = proxy()->pixelMetric(PM_DefaultFrameWidth); 858 861 p->fillRect(opt->rect.adjusted(fw, fw, -fw, -fw), QBrush(p->background().color(), Qt::Dense5Pattern)); 859 862 } … … 871 874 p->save(); 872 875 p->setBrushOrigin(bevelOpt.rect.topLeft()); 873 drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);876 proxy()->drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget); 874 877 p->restore(); 875 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))878 if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) 876 879 p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern)); 877 880 break; } … … 884 887 subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator 885 888 : SE_CheckBoxIndicator, btn, widget); 886 drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,889 proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, 887 890 &subopt, p, widget); 888 891 subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents 889 892 : SE_CheckBoxContents, btn, widget); 890 drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);893 proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget); 891 894 if ((btn->state & State_HasFocus) && (!focus || !focus->isVisible())) { 892 895 QStyleOptionFocusRect fropt; … … 894 897 fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect 895 898 : SE_CheckBoxFocusRect, btn, widget); 896 drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);899 proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); 897 900 } 898 901 } … … 900 903 case CE_PushButton: 901 904 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { 902 drawControl(CE_PushButtonBevel, btn, p, widget);905 proxy()->drawControl(CE_PushButtonBevel, btn, p, widget); 903 906 QStyleOptionButton subopt = *btn; 904 907 subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); 905 drawControl(CE_PushButtonLabel, &subopt, p, widget);908 proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget); 906 909 if ((btn->state & State_HasFocus) && (!focus || !focus->isVisible())) { 907 910 QStyleOptionFocusRect fropt; 908 911 fropt.QStyleOption::operator=(*btn); 909 912 fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); 910 drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);913 proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); 911 914 } 912 915 } … … 917 920 p->setPen(opt->palette.foreground().color()); 918 921 p->setBrush(QBrush(opt->palette.button().color(), Qt::NoBrush)); 919 diw = p ixelMetric(PM_ButtonDefaultIndicator);922 diw = proxy()->pixelMetric(PM_ButtonDefaultIndicator); 920 923 opt->rect.getCoords(&x1, &y1, &x2, &y2); 921 924 if (btn->features & (QStyleOptionButton::AutoDefaultButton|QStyleOptionButton::DefaultButton)) { … … 946 949 newOpt.rect = QRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1); 947 950 p->setBrushOrigin(p->brushOrigin()); 948 drawPrimitive(PE_PanelButtonCommand, &newOpt, p, widget);951 proxy()->drawPrimitive(PE_PanelButtonCommand, &newOpt, p, widget); 949 952 } 950 953 if (btn->features & QStyleOptionButton::HasMenu) { 951 int mbi = p ixelMetric(PM_MenuButtonIndicator, btn, widget);954 int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget); 952 955 QRect ir = btn->rect; 953 956 QStyleOptionButton newBtn = *btn; 954 957 newBtn.rect = QRect(ir.right() - mbi - 3, ir.y() + 4, mbi, ir.height() - 8); 955 drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);958 proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); 956 959 } 957 960 break; … … 961 964 case CE_TabBarTabShape: 962 965 if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { 963 const int default_frame = p ixelMetric(PM_DefaultFrameWidth, tab, widget);966 const int default_frame = proxy()->pixelMetric(PM_DefaultFrameWidth, tab, widget); 964 967 const int frame_offset = (default_frame > 1) ? 1 : 0; 965 968 … … 1079 1082 p->setTransform(m, true); 1080 1083 } 1081 const int unit_width = p ixelMetric(PM_ProgressBarChunkWidth, opt, widget);1084 const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt, widget); 1082 1085 int u = rect.width() / unit_width; 1083 1086 int p_v = pb->progress - pb->minimum; … … 1148 1151 p->setFont(menuitem->font); 1149 1152 p->fillRect(x, y, w, h, opt->palette.brush(QPalette::Button)); 1150 drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,1153 proxy()->drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, 1151 1154 menuitem->palette, menuitem->state & State_Enabled, menuitem->text, 1152 1155 QPalette::Text); 1153 1156 textWidth = menuitem->fontMetrics.width(menuitem->text) + 10; 1154 y += menuitem->fontMetrics. lineSpacing() / 2;1157 y += menuitem->fontMetrics.height() / 2; 1155 1158 p->setFont(oldFont); 1156 1159 } … … 1218 1221 if (menuitem->checkType & QStyleOptionMenuItem::Exclusive) { 1219 1222 newMenuItem.rect.setRect(xvis + 2, y + motifItemFrame + mh / 4, 11, 11); 1220 drawPrimitive(PE_IndicatorRadioButton, &newMenuItem, p, widget);1223 proxy()->drawPrimitive(PE_IndicatorRadioButton, &newMenuItem, p, widget); 1221 1224 } else { 1222 1225 newMenuItem.rect.setRect(xvis + 5, y + motifItemFrame + mh / 4, 9, 9); 1223 drawPrimitive(PE_IndicatorCheckBox, &newMenuItem, p, widget);1226 proxy()->drawPrimitive(PE_IndicatorCheckBox, &newMenuItem, p, widget); 1224 1227 } 1225 1228 } … … 1256 1259 QRect tr(xv, y+m, menuitem->tabWidth, h-2*m); 1257 1260 p->drawText(tr, text_flags, s.mid(t+1)); 1258 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))1261 if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) 1259 1262 p->fillRect(tr, QBrush(p->background().color(), Qt::Dense5Pattern)); 1260 1263 s = s.left(t); … … 1263 1266 p->drawText(tr, text_flags, s.left(t)); 1264 1267 p->setFont(oldFont); 1265 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))1268 if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) 1266 1269 p->fillRect(tr, QBrush(p->background().color(), Qt::Dense5Pattern)); 1267 1270 } … … 1277 1280 else 1278 1281 arrowOpt.state = ((opt->state & State_Enabled) ? State_Enabled : State_None); 1279 drawPrimitive(arrow, &arrowOpt, p, widget);1282 proxy()->drawPrimitive(arrow, &arrowOpt, p, widget); 1280 1283 } 1281 1284 break; } … … 1294 1297 p->setBrushOrigin(opt->rect.topLeft()); 1295 1298 qDrawShadePanel(p, opt->rect, opt->palette, bool(opt->state & (State_Sunken|State_On)), 1296 p ixelMetric(PM_DefaultFrameWidth),1299 proxy()->pixelMetric(PM_DefaultFrameWidth), 1297 1300 &opt->palette.brush((opt->state & State_Sunken) ? QPalette::Mid : QPalette::Button)); 1298 1301 p->restore(); … … 1429 1432 = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { 1430 1433 QRect button, menuarea; 1431 button = subControlRect(cc, toolbutton, SC_ToolButton, widget);1432 menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);1434 button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget); 1435 menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); 1433 1436 1434 1437 State bflags = toolbutton->state & ~State_Sunken; … … 1451 1454 tool.rect = button; 1452 1455 tool.state = bflags; 1453 drawPrimitive(PE_PanelButtonTool, &tool, p, widget);1456 proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); 1454 1457 } 1455 1458 } … … 1459 1462 fr.QStyleOption::operator=(*toolbutton); 1460 1463 fr.rect = toolbutton->rect.adjusted(3, 3, -3, -3); 1461 drawPrimitive(PE_FrameFocusRect, &fr, p, widget);1464 proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget); 1462 1465 } 1463 1466 QStyleOptionToolButton label = *toolbutton; 1464 1467 label.state = bflags; 1465 int fw = p ixelMetric(PM_DefaultFrameWidth, opt, widget);1468 int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); 1466 1469 label.rect = button.adjusted(fw, fw, -fw, -fw); 1467 drawControl(CE_ToolButtonLabel, &label, p, widget);1470 proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget); 1468 1471 1469 1472 if (toolbutton->subControls & SC_ToolButtonMenu) { … … 1471 1474 tool.state = mflags; 1472 1475 if (mflags & (State_Sunken | State_On | State_Raised)) 1473 drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);1474 drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);1476 proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); 1477 proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget); 1475 1478 } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) { 1476 int mbi = p ixelMetric(PM_MenuButtonIndicator, toolbutton, widget);1479 int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); 1477 1480 QRect ir = toolbutton->rect; 1478 1481 QStyleOptionToolButton newBtn = *toolbutton; 1479 1482 newBtn.rect = QRect(ir.right() + 5 - mbi, ir.height() - mbi + 4, mbi - 6, mbi - 6); 1480 drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);1483 proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); 1481 1484 } 1482 1485 } … … 1489 1492 1490 1493 if (spinbox->frame && (spinbox->subControls & SC_SpinBoxFrame)) { 1491 QRect r = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxFrame, widget);1492 qDrawShadePanel(p, r, opt->palette, false, p ixelMetric(PM_SpinBoxFrameWidth));1493 1494 int fw = p ixelMetric(QStyle::PM_DefaultFrameWidth);1495 r = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxEditField, widget).adjusted(-fw,-fw,fw,fw);1494 QRect r = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxFrame, widget); 1495 qDrawShadePanel(p, r, opt->palette, false, proxy()->pixelMetric(PM_SpinBoxFrameWidth)); 1496 1497 int fw = proxy()->pixelMetric(QStyle::PM_DefaultFrameWidth); 1498 r = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxEditField, widget).adjusted(-fw,-fw,fw,fw); 1496 1499 QStyleOptionFrame lineOpt; 1497 1500 lineOpt.QStyleOption::operator=(*opt); … … 1500 1503 lineOpt.midLineWidth = 0; 1501 1504 lineOpt.state |= QStyle::State_Sunken; 1502 drawPrimitive(QStyle::PE_FrameLineEdit, &lineOpt, p, widget);1505 proxy()->drawPrimitive(QStyle::PE_FrameLineEdit, &lineOpt, p, widget); 1503 1506 } 1504 1507 … … 1523 1526 : PE_IndicatorSpinUp); 1524 1527 1525 copy.rect = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxUp, widget);1526 drawPrimitive(pe, ©, p, widget);1528 copy.rect = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxUp, widget); 1529 proxy()->drawPrimitive(pe, ©, p, widget); 1527 1530 } 1528 1531 … … 1547 1550 : PE_IndicatorSpinDown); 1548 1551 1549 copy.rect = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxDown, widget);1550 drawPrimitive(pe, ©, p, widget);1552 copy.rect = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxDown, widget); 1553 proxy()->drawPrimitive(pe, ©, p, widget); 1551 1554 } 1552 1555 } … … 1556 1559 case CC_Slider: 1557 1560 if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { 1558 QRect groove = subControlRect(CC_Slider, opt, SC_SliderGroove, widget),1559 handle = subControlRect(CC_Slider, opt, SC_SliderHandle, widget);1561 QRect groove = proxy()->subControlRect(CC_Slider, opt, SC_SliderGroove, widget), 1562 handle = proxy()->subControlRect(CC_Slider, opt, SC_SliderHandle, widget); 1560 1563 1561 1564 if ((opt->subControls & SC_SliderGroove) && groove.isValid()) { 1562 qDrawShadePanel(p, groove, opt->palette, true, p ixelMetric(PM_DefaultFrameWidth),1565 qDrawShadePanel(p, groove, opt->palette, true, proxy()->pixelMetric(PM_DefaultFrameWidth), 1563 1566 &opt->palette.brush((opt->state & State_Enabled) ? QPalette::Mid : QPalette::Window)); 1564 1567 if ((opt->state & State_HasFocus) && (!focus || !focus->isVisible())) { 1565 1568 QStyleOption focusOpt = *opt; 1566 1569 focusOpt.rect = subElementRect(SE_SliderFocusRect, opt, widget); 1567 drawPrimitive(PE_FrameFocusRect, &focusOpt, p, widget);1570 proxy()->drawPrimitive(PE_FrameFocusRect, &focusOpt, p, widget); 1568 1571 } 1569 1572 } … … 1575 1578 p->save(); 1576 1579 p->setBrushOrigin(bevelOpt.rect.topLeft()); 1577 drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);1580 proxy()->drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget); 1578 1581 p->restore(); 1579 1582 … … 1587 1590 true, 1); 1588 1591 } 1589 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))1592 if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) 1590 1593 p->fillRect(handle, QBrush(p->background().color(), Qt::Dense5Pattern)); 1591 1594 } … … 1594 1597 QStyleOptionSlider tmpSlider = *slider; 1595 1598 tmpSlider.subControls = SC_SliderTickmarks; 1596 int frameWidth = p ixelMetric(PM_DefaultFrameWidth);1599 int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth); 1597 1600 tmpSlider.rect.translate(frameWidth - 1, 0); 1598 1601 QCommonStyle::drawComplexControl(cc, &tmpSlider, p, widget); … … 1605 1608 if (opt->subControls & SC_ComboBoxArrow) { 1606 1609 int awh, ax, ay, sh, sy, dh, ew; 1607 int fw = cb->frame ? p ixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;1610 int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; 1608 1611 1609 1612 if (cb->frame) { … … 1611 1614 btn.QStyleOption::operator=(*cb); 1612 1615 btn.state |= QStyle::State_Raised; 1613 drawPrimitive(PE_PanelButtonCommand, &btn, p, widget);1616 proxy()->drawPrimitive(PE_PanelButtonCommand, &btn, p, widget); 1614 1617 } else { 1615 1618 p->fillRect(opt->rect, opt->palette.brush(QPalette::Button)); … … 1625 1628 arrowOpt.rect = ar; 1626 1629 arrowOpt.state |= State_Enabled; 1627 drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);1630 proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); 1628 1631 1629 1632 … … 1641 1644 focus.rect = subElementRect(SE_ComboBoxFocusRect, opt, widget); 1642 1645 focus.backgroundColor = opt->palette.button().color(); 1643 drawPrimitive(PE_FrameFocusRect, &focus, p, widget);1646 proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget); 1644 1647 } 1645 1648 } … … 1647 1650 if (opt->subControls & SC_ComboBoxEditField) { 1648 1651 if (cb->editable) { 1649 QRect er = subControlRect(CC_ComboBox, opt, SC_ComboBoxEditField, widget);1652 QRect er = proxy()->subControlRect(CC_ComboBox, opt, SC_ComboBoxEditField, widget); 1650 1653 er.adjust(-1, -1, 1, 1); 1651 1654 qDrawShadePanel(p, er, opt->palette, true, 1, … … 1661 1664 if (opt->subControls & SC_ScrollBarGroove) 1662 1665 qDrawShadePanel(p, opt->rect, opt->palette, true, 1663 p ixelMetric(PM_DefaultFrameWidth, opt, widget),1666 proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget), 1664 1667 &opt->palette.brush((opt->state & State_Enabled) ? QPalette::Mid : QPalette::Window)); 1665 1668 … … 1796 1799 1797 1800 case PM_ToolBarFrameWidth: 1798 ret = p ixelMetric(PM_DefaultFrameWidth);1801 ret = proxy()->pixelMetric(PM_DefaultFrameWidth); 1799 1802 break; 1800 1803 … … 1817 1820 1818 1821 case PM_SliderThickness: 1819 ret = 16 + 4 * p ixelMetric(PM_DefaultFrameWidth);1822 ret = 16 + 4 * proxy()->pixelMetric(PM_DefaultFrameWidth); 1820 1823 break; 1821 1824 #ifndef QT_NO_SLIDER … … 1847 1850 if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { 1848 1851 if (sl->orientation == Qt::Horizontal) 1849 ret = sl->rect.width() - p ixelMetric(PM_SliderLength, opt, widget) - 2 *pixelMetric(PM_DefaultFrameWidth, opt, widget);1852 ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, opt, widget) - 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); 1850 1853 else 1851 ret = sl->rect.height() - p ixelMetric(PM_SliderLength, opt, widget) - 2 *pixelMetric(PM_DefaultFrameWidth, opt, widget);1854 ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, opt, widget) - 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); 1852 1855 } 1853 1856 break; … … 1899 1902 case CC_SpinBox: 1900 1903 if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { 1901 int fw = spinbox->frame ? p ixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;1904 int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; 1902 1905 QSize bs; 1903 1906 bs.setHeight(opt->rect.height()/2 - fw); … … 1942 1945 if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { 1943 1946 if (sc == SC_SliderHandle) { 1944 int tickOffset = p ixelMetric(PM_SliderTickmarkOffset, opt, widget);1945 int thickness = p ixelMetric(PM_SliderControlThickness, opt, widget);1947 int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, opt, widget); 1948 int thickness = proxy()->pixelMetric(PM_SliderControlThickness, opt, widget); 1946 1949 bool horizontal = slider->orientation == Qt::Horizontal; 1947 int len = p ixelMetric(PM_SliderLength, opt, widget);1948 int motifBorder = p ixelMetric(PM_DefaultFrameWidth);1950 int len = proxy()->pixelMetric(PM_SliderLength, opt, widget); 1951 int motifBorder = proxy()->pixelMetric(PM_DefaultFrameWidth); 1949 1952 int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition, 1950 1953 horizontal ? slider->rect.width() - len - 2 * motifBorder … … 1965 1968 case CC_ScrollBar: 1966 1969 if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { 1967 int dfw = p ixelMetric(PM_DefaultFrameWidth);1970 int dfw = proxy()->pixelMetric(PM_DefaultFrameWidth); 1968 1971 QRect rect = visualRect(scrollbar->direction, scrollbar->rect, 1969 1972 QCommonStyle::subControlRect(cc, scrollbar, sc, widget)); … … 1989 1992 case SC_ComboBoxArrow: { 1990 1993 int ew, awh, sh, dh, ax, ay, sy; 1991 int fw = cb->frame ? p ixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;1994 int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; 1992 1995 QRect cr = opt->rect; 1993 1996 cr.adjust(fw, fw, -fw, -fw); … … 1997 2000 1998 2001 case SC_ComboBoxEditField: { 1999 int fw = cb->frame ? p ixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;2002 int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; 2000 2003 QRect rect = opt->rect; 2001 2004 rect.adjust(fw, fw, -fw, -fw); … … 2027 2030 2028 2031 switch(ct) { 2029 case CT_Splitter:2030 sz = QSize(10, 10);2031 break;2032 2033 2032 case CT_RadioButton: 2034 2033 case CT_CheckBox: … … 2058 2057 if (mi->menuItemType == QStyleOptionMenuItem::Separator) { 2059 2058 w = 10; 2060 h = (mi->text.isEmpty()) ? motifSepHeight : mi->fontMetrics. lineSpacing();2059 h = (mi->text.isEmpty()) ? motifSepHeight : mi->fontMetrics.height(); 2061 2060 } 2062 2061 … … 2117 2116 { 2118 2117 int awh, ax, ay, sh, sy, dh, ew; 2119 int fw = p ixelMetric(PM_DefaultFrameWidth, opt, widget);2118 int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); 2120 2119 QRect tr = opt->rect; 2121 2120 … … 2685 2684 ret = '*'; 2686 2685 break; 2686 case SH_DialogButtonBox_ButtonsHaveIcons: 2687 ret = 0; 2688 break; 2687 2689 default: 2688 2690 ret = QCommonStyle::styleHint(hint, opt, widget, returnData);
Note:
See TracChangeset
for help on using the changeset viewer.