Changeset 846 for trunk/src/gui/styles
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 63 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/styles/qcdestyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcdestyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcleanlooksstyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 45 45 #if !defined(QT_NO_STYLE_CLEANLOOKS) || defined(QT_PLUGIN) 46 46 47 #include <private/qstylehelper_p.h>48 47 #include "qwindowsstyle_p.h" 49 48 #include <qcombobox.h> … … 68 67 #include <qwizard.h> 69 68 #include <qlibrary.h> 69 #include <private/qstylehelper_p.h> 70 70 71 71 #define CL_MAX(a,b) (a)>(b) ? (a):(b) // ### qMin/qMax does not work for vc6 … … 885 885 painter->restore(); 886 886 break; 887 #ifndef QT_NO_LINE DIT887 #ifndef QT_NO_LINEEDIT 888 888 case PE_FrameLineEdit: 889 889 // fall through … … 1398 1398 1399 1399 QColor highlight = option->palette.highlight().color(); 1400 QColor highlightText = option->palette.highlightedText().color();1401 1400 1402 1401 switch(element) { … … 2159 2158 2160 2159 if (button->features & QStyleOptionButton::HasMenu) 2161 ir = ir.adjusted(0, 0, -p ixelMetric(PM_MenuButtonIndicator, button, widget), 0);2160 ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0); 2162 2161 proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled), 2163 2162 button->text, QPalette::ButtonText); … … 2724 2723 // Fill title bar gradient 2725 2724 QColor titlebarColor = QColor(active ? highlight: palette.background().color()); 2726 QColor titleBarGradientStop(active ? highlight.darker(150): palette.background().color().darker(120));2727 2725 QLinearGradient gradient(option->rect.center().x(), option->rect.top(), 2728 2726 option->rect.center().x(), option->rect.bottom()); … … 2987 2985 painter->fillRect(option->rect, option->palette.background()); 2988 2986 2989 QRect rect = scrollBar->rect;2990 2987 QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); 2991 2988 QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); … … 3715 3712 int ret = -1; 3716 3713 switch (metric) { 3714 case PM_ToolTipLabelFrameWidth: 3715 ret = 2; 3716 break; 3717 3717 case PM_ButtonDefaultIndicator: 3718 3718 ret = 0; … … 4015 4015 case SC_SliderHandle: { 4016 4016 if (slider->orientation == Qt::Horizontal) { 4017 rect.setHeight(p ixelMetric(PM_SliderThickness));4018 rect.setWidth(p ixelMetric(PM_SliderLength));4017 rect.setHeight(proxy()->pixelMetric(PM_SliderThickness)); 4018 rect.setWidth(proxy()->pixelMetric(PM_SliderLength)); 4019 4019 int centerY = slider->rect.center().y() - rect.height() / 2; 4020 4020 if (slider->tickPosition & QSlider::TicksAbove) … … 4024 4024 rect.moveTop(centerY); 4025 4025 } else { 4026 rect.setWidth(p ixelMetric(PM_SliderThickness));4027 rect.setHeight(p ixelMetric(PM_SliderLength));4026 rect.setWidth(proxy()->pixelMetric(PM_SliderThickness)); 4027 rect.setHeight(proxy()->pixelMetric(PM_SliderLength)); 4028 4028 int centerX = slider->rect.center().x() - rect.width() / 2; 4029 4029 if (slider->tickPosition & QSlider::TicksAbove) -
trunk/src/gui/styles/qcleanlooksstyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcleanlooksstyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcommonstyle.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 66 66 #include <private/qcommonstylepixmaps_p.h> 67 67 #include <private/qmath_p.h> 68 #include <private/qstylehelper_p.h>69 68 #include <qdebug.h> 70 69 #include <qtextformat.h> … … 92 91 # include <qt_os2.h> 93 92 #endif 93 94 #include <private/qstylehelper_p.h> 94 95 95 96 QT_BEGIN_NAMESPACE … … 766 767 case PE_PanelItemViewRow: 767 768 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { 768 QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled769 QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled)) 769 770 ? QPalette::Normal : QPalette::Disabled; 770 771 if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) … … 779 780 case PE_PanelItemViewItem: 780 781 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { 781 QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled782 QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled)) 782 783 ? QPalette::Normal : QPalette::Disabled; 783 784 if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) … … 986 987 p->save(); 987 988 p->setFont(option->font); 988 p->drawText( int(x), int(y), elidedText);989 p->drawText(QPointF(x, y), elidedText); 989 990 p->restore(); 990 991 break; … … 1407 1408 break; 1408 1409 case CE_ProgressBarGroove: 1409 qDrawShadePanel(p, opt->rect, opt->palette, true, 1, 1410 &opt->palette.brush(QPalette::Window)); 1410 if (opt->rect.isValid()) 1411 qDrawShadePanel(p, opt->rect, opt->palette, true, 1, 1412 &opt->palette.brush(QPalette::Window)); 1411 1413 break; 1412 1414 case CE_ProgressBarLabel: … … 4783 4785 int margins = 0; 4784 4786 // we add 4 pixels for label margins 4785 if ( btn->icon.isNull() || !btn->text.isEmpty())4787 if (!btn->icon.isNull() || !btn->text.isEmpty()) 4786 4788 margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing 4787 4789 : PM_CheckBoxLabelSpacing, opt, widget); … … 5685 5687 switch (standardIcon) { 5686 5688 case QStyle::SP_MessageBoxQuestion: 5689 iconType = kQuestionMarkIcon; 5690 break; 5687 5691 case QStyle::SP_MessageBoxInformation: 5692 iconType = kAlertNoteIcon; 5693 break; 5688 5694 case QStyle::SP_MessageBoxWarning: 5695 iconType = kAlertCautionIcon; 5696 break; 5689 5697 case QStyle::SP_MessageBoxCritical: 5690 iconType = k GenericApplicationIcon;5698 iconType = kAlertStopIcon; 5691 5699 break; 5692 5700 case SP_DesktopIcon: … … 5778 5786 #ifndef QT_NO_IMAGEFORMAT_PNG 5779 5787 case SP_FileDialogNewFolder: 5780 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-16.png") );5781 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-32.png") );5782 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-128.png") );5788 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-16.png"), QSize(16, 16)); 5789 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-32.png"), QSize(32, 32)); 5790 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-128.png"), QSize(128, 128)); 5783 5791 break; 5784 5792 case SP_FileDialogBack: … … 5787 5795 return standardIconImplementation(SP_ArrowUp, option, widget); 5788 5796 case SP_FileDialogDetailedView: 5789 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewdetailed-16.png") );5790 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewdetailed-32.png") );5791 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewdetailed-128.png") );5797 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewdetailed-16.png"), QSize(16, 16)); 5798 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewdetailed-32.png"), QSize(32, 32)); 5799 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewdetailed-128.png"), QSize(128, 128)); 5792 5800 break; 5793 5801 case SP_FileDialogInfoView: 5794 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/fileinfo-16.png") );5795 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/fileinfo-32.png") );5796 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/fileinfo-128.png") );5802 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/fileinfo-16.png"), QSize(16, 16)); 5803 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/fileinfo-32.png"), QSize(32, 32)); 5804 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/fileinfo-128.png"), QSize(128, 128)); 5797 5805 break; 5798 5806 case SP_FileDialogContentsView: 5799 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filecontents-16.png") );5800 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filecontents-32.png") );5801 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filecontents-128.png") );5807 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filecontents-16.png"), QSize(16, 16)); 5808 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filecontents-32.png"), QSize(32, 32)); 5809 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filecontents-128.png"), QSize(128, 128)); 5802 5810 break; 5803 5811 case SP_FileDialogListView: 5804 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-16.png") );5805 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-32.png") );5806 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-128.png") );5812 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-16.png"), QSize(16, 16)); 5813 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-32.png"), QSize(32, 32)); 5814 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-128.png"), QSize(128, 128)); 5807 5815 break; 5808 5816 case SP_DialogOkButton: 5809 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-ok-16.png") );5810 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-ok-32.png") );5811 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-ok-128.png") );5817 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-ok-16.png"), QSize(16, 16)); 5818 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-ok-32.png"), QSize(32, 32)); 5819 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-ok-128.png"), QSize(128, 128)); 5812 5820 break; 5813 5821 case SP_DialogCancelButton: 5814 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-cancel-16.png") );5815 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-cancel-32.png") );5816 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-cancel-128.png") );5822 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-cancel-16.png"), QSize(16, 16)); 5823 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-cancel-32.png"), QSize(32, 32)); 5824 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-cancel-128.png"), QSize(128, 128)); 5817 5825 break; 5818 5826 case SP_DialogHelpButton: 5819 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-help-16.png") );5820 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-help-32.png") );5821 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-help-128.png") );5827 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-help-16.png"), QSize(16, 16)); 5828 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-help-32.png"), QSize(32, 32)); 5829 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-help-128.png"), QSize(128, 128)); 5822 5830 break; 5823 5831 case SP_DialogOpenButton: 5824 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png") );5825 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-32.png") );5826 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-128.png") );5832 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png"), QSize(16, 16)); 5833 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-32.png"), QSize(32, 32)); 5834 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-128.png"), QSize(128, 128)); 5827 5835 break; 5828 5836 case SP_DialogSaveButton: 5829 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-16.png") );5830 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-32.png") );5831 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-128.png") );5837 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-16.png"), QSize(16, 16)); 5838 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-32.png"), QSize(32, 32)); 5839 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-128.png"), QSize(128, 128)); 5832 5840 break; 5833 5841 case SP_DialogCloseButton: 5834 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-close-16.png") );5835 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-close-32.png") );5836 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-close-128.png") );5842 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-close-16.png"), QSize(16, 16)); 5843 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-close-32.png"), QSize(32, 32)); 5844 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-close-128.png"), QSize(128, 128)); 5837 5845 break; 5838 5846 case SP_DialogApplyButton: 5839 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-apply-16.png") );5840 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-apply-32.png") );5841 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-apply-128.png") );5847 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-apply-16.png"), QSize(16, 16)); 5848 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-apply-32.png"), QSize(32, 32)); 5849 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-apply-128.png"), QSize(128, 128)); 5842 5850 break; 5843 5851 case SP_DialogResetButton: 5844 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-clear-16.png") );5845 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-clear-32.png") );5846 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-clear-128.png") );5852 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-clear-16.png"), QSize(16, 16)); 5853 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-clear-32.png"), QSize(32, 32)); 5854 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-clear-128.png"), QSize(128, 128)); 5847 5855 break; 5848 5856 case SP_DialogDiscardButton: 5849 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-delete-16.png") );5850 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-delete-32.png") );5851 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-delete-128.png") );5857 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-delete-16.png"), QSize(16, 16)); 5858 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-delete-32.png"), QSize(32, 32)); 5859 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-delete-128.png"), QSize(128, 128)); 5852 5860 break; 5853 5861 case SP_DialogYesButton: 5854 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-yes-16.png") );5855 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-yes-32.png") );5856 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-yes-128.png") );5862 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-yes-16.png"), QSize(16, 16)); 5863 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-yes-32.png"), QSize(32, 32)); 5864 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-yes-128.png"), QSize(128, 128)); 5857 5865 break; 5858 5866 case SP_DialogNoButton: 5859 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-16.png") );5860 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-32.png") );5861 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-128.png") );5867 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-16.png"), QSize(16, 16)); 5868 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-32.png"), QSize(32, 32)); 5869 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-128.png"), QSize(128, 128)); 5862 5870 break; 5863 5871 case SP_ArrowForward: … … 5870 5878 return standardIconImplementation(SP_ArrowLeft, option, widget); 5871 5879 case SP_ArrowLeft: 5872 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/left-16.png") );5873 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/left-32.png") );5874 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/left-128.png") );5880 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/left-16.png"), QSize(16, 16)); 5881 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/left-32.png"), QSize(32, 32)); 5882 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/left-128.png"), QSize(128, 128)); 5875 5883 break; 5876 5884 case SP_ArrowRight: 5877 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/right-16.png") );5878 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/right-32.png") );5879 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/right-128.png") );5885 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/right-16.png"), QSize(16, 16)); 5886 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/right-32.png"), QSize(32, 32)); 5887 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/right-128.png"), QSize(128, 128)); 5880 5888 break; 5881 5889 case SP_ArrowUp: 5882 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/up-16.png") );5883 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/up-32.png") );5884 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/up-128.png") );5890 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/up-16.png"), QSize(16, 16)); 5891 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/up-32.png"), QSize(32, 32)); 5892 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/up-128.png"), QSize(128, 128)); 5885 5893 break; 5886 5894 case SP_ArrowDown: 5887 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/down-16.png") );5888 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/down-32.png") );5889 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/down-128.png") );5895 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/down-16.png"), QSize(16, 16)); 5896 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/down-32.png"), QSize(32, 32)); 5897 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/down-128.png"), QSize(128, 128)); 5890 5898 break; 5891 5899 case SP_DirHomeIcon: … … 5905 5913 break; 5906 5914 case SP_DriveCDIcon: 5907 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/cdr-16.png") );5908 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/cdr-32.png") );5909 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/cdr-128.png") );5915 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/cdr-16.png"), QSize(16, 16)); 5916 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/cdr-32.png"), QSize(32, 32)); 5917 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/cdr-128.png"), QSize(128, 128)); 5910 5918 break; 5911 5919 case SP_DriveDVDIcon: 5912 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/dvd-16.png") );5913 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/dvd-32.png") );5914 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/dvd-128.png") );5920 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/dvd-16.png"), QSize(16, 16)); 5921 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/dvd-32.png"), QSize(32, 32)); 5922 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/dvd-128.png"), QSize(128, 128)); 5915 5923 break; 5916 5924 case SP_FileIcon: 5917 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/file-16.png") );5918 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/file-32.png") );5919 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/file-128.png") );5925 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/file-16.png"), QSize(16, 16)); 5926 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/file-32.png"), QSize(32, 32)); 5927 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/file-128.png"), QSize(128, 128)); 5920 5928 break; 5921 5929 case SP_FileLinkIcon: 5922 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filelink-16.png") );5923 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filelink-32.png") );5924 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filelink-128.png") );5930 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filelink-16.png"), QSize(16, 16)); 5931 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filelink-32.png"), QSize(32, 32)); 5932 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/filelink-128.png"), QSize(128, 128)); 5925 5933 break; 5926 5934 case SP_TrashIcon: 5927 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/trash-16.png") );5928 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/trash-32.png") );5929 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/trash-128.png") );5935 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/trash-16.png"), QSize(16, 16)); 5936 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/trash-32.png"), QSize(32, 32)); 5937 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/trash-128.png"), QSize(128, 128)); 5930 5938 break; 5931 5939 case SP_BrowserReload: 5932 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/refresh-24.png") );5933 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/refresh-32.png") );5940 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/refresh-24.png"), QSize(24, 24)); 5941 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/refresh-32.png"), QSize(32, 32)); 5934 5942 break; 5935 5943 case SP_BrowserStop: 5936 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/stop-24.png") );5937 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/stop-32.png") );5944 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/stop-24.png"), QSize(24, 24)); 5945 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/stop-32.png"), QSize(32, 32)); 5938 5946 break; 5939 5947 case SP_MediaPlay: 5940 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-play-16.png") );5941 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-play-32.png") );5948 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-play-16.png"), QSize(16, 16)); 5949 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-play-32.png"), QSize(32, 32)); 5942 5950 break; 5943 5951 case SP_MediaPause: 5944 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-pause-16.png") );5945 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-pause-32.png") );5952 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-pause-16.png"), QSize(16, 16)); 5953 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-pause-32.png"), QSize(32, 32)); 5946 5954 break; 5947 5955 case SP_MediaStop: 5948 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-stop-16.png") );5949 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-stop-32.png") );5956 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-stop-16.png"), QSize(16, 16)); 5957 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-stop-32.png"), QSize(32, 32)); 5950 5958 break; 5951 5959 case SP_MediaSeekForward: 5952 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-seek-forward-16.png") );5953 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-seek-forward-32.png") );5960 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-seek-forward-16.png"), QSize(16, 16)); 5961 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-seek-forward-32.png"), QSize(32, 32)); 5954 5962 break; 5955 5963 case SP_MediaSeekBackward: 5956 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-seek-backward-16.png") );5957 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-seek-backward-32.png") );5964 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-seek-backward-16.png"), QSize(16, 16)); 5965 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-seek-backward-32.png"), QSize(32, 32)); 5958 5966 break; 5959 5967 case SP_MediaSkipForward: 5960 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-skip-forward-16.png") );5961 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-skip-forward-32.png") );5968 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-skip-forward-16.png"), QSize(16, 16)); 5969 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-skip-forward-32.png"), QSize(32, 32)); 5962 5970 break; 5963 5971 case SP_MediaSkipBackward: 5964 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-skip-backward-16.png") );5965 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-skip-backward-32.png") );5972 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-skip-backward-16.png"), QSize(16, 16)); 5973 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-skip-backward-32.png"), QSize(32, 32)); 5966 5974 break; 5967 5975 case SP_MediaVolume: 5968 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-volume-16.png") );5976 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-volume-16.png"), QSize(16, 16)); 5969 5977 break; 5970 5978 case SP_MediaVolumeMuted: 5971 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-volume-muted-16.png") );5979 icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/media-volume-muted-16.png"), QSize(16, 16)); 5972 5980 break; 5973 5981 #endif // QT_NO_IMAGEFORMAT_PNG -
trunk/src/gui/styles/qcommonstyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcommonstyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcommonstylepixmaps_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qgtkpainter.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 48 48 // and takes care of converting all such calls into cached Qt pixmaps. 49 49 50 #include <private/qstylehelper_p.h> 50 51 #include <QtGui/QWidget> 51 52 #include <QtGui/QStyleOption> … … 143 144 144 145 QGtkPainter::QGtkPainter(QPainter *_painter) 145 : m_window(QGtkStylePrivate::gtkWidget( QLatin1String("GtkWindow")))146 : m_window(QGtkStylePrivate::gtkWidget("GtkWindow")) 146 147 , m_painter(_painter) 147 148 , m_alpha(true) … … 156 157 { 157 158 // Note the widget arg should ideally use the widget path, though would compromise performance 158 QString tmp = QString(QLS("%0-%1-%2-%3x%4-%5")).arg(key).arg(uint(state)).arg(shadow) 159 .arg(size.width()).arg(size.height()).arg(quintptr(widget)); 159 QString tmp = key 160 % HexString<uint>(state) 161 % HexString<uint>(shadow) 162 % HexString<uint>(size.width()) 163 % HexString<uint>(size.height()) 164 % HexString<quint64>(quint64(widget)); 160 165 return tmp; 161 166 } … … 237 242 rect.setHeight(2 * border + 1); 238 243 239 QString gapExtras = QString(QLS("s %0 w %1 g %2")).arg(gap_side).arg(width).arg(x); 240 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + gapExtras; 244 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) 245 % HexString<uchar>(gap_side) 246 % HexString<gint>(width) 247 % HexString<gint>(x); 241 248 242 249 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { … … 303 310 304 311 QString pixmapName = uniqueName(QLS(part), state, shadow, 305 rect.size(), gtkWidget) +pmKey;312 rect.size(), gtkWidget) % pmKey; 306 313 307 314 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { … … 353 360 354 361 QPixmap cache; 355 QString hLineExtras = QString(QLS("%0 %1 %2")).arg(x1).arg(x2).arg(y);356 362 QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) 357 + hLineExtras + pmKey; 363 % HexString<int>(x1) 364 % HexString<int>(x2) 365 % HexString<int>(y) 366 % pmKey; 358 367 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 359 368 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_hline (style, … … 380 389 381 390 QPixmap cache; 382 QString vLineExtras = QString(QLS("%0 %1 %2")).arg(y1).arg(y2).arg(x); 383 QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), 384 gtkWidget) + vLineExtras +pmKey; 391 QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) 392 % HexString<int>(y1) 393 % HexString<int>(y2) 394 % HexString<int>(x) 395 % pmKey; 396 385 397 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 386 398 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_vline (style, … … 408 420 409 421 QPixmap cache; 410 QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), 411 gtkWidget) + QString::number(expander_state) + pmKey; 422 QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) 423 % HexString<uchar>(expander_state) 424 % pmKey; 425 412 426 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 413 427 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_expander (style, pixmap, … … 432 446 433 447 QPixmap cache; 434 QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) +pmKey;448 QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) % pmKey; 435 449 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 436 450 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_focus (style, pixmap, state, NULL, … … 457 471 458 472 QPixmap cache; 459 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) +pmKey;473 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) % pmKey; 460 474 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 461 475 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_resize_grip (style, pixmap, state, … … 482 496 483 497 QPixmap cache; 484 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + 485 QString::number((int)arrow_type) + pmKey; 498 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) 499 % HexString<uchar>(arrow_type) 500 % pmKey; 486 501 487 502 GdkRectangle gtkCliprect = {0, 0, rect.width(), rect.height()}; … … 514 529 QPixmap cache; 515 530 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) 516 + QString::number(orientation); 531 % HexString<uchar>(orientation); 532 517 533 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 518 534 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_handle (style, … … 542 558 543 559 QPixmap cache; 544 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) +pmKey;560 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) % pmKey; 545 561 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 546 562 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_slider (style, … … 573 589 QRect r = rect; 574 590 QPixmap cache; 575 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) +pmKey;591 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey; 576 592 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 577 593 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_shadow(style, pixmap, state, shadow, NULL, … … 592 608 QRect r = rect; 593 609 QPixmap cache; 594 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) +pmKey;610 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey; 595 611 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 596 612 DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_flat_box (style, … … 619 635 QRect r = rect; 620 636 QPixmap cache; 621 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) ;622 pixmapName += QString::number(gap_pos);637 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) 638 % HexString<uchar>(gap_pos); 623 639 624 640 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { -
trunk/src/gui/styles/qgtkpainter_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qgtkstyle.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 68 68 #include <QtGui/QCheckBox> 69 69 #include <QtGui/QTreeView> 70 #include <QtGui/QStyledItemDelegate> 70 71 #include <qpixmapcache.h> 71 72 #undef signals // Collides with GTK stymbols … … 223 224 if (d->isThemeAvailable()) { 224 225 GtkStyle *style = d->gtkStyle(); 225 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));226 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 226 227 GtkWidget *gtkEntry = d->getTextColorWidget(); 227 228 GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg; 229 QColor bg, base, text, fg, highlight, highlightText; 228 GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg; 229 QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt; 230 230 gdkBg = style->bg[GTK_STATE_NORMAL]; 231 231 gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL]; … … 237 237 gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED]; 238 238 gdkSfg = gtkEntry->style->text[GTK_STATE_SELECTED]; 239 240 // The ACTIVE base color is really used for inactive windows 241 gdkaSbg = gtkEntry->style->base[GTK_STATE_ACTIVE]; 242 gdkaSfg = gtkEntry->style->text[GTK_STATE_ACTIVE]; 243 239 244 bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); 240 245 text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); … … 243 248 highlight = QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8); 244 249 highlightText = QColor(gdkSfg.red>>8, gdkSfg.green>>8, gdkSfg.blue>>8); 250 inactiveHighlight = QColor(gdkaSbg.red>>8, gdkaSbg.green>>8, gdkaSbg.blue>>8); 251 inactiveHighlightedTExt = QColor(gdkaSfg.red>>8, gdkaSfg.green>>8, gdkaSfg.blue>>8); 245 252 246 253 palette.setColor(QPalette::HighlightedText, highlightText); 254 255 247 256 palette.setColor(QPalette::Light, bg.lighter(125)); 248 257 palette.setColor(QPalette::Shadow, bg.darker(130)); … … 254 263 255 264 QColor alternateRowColor = palette.base().color().lighter(93); // ref gtkstyle.c draw_flat_box 256 GtkWidget *gtkTreeView = d->gtkWidget( QLS("GtkTreeView"));265 GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); 257 266 GdkColor *gtkAltBase = NULL; 258 267 d->gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL); … … 279 288 palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight); 280 289 palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText); 290 291 palette.setColor(QPalette::Inactive, QPalette::HighlightedText, inactiveHighlightedTExt); 292 palette.setColor(QPalette::Inactive, QPalette::Highlight, inactiveHighlight); 293 281 294 style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", 282 295 d->gtk_window_get_type()); … … 326 339 qt_filedialog_open_filenames_hook = &QGtkStylePrivate::openFilenames; 327 340 qt_filedialog_existing_directory_hook = &QGtkStylePrivate::openDirectory; 341 qApp->installEventFilter(&d->filter); 328 342 } 329 343 } … … 346 360 qt_filedialog_open_filenames_hook = 0; 347 361 qt_filedialog_existing_directory_hook = 0; 362 qApp->removeEventFilter(&d->filter); 348 363 } 349 364 } … … 422 437 423 438 case PM_ButtonShiftHorizontal: { 424 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));439 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 425 440 guint horizontal_shift; 426 441 d->gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL); … … 429 444 430 445 case PM_ButtonShiftVertical: { 431 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));446 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 432 447 guint vertical_shift; 433 448 d->gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL); … … 439 454 440 455 case PM_MenuPanelWidth: { 441 GtkWidget *gtkMenu = d->gtkWidget( QLS("GtkMenu"));456 GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); 442 457 guint horizontal_padding = 0; 443 458 // horizontal-padding is used by Maemo to get thicker borders … … 496 511 case PM_SliderThickness: 497 512 case PM_SliderControlThickness: { 498 GtkWidget *gtkScale = d->gtkWidget( QLS("GtkHScale"));513 GtkWidget *gtkScale = d->gtkWidget("GtkHScale"); 499 514 gint val; 500 515 d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL); … … 507 522 gint sliderLength; 508 523 gint trough_border; 509 GtkWidget *hScrollbar = d->gtkWidget( QLS("GtkHScrollbar"));524 GtkWidget *hScrollbar = d->gtkWidget("GtkHScrollbar"); 510 525 d->gtk_widget_style_get(hScrollbar, 511 526 "trough-border", &trough_border, … … 520 535 case PM_SliderLength: 521 536 gint val; 522 d->gtk_widget_style_get(d->gtkWidget( QLS("GtkHScale")), "slider-length", &val, NULL);537 d->gtk_widget_style_get(d->gtkWidget("GtkHScale"), "slider-length", &val, NULL); 523 538 return val; 524 539 … … 527 542 case PM_IndicatorWidth: 528 543 case PM_IndicatorHeight: { 529 GtkWidget *gtkCheckButton = d->gtkWidget( QLS("GtkCheckButton"));544 GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); 530 545 gint size, spacing; 531 546 d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL); … … 534 549 535 550 case PM_MenuBarVMargin: { 536 GtkWidget *gtkMenubar = d->gtkWidget( QLS("GtkMenuBar"));551 GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); 537 552 return qMax(0, gtkMenubar->style->ythickness); 538 553 } … … 540 555 { 541 556 gint spacing = 3; 542 GtkWidget *gtkScrollWindow = d->gtkWidget( QLS("GtkScrolledWindow"));557 GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); 543 558 Q_ASSERT(gtkScrollWindow); 544 559 d->gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL); … … 547 562 case PM_SubMenuOverlap: { 548 563 gint offset = 0; 549 GtkWidget *gtkMenu = d->gtkWidget( QLS("GtkMenu"));564 GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); 550 565 d->gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL); 551 566 return offset; … … 588 603 if (d->isKDE4Session()) 589 604 return QCleanlooksStyle::styleHint(hint, option, widget, returnData); 590 GtkWidget *gtkToolbar = d->gtkWidget( QLS("GtkToolbar"));605 GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); 591 606 GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS; 592 607 g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL); … … 611 626 612 627 case SH_ComboBox_Popup: { 613 GtkWidget *gtkComboBox = d->gtkWidget( QLS("GtkComboBox"));628 GtkWidget *gtkComboBox = d->gtkWidget("GtkComboBox"); 614 629 gboolean appears_as_list; 615 630 d->gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL); … … 635 650 scrollbars_within_bevel = true; 636 651 else if (!d->gtk_check_version(2, 12, 0)) { 637 GtkWidget *gtkScrollWindow = d->gtkWidget( QLS("GtkScrolledWindow"));652 GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); 638 653 d->gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); 639 654 } … … 691 706 const int pmSize = 64; 692 707 const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); 693 const QString pmKey = Q String(QLS("windowframe %0")).arg(option->state);708 const QString pmKey = QLatin1Literal("windowframe") % HexString<uint>(option->state); 694 709 695 710 QPixmap pixmap; … … 713 728 "*.GtkScrolledWindow", "*.GtkScrolledWindow", d->gtk_window_get_type()); 714 729 if (style) 715 gtkFramePainter.paintShadow(d->gtkWidget( QLS("GtkFrame")), "viewport", pmRect,730 gtkFramePainter.paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect, 716 731 option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, 717 732 shadow_type, style); … … 740 755 741 756 case PE_PanelTipLabel: { 742 GtkWidget *gtkWindow = d->gtkWidget( QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed757 GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed 743 758 style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", 744 759 d->gtk_window_get_type()); … … 755 770 } 756 771 GtkShadowType shadow_type; 757 GtkWidget *gtkStatusbarFrame = d->gtkWidget( QLS("GtkStatusbar.GtkFrame"));772 GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame"); 758 773 d->gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL); 759 774 gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL, … … 764 779 case PE_IndicatorHeaderArrow: 765 780 if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { 766 GtkWidget *gtkTreeHeader = d->gtkWidget( QLS("GtkTreeView.GtkButton"));781 GtkWidget *gtkTreeHeader = d->gtkWidget("GtkTreeView.GtkButton"); 767 782 GtkStateType state = gtkPainter.gtkState(option); 768 783 style = gtkTreeHeader->style; … … 770 785 QRect r = header->rect; 771 786 QImage arrow; 787 // This sorting indicator inversion is intentional, and follows the GNOME HIG. 788 // See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable 772 789 if (header->sortIndicator & QStyleOptionHeader::SortUp) 773 790 type = GTK_ARROW_UP; … … 787 804 QRect frameRect = option->rect.adjusted(1, 1, -1, -2); 788 805 789 if (qobject_cast<const QTabBar*>(widget)) 790 frameRect.adjust(-1, 1, 1, 1); 791 792 gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style); 806 if (qobject_cast<const QTabBar*>(widget)) { 807 GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); 808 style = gtkPainter.getStyle(gtkNotebook); 809 gtkPainter.paintFocus(gtkNotebook, "tab", frameRect.adjusted(-1, 1, 1, 1), GTK_STATE_ACTIVE, style); 810 } else { 811 gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style); 812 } 793 813 } 794 814 break; … … 802 822 GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED; 803 823 GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED; 804 GtkWidget *gtkTreeView = d->gtkWidget( QLS("GtkTreeView"));824 GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); 805 825 806 826 GtkStateType state = GTK_STATE_NORMAL; … … 814 834 } 815 835 break; 836 837 case PE_PanelItemViewRow: 838 // This primitive is only used to draw selection behind selected expander arrows. 839 // We try not to decorate the tree branch background unless you inherit from StyledItemDelegate 840 // The reason for this is that a lot of code that relies on custom item delegates will look odd having 841 // a gradient on the branch but a flat shaded color on the item itself. 842 QCommonStyle::drawPrimitive(element, option, painter, widget); 843 if (!option->state & State_Selected) { 844 break; 845 } else { 846 if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(widget)) { 847 if (!qobject_cast<QStyledItemDelegate*>(view->itemDelegate())) 848 break; 849 } 850 } // fall through 851 816 852 case PE_PanelItemViewItem: 817 853 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { 818 if (vopt->state & State_Selected) { 819 QLinearGradient gradient; 820 gradient.setStart(option->rect.left(), option->rect.top()); 821 gradient.setFinalStop(option->rect.left(), option->rect.bottom()); 822 gradient.setColorAt(0, option->palette.highlight().color().lighter(105)); 823 gradient.setColorAt(0.5, option->palette.highlight().color().lighter(101)); 824 gradient.setColorAt(0.51, option->palette.highlight().color().darker(101)); 825 gradient.setColorAt(1, option->palette.highlight().color().darker(105)); 826 painter->fillRect(option->rect, gradient); 827 } else { 828 if (vopt->backgroundBrush.style() != Qt::NoBrush) { 829 QPointF oldBO = painter->brushOrigin(); 830 painter->setBrushOrigin(vopt->rect.topLeft()); 831 painter->fillRect(vopt->rect, vopt->backgroundBrush); 832 painter->setBrushOrigin(oldBO); 854 uint resolve_mask = vopt->palette.resolve(); 855 if (vopt->backgroundBrush.style() != Qt::NoBrush 856 || (resolve_mask & (1 << QPalette::Base))) 857 { 858 QPointF oldBO = painter->brushOrigin(); 859 painter->setBrushOrigin(vopt->rect.topLeft()); 860 painter->fillRect(vopt->rect, vopt->backgroundBrush); 861 painter->setBrushOrigin(oldBO); 862 if (!(option->state & State_Selected)) 863 break; 864 } 865 if (GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView")) { 866 const char *detail = "cell_even_ruled"; 867 if (vopt && vopt->features & QStyleOptionViewItemV2::Alternate) 868 detail = "cell_odd_ruled"; 869 bool isActive = option->state & State_Active; 870 QString key; 871 if (isActive ) { 872 // Required for active/non-active window appearance 873 key = QLS("a"); 874 GTK_WIDGET_SET_FLAGS(gtkTreeView, GTK_HAS_FOCUS); 833 875 } 876 bool isEnabled = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled)); 877 gtkPainter.paintFlatBox(gtkTreeView, detail, option->rect, 878 option->state & State_Selected ? GTK_STATE_SELECTED : 879 isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, 880 GTK_SHADOW_OUT, gtkTreeView->style, key); 881 if (isActive ) 882 GTK_WIDGET_UNSET_FLAGS(gtkTreeView, GTK_HAS_FOCUS); 834 883 } 835 884 } … … 838 887 { 839 888 const int margin = 6; 840 GtkWidget *gtkSeparator = d->gtkWidget( QLS("GtkToolbar.GtkSeparatorToolItem"));889 GtkWidget *gtkSeparator = d->gtkWidget("GtkToolbar.GtkSeparatorToolItem"); 841 890 if (option->state & State_Horizontal) { 842 891 const int offset = option->rect.width()/2; … … 858 907 859 908 case PE_IndicatorToolBarHandle: { 860 GtkWidget *gtkToolbar = d->gtkWidget( QLS("GtkToolbar"));909 GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); 861 910 GtkShadowType shadow_type; 862 911 d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); … … 906 955 907 956 QColor arrowColor = option->palette.buttonText().color(); 908 GtkWidget *gtkArrow = d->gtkWidget( QLS("GtkArrow"));957 GtkWidget *gtkArrow = d->gtkWidget("GtkArrow"); 909 958 GdkColor color = fromQColor(arrowColor); 910 959 d->gtk_widget_modify_fg (gtkArrow, state, &color); … … 922 971 923 972 case PE_PanelMenu: { 924 GtkWidget *gtkMenu = d->gtkWidget( QLS("GtkMenu"));973 GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); 925 974 gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons 926 975 gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style, QString()); … … 934 983 // This is only used by floating tool bars 935 984 if (qobject_cast<const QToolBar *>(widget)) { 936 GtkWidget *gtkMenubar = d->gtkWidget( QLS("GtkMenuBar"));985 GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); 937 986 gtkPainter.paintBox( gtkMenubar, "toolbar", option->rect, 938 987 GTK_STATE_NORMAL, GTK_SHADOW_OUT, style); … … 943 992 944 993 case PE_FrameLineEdit: { 945 GtkWidget *gtkEntry = d->gtkWidget( QLS("GtkEntry"));994 GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); 946 995 947 996 … … 977 1026 case PE_PanelLineEdit: 978 1027 if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) { 979 GtkWidget *gtkEntry = d->gtkWidget( QLS("GtkEntry"));1028 GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); 980 1029 if (panel->lineWidth > 0) 981 1030 proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget); … … 995 1044 case PE_FrameTabWidget: 996 1045 if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(option)) { 997 GtkWidget *gtkNotebook = d->gtkWidget( QLS("GtkNotebook"));1046 GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); 998 1047 style = gtkPainter.getStyle(gtkNotebook); 999 1048 gtkPainter.setAlphaSupport(false); … … 1043 1092 if (option->state & State_On || option->state & State_Sunken) 1044 1093 state = GTK_STATE_ACTIVE; 1045 GtkWidget *gtkButton = d->gtkWidget(isTool ? QLS("GtkToolButton.GtkButton") : QLS("GtkButton"));1094 GtkWidget *gtkButton = isTool ? d->gtkWidget("GtkToolButton.GtkButton") : d->gtkWidget("GtkButton"); 1046 1095 gint focusWidth, focusPad; 1047 1096 gboolean interiorFocus = false; … … 1099 1148 shadow = GTK_SHADOW_OUT; 1100 1149 1101 GtkWidget *gtkRadioButton = d->gtkWidget( QLS("GtkRadioButton"));1150 GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); 1102 1151 gint spacing; 1103 1152 d->gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL); … … 1106 1155 // ### Note: Ubuntulooks breaks when the proper widget is passed 1107 1156 // Murrine engine requires a widget not to get RGBA check - warnings 1108 GtkWidget *gtkCheckButton = d->gtkWidget( QLS("GtkCheckButton"));1157 GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); 1109 1158 QString key(QLS("radiobutton")); 1110 1159 if (option->state & State_HasFocus) { // Themes such as Nodoka check this flag … … 1134 1183 int spacing; 1135 1184 1136 GtkWidget *gtkCheckButton = d->gtkWidget( QLS("GtkCheckButton"));1185 GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); 1137 1186 QString key(QLS("checkbutton")); 1138 1187 if (option->state & State_HasFocus) { // Themes such as Nodoka checks this flag … … 1162 1211 = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) { 1163 1212 QRect tabRect = tbb->rect; 1164 QRegion region(tabRect);1165 1213 painter->save(); 1166 1214 painter->setPen(QPen(option->palette.dark().color().dark(110), 0)); … … 1244 1292 alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline); 1245 1293 1246 QPalette palette = option->palette;1247 1248 1294 switch (control) { 1249 1295 … … 1276 1322 if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { 1277 1323 // Draw prelight background 1278 GtkWidget *gtkCheckButton = d->gtkWidget( QLS("GtkCheckButton"));1324 GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); 1279 1325 1280 1326 if (option->state & State_MouseOver) { … … 1332 1378 bool isEnabled = (comboBox->state & State_Enabled); 1333 1379 bool focus = isEnabled && (comboBox->state & State_HasFocus); 1334 QColor buttonShadow = option->palette.dark().color();1335 1380 GtkStateType state = gtkPainter.gtkState(option); 1336 1381 int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget); 1337 QPixmap cache;1338 QString pixmapName;1339 1382 QStyleOptionComboBox comboBoxCopy = *comboBox; 1340 1383 comboBoxCopy.rect = option->rect; … … 1344 1387 QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, 1345 1388 SC_ComboBoxArrow, widget); 1346 QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,1347 SC_ComboBoxEditField, widget);1348 1389 1349 1390 GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ? 1350 1391 GTK_SHADOW_IN : GTK_SHADOW_OUT; 1351 QString comboBoxPath = QLS(comboBox->editable ? "GtkComboBoxEntry" :"GtkComboBox");1392 const QHashableLatin1Literal comboBoxPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox"); 1352 1393 1353 1394 // We use the gtk widget to position arrows and separators for us … … 1357 1398 d->gtk_widget_size_allocate(gtkCombo, &geometry); 1358 1399 1359 QString buttonPath = comboBoxPath + QLS(".GtkToggleButton"); 1400 QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") 1401 : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); 1360 1402 GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath); 1361 1403 d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); … … 1366 1408 if (comboBox->editable || appears_as_list) { 1367 1409 GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state; 1368 Q String entryPath = QLS(comboBox->editable ? "GtkComboBoxEntry.GtkEntry" :"GtkComboBox.GtkFrame");1410 QHashableLatin1Literal entryPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame"); 1369 1411 GtkWidget *gtkEntry = d->gtkWidget(entryPath); 1370 1412 d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); … … 1392 1434 gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect, 1393 1435 option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, 1394 GTK_SHADOW_NONE, gtkEntry->style, entryPath + QString::number(focus));1436 GTK_SHADOW_NONE, gtkEntry->style, entryPath.toString() + QString::number(focus)); 1395 1437 } 1396 1438 1397 1439 gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState, 1398 GTK_SHADOW_IN, gtkEntry->style, entryPath +1440 GTK_SHADOW_IN, gtkEntry->style, entryPath.toString() + 1399 1441 QString::number(focus) + QString::number(comboBox->editable) + 1400 1442 QString::number(option->direction)); … … 1412 1454 buttonState = GTK_STATE_PRELIGHT; 1413 1455 1414 QRect buttonrect = QRect(gtkToggleButton->allocation.x, gtkToggleButton->allocation.y,1415 gtkToggleButton->allocation.width, gtkToggleButton->allocation.height);1416 1417 1456 Q_ASSERT(gtkToggleButton); 1418 1457 gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState, 1419 shadow, gtkToggleButton->style, buttonPath +1458 shadow, gtkToggleButton->style, buttonPath.toString() + 1420 1459 QString::number(focus) + QString::number(option->direction)); 1421 1460 if (focus) … … 1430 1469 buttonRect, state, 1431 1470 shadow, gtkToggleButton->style, 1432 buttonPath + QString::number(focus));1471 buttonPath.toString() + QString::number(focus)); 1433 1472 if (focus) 1434 1473 GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); 1435 1474 1475 1436 1476 // Draw the separator between label and arrows 1437 QString vSeparatorPath = buttonPath + QLS(".GtkHBox.GtkVSeparator"); 1477 QHashableLatin1Literal vSeparatorPath = comboBox->editable 1478 ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkVSeparator") 1479 : QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkVSeparator"); 1438 1480 1439 1481 if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) { … … 1445 1487 gtkCachedPainter.paintVline( gtkVSeparator, "vseparator", 1446 1488 vLineRect, state, gtkVSeparator->style, 1447 0, vLineRect.height(), 0, vSeparatorPath );1489 0, vLineRect.height(), 0, vSeparatorPath.toString()); 1448 1490 1449 1491 … … 1470 1512 state = GTK_STATE_NORMAL; 1471 1513 1472 QString arrowPath = comboBoxPath + QLS(appears_as_list ? ".GtkToggleButton.GtkArrow" 1473 : ".GtkToggleButton.GtkHBox.GtkArrow"); 1514 QHashableLatin1Literal arrowPath(""); 1515 if (comboBox->editable) { 1516 if (appears_as_list) 1517 arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkArrow"); 1518 else 1519 arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkArrow"); 1520 } else { 1521 if (appears_as_list) 1522 arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkArrow"); 1523 else 1524 arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"); 1525 } 1474 1526 1475 1527 GtkWidget *gtkArrow = d->gtkWidget(arrowPath); … … 1498 1550 if (sunken) { 1499 1551 int xoff, yoff; 1500 GtkWidget *gtkButton = d->gtkWidget(comboBoxPath + QLS(".GtkToggleButton")); 1552 const QHashableLatin1Literal toggleButtonPath = comboBox->editable 1553 ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") 1554 : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); 1555 1556 GtkWidget *gtkButton = d->gtkWidget(toggleButtonPath); 1501 1557 d->gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL); 1502 1558 d->gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL); … … 1510 1566 gtkCachedPainter.paintArrow( gtkArrow, "arrow", arrowRect, 1511 1567 GTK_ARROW_DOWN, state, GTK_SHADOW_NONE, TRUE, 1512 style, arrowPath + QString::number(option->direction));1568 style, arrowPath.toString() + QString::number(option->direction)); 1513 1569 } 1514 1570 } … … 1571 1627 QStyleOptionToolButton label = *toolbutton; 1572 1628 label.state = bflags; 1573 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkToolButton.GtkButton"));1629 GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); 1574 1630 QPalette pal = toolbutton->palette; 1575 1631 if (option->state & State_Enabled && … … 1606 1662 case CC_ScrollBar: 1607 1663 if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { 1608 GtkWidget *gtkHScrollBar = d->gtkWidget( QLS("GtkHScrollbar"));1609 GtkWidget *gtkVScrollBar = d->gtkWidget( QLS("GtkVScrollbar"));1664 GtkWidget *gtkHScrollBar = d->gtkWidget("GtkHScrollbar"); 1665 GtkWidget *gtkVScrollBar = d->gtkWidget("GtkVScrollbar"); 1610 1666 1611 1667 // Fill background in case the scrollbar is partially transparent … … 1622 1678 gboolean trough_under_steppers = true; 1623 1679 gboolean trough_side_details = false; 1680 gboolean activate_slider = false; 1624 1681 gboolean stepper_size = 14; 1625 1682 gint trough_border = 1; … … 1629 1686 "trough-side-details", &trough_side_details, 1630 1687 "trough-under-steppers", &trough_under_steppers, 1688 "activate-slider", &activate_slider, 1631 1689 "stepper-size", &stepper_size, NULL); 1632 1690 } … … 1674 1732 if (!(option->state & State_Enabled)) 1675 1733 state = GTK_STATE_INSENSITIVE; 1734 else if (activate_slider && 1735 option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSlider)) 1736 state = GTK_STATE_ACTIVE; 1676 1737 else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSlider)) 1677 1738 state = GTK_STATE_PRELIGHT; … … 1752 1813 if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { 1753 1814 1754 GtkWidget *gtkSpinButton = d->gtkWidget( 1755 spinBox->buttonSymbols == QAbstractSpinBox::NoButtons ? 1756 QLS("GtkEntry") : 1757 QLS("GtkSpinButton")); 1815 GtkWidget *gtkSpinButton = spinBox->buttonSymbols == QAbstractSpinBox::NoButtons 1816 ? d->gtkWidget("GtkEntry") 1817 : d->gtkWidget("GtkSpinButton"); 1758 1818 bool isEnabled = (spinBox->state & State_Enabled); 1759 1819 bool hover = isEnabled && (spinBox->state & State_MouseOver); … … 1907 1967 case CC_Slider: 1908 1968 if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { 1909 GtkWidget *hScaleWidget = d->gtkWidget( QLS("GtkHScale"));1910 GtkWidget *vScaleWidget = d->gtkWidget( QLS("GtkVScale"));1969 GtkWidget *hScaleWidget = d->gtkWidget("GtkHScale"); 1970 GtkWidget *vScaleWidget = d->gtkWidget("GtkVScale"); 1911 1971 1912 1972 QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); 1913 1973 QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); 1914 QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);1915 1974 1916 1975 bool horizontal = slider->orientation == Qt::Horizontal; 1917 1976 bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; 1918 1977 bool ticksBelow = slider->tickPosition & QSlider::TicksBelow; 1919 QColor activeHighlight = option->palette.color(QPalette::Normal, QPalette::Highlight); 1920 1921 QPixmap cache; 1978 1922 1979 QBrush oldBrush = painter->brush(); 1923 1980 QPen oldPen = painter->pen(); … … 1928 1985 highlightAlpha.setAlpha(80); 1929 1986 1987 QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ? 1988 GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); 1930 1989 GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget; 1931 1990 style = scaleWidget->style; … … 1961 2020 1962 2021 if (horizontal) { 1963 upperGroove.setLeft(handle.center().x()); 1964 lowerGroove.setRight(handle.center().x()); 2022 if (slider->upsideDown) { 2023 lowerGroove.setLeft(handle.center().x()); 2024 upperGroove.setRight(handle.center().x()); 2025 } else { 2026 upperGroove.setLeft(handle.center().x()); 2027 lowerGroove.setRight(handle.center().x()); 2028 } 1965 2029 } else { 1966 upperGroove.setBottom(handle.center().y()); 1967 lowerGroove.setTop(handle.center().y()); 2030 if (!slider->upsideDown) { 2031 lowerGroove.setBottom(handle.center().y()); 2032 upperGroove.setTop(handle.center().y()); 2033 } else { 2034 upperGroove.setBottom(handle.center().y()); 2035 lowerGroove.setTop(handle.center().y()); 2036 } 1968 2037 } 1969 2038 … … 2098 2167 case CE_ProgressBarLabel: 2099 2168 if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { 2100 GtkWidget *gtkProgressBar = d->gtkWidget( QLS("GtkProgressBar"));2169 GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); 2101 2170 if (!gtkProgressBar) 2102 2171 return; … … 2201 2270 ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0); 2202 2271 2203 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));2272 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 2204 2273 QPalette pal = button->palette; 2205 2274 int labelState = GTK_STATE_INSENSITIVE; … … 2222 2291 2223 2292 // Draw prelight background 2224 GtkWidget *gtkRadioButton = d->gtkWidget( QLS("GtkRadioButton"));2293 GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); 2225 2294 2226 2295 if (option->state & State_MouseOver) { … … 2290 2359 2291 2360 if (!cb->currentText.isEmpty() && !cb->editable) { 2292 GtkWidget *gtkCombo = d->gtkWidget( QLS("GtkComboBox"));2361 GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); 2293 2362 QPalette pal = cb->palette; 2294 2363 int labelState = GTK_STATE_INSENSITIVE; … … 2367 2436 if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { 2368 2437 Q_UNUSED(header); 2369 GtkWidget *gtkTreeView = d->gtkWidget( QLS("GtkTreeView"));2438 GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); 2370 2439 // Get the middle column 2371 2440 GtkTreeViewColumn *column = d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1); … … 2388 2457 2389 2458 case CE_SizeGrip: { 2390 GtkWidget *gtkStatusbar = d->gtkWidget( QLS("GtkStatusbar.GtkFrame"));2459 GtkWidget *gtkStatusbar = d->gtkWidget("GtkStatusbar.GtkFrame"); 2391 2460 QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness); 2392 2461 gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL, … … 2400 2469 2401 2470 case CE_MenuBarEmptyArea: { 2402 GtkWidget *gtkMenubar = d->gtkWidget( QLS("GtkMenuBar"));2471 GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); 2403 2472 GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency 2404 2473 painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); … … 2423 2492 2424 2493 if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { 2425 GtkWidget *gtkMenubarItem = d->gtkWidget( QLS("GtkMenuBar.GtkMenuItem"));2426 GtkWidget *gtkMenubar = d->gtkWidget( QLS("GtkMenuBar"));2494 GtkWidget *gtkMenubarItem = d->gtkWidget("GtkMenuBar.GtkMenuItem"); 2495 GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); 2427 2496 2428 2497 style = gtkMenubarItem->style; … … 2480 2549 2481 2550 case CE_Splitter: { 2482 GtkWidget *gtkWindow = d->gtkWidget( QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed2551 GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed 2483 2552 gtkPainter.paintHandle(gtkWindow, "splitter", option->rect, gtkPainter.gtkState(option), GTK_SHADOW_NONE, 2484 2553 !(option->state & State_Horizontal) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, … … 2500 2569 rect.adjust(0, 0, 1, 0); 2501 2570 2502 GtkWidget *gtkToolbar = d->gtkWidget( QLS("GtkToolbar"));2571 GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); 2503 2572 GtkShadowType shadow_type = GTK_SHADOW_NONE; 2504 2573 d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); … … 2519 2588 const int windowsItemVMargin = 26; // menu item ver text margin 2520 2589 const int windowsRightBorder = 15; // right border on windows 2521 GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget( QLS("GtkMenu.GtkCheckMenuItem")) :2522 d->gtkWidget( QLS("GtkMenu.GtkMenuItem"));2590 GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget("GtkMenu.GtkCheckMenuItem") : 2591 d->gtkWidget("GtkMenu.GtkMenuItem"); 2523 2592 2524 2593 style = gtkPainter.getStyle(gtkMenuItem); 2525 QColor borderColor = option->palette.background().color().darker(160);2526 2594 QColor shadow = option->palette.dark().color(); 2527 2595 2528 2596 if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { 2529 GtkWidget *gtkMenuSeparator = d->gtkWidget( QLS("GtkMenu.GtkSeparatorMenuItem"));2597 GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); 2530 2598 painter->setPen(shadow.lighter(106)); 2531 2599 gboolean wide_separators = 0; … … 2571 2639 2572 2640 gint checkSize; 2573 d->gtk_widget_style_get(d->gtkWidget( QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL);2641 d->gtk_widget_style_get(d->gtkWidget("GtkMenu.GtkCheckMenuItem"), "indicator-size", &checkSize, NULL); 2574 2642 2575 2643 int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize)); … … 2748 2816 // Arrow 2749 2817 if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow 2750 QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget),2751 proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));2752 2818 2753 2819 QFontMetrics fm(menuitem->font); … … 2782 2848 case CE_PushButton: 2783 2849 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { 2784 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));2850 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 2785 2851 proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); 2786 2852 QStyleOptionButton subopt = *btn; … … 2808 2874 case CE_TabBarTabShape: 2809 2875 if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { 2810 GtkWidget *gtkNotebook = d->gtkWidget( QLS("GtkNotebook"));2876 GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); 2811 2877 style = gtkPainter.getStyle(gtkNotebook); 2812 2878 … … 2875 2941 if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { 2876 2942 Q_UNUSED(bar); 2877 GtkWidget *gtkProgressBar = d->gtkWidget( QLS("GtkProgressBar"));2943 GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); 2878 2944 GtkStateType state = gtkPainter.gtkState(option); 2879 2945 gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, gtkProgressBar->style); … … 2885 2951 if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { 2886 2952 GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; 2887 GtkWidget *gtkProgressBar = d->gtkWidget( QLS("GtkProgressBar"));2953 GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); 2888 2954 style = gtkProgressBar->style; 2889 2955 gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style); … … 3043 3109 case CC_SpinBox: 3044 3110 if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { 3045 GtkWidget *gtkSpinButton = d->gtkWidget( QLS("GtkSpinButton"));3111 GtkWidget *gtkSpinButton = d->gtkWidget("GtkSpinButton"); 3046 3112 int center = spinbox->rect.height() / 2; 3047 3113 int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0; … … 3096 3162 if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { 3097 3163 // We employ the gtk widget to position arrows and separators for us 3098 QString comboBoxPath = box->editable ? QLS("GtkComboBoxEntry") : QLS("GtkComboBox");3099 GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath);3164 GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry") 3165 : d->gtkWidget("GtkComboBox"); 3100 3166 d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); 3101 3167 GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())}; 3102 3168 d->gtk_widget_size_allocate(gtkCombo, &geometry); 3103 3169 int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget); 3104 QString arrowPath = comboBoxPath + QLS(".GtkToggleButton"); 3105 3106 if (!box->editable && !appears_as_list) 3107 arrowPath += QLS(".GtkHBox.GtkArrow"); 3170 QHashableLatin1Literal arrowPath("GtkComboBoxEntry.GtkToggleButton"); 3171 if (!box->editable) { 3172 if (appears_as_list) 3173 arrowPath = "GtkComboBox.GtkToggleButton"; 3174 else 3175 arrowPath = "GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"; 3176 } 3108 3177 3109 3178 GtkWidget *arrowWidget = d->gtkWidget(arrowPath); … … 3164 3233 case CT_ToolButton: 3165 3234 if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { 3166 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkToolButton.GtkButton"));3235 GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); 3167 3236 newSize = size + QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness); 3168 3237 if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) { … … 3182 3251 3183 3252 if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { 3184 GtkWidget *gtkMenuSeparator = d->gtkWidget( QLS("GtkMenu.GtkSeparatorMenuItem"));3253 GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); 3185 3254 GtkRequisition sizeReq = {0, 0}; 3186 3255 d->gtk_widget_size_request(gtkMenuSeparator, &sizeReq); … … 3189 3258 } 3190 3259 3191 GtkWidget *gtkMenuItem = d->gtkWidget( QLS("GtkMenu.GtkCheckMenuItem"));3260 GtkWidget *gtkMenuItem = d->gtkWidget("GtkMenu.GtkCheckMenuItem"); 3192 3261 GtkStyle* style = gtkMenuItem->style; 3193 3262 … … 3211 3280 case CT_SpinBox: 3212 3281 // QSpinBox does some nasty things that depends on CT_LineEdit 3213 newSize = size + QSize(0, -d->gtkWidget( QLS("GtkSpinButton"))->style->ythickness * 2);3282 newSize = size + QSize(0, -d->gtkWidget("GtkSpinButton")->style->ythickness * 2); 3214 3283 break; 3215 3284 3216 3285 case CT_PushButton: 3217 3286 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { 3218 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));3287 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 3219 3288 gint focusPadding, focusWidth; 3220 3289 d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL); … … 3224 3293 newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding)); 3225 3294 3226 GtkWidget *gtkButtonBox = d->gtkWidget( QLS("GtkHButtonBox"));3295 GtkWidget *gtkButtonBox = d->gtkWidget("GtkHButtonBox"); 3227 3296 gint minWidth = 85, minHeight = 0; 3228 3297 d->gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth, … … 3237 3306 3238 3307 case CT_Slider: { 3239 GtkWidget *gtkSlider = d->gtkWidget( QLS("GtkHScale"));3308 GtkWidget *gtkSlider = d->gtkWidget("GtkHScale"); 3240 3309 newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness); 3241 3310 } … … 3243 3312 3244 3313 case CT_LineEdit: { 3245 GtkWidget *gtkEntry = d->gtkWidget( QLS("GtkEntry"));3314 GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); 3246 3315 newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness); 3247 3316 } … … 3254 3323 case CT_ComboBox: 3255 3324 if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { 3256 GtkWidget *gtkCombo = d->gtkWidget( QLS("GtkComboBox"));3325 GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); 3257 3326 QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget); 3258 3327 newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness); … … 3409 3478 case SE_PushButtonContents: 3410 3479 if (!d->gtk_check_version(2, 10, 0)) { 3411 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));3480 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 3412 3481 GtkBorder *border = 0; 3413 3482 d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL); -
trunk/src/gui/styles/qgtkstyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qgtkstyle_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 61 61 #include <QtCore/QUrl> 62 62 #include <QtCore/QLibrary> 63 #include <QtCore/QDebug> 63 64 64 65 #include <private/qapplication_p.h> … … 234 235 } 235 236 236 static Q StringclassPath(GtkWidget *widget)237 { 238 char *class_path;237 static QHashableLatin1Literal classPath(GtkWidget *widget) 238 { 239 char *class_path; 239 240 QGtkStylePrivate::gtk_widget_path (widget, NULL, &class_path, NULL); 240 QString path = QLS(class_path); 241 242 char *copy = class_path; 243 if (strncmp(copy, "GtkWindow.", 10) == 0) 244 copy += 10; 245 if (strncmp(copy, "GtkFixed.", 9) == 0) 246 copy += 9; 247 248 copy = strdup(copy); 249 241 250 g_free(class_path); 242 251 243 // Remove the prefixes 244 path.remove(QLS("GtkWindow.")); 245 path.remove(QLS("GtkFixed.")); 246 return path; 252 return QHashableLatin1Literal::fromData(copy); 247 253 } 248 254 … … 262 268 263 269 QList<QGtkStylePrivate *> QGtkStylePrivate::instances; 270 QGtkStylePrivate::WidgetMap *QGtkStylePrivate::widgetMap = 0; 264 271 265 272 QGtkStylePrivate::QGtkStylePrivate() … … 279 286 resolveGtk(); 280 287 initGtkWidgets(); 281 if (isThemeAvailable()) 282 qApp->installEventFilter(&filter); 283 } 284 285 GtkWidget* QGtkStylePrivate::gtkWidget(const QString &path) 288 } 289 290 GtkWidget* QGtkStylePrivate::gtkWidget(const QHashableLatin1Literal &path) 286 291 { 287 292 GtkWidget *widget = gtkWidgetMap()->value(path); … … 293 298 } 294 299 295 GtkStyle* QGtkStylePrivate::gtkStyle(const Q String&path)296 { 297 if ( gtkWidgetMap()->contains(path))298 return gtkWidgetMap()->value(path)->style;300 GtkStyle* QGtkStylePrivate::gtkStyle(const QHashableLatin1Literal &path) 301 { 302 if (GtkWidget *w = gtkWidgetMap()->value(path)) 303 return w->style; 299 304 return 0; 300 305 } … … 495 500 496 501 static QString themeName; 497 if (!gtkWidgetMap()->contains( QLS("GtkWindow")) && themeName.isEmpty()) {502 if (!gtkWidgetMap()->contains("GtkWindow") && themeName.isEmpty()) { 498 503 themeName = getThemeName(); 499 504 … … 520 525 if (displayDepth == -1) 521 526 displayDepth = QGtkStylePrivate::gdk_drawable_get_depth(gtkWindow->window); 522 gtkWidgetMap()->insert(QLS("GtkWindow"), gtkWindow); 527 QHashableLatin1Literal widgetPath = QHashableLatin1Literal::fromData(strdup("GtkWindow")); 528 removeWidgetFromMap(widgetPath); 529 gtkWidgetMap()->insert(widgetPath, gtkWindow); 523 530 524 531 … … 527 534 QGtkStylePrivate::gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); 528 535 529 if (!gtkWidgetMap()->contains( QLS("GtkButton"))) {536 if (!gtkWidgetMap()->contains("GtkButton")) { 530 537 GtkWidget *gtkButton = QGtkStylePrivate::gtk_button_new(); 531 538 addWidget(gtkButton); … … 564 571 // as with the combo box. We need to update the widget map 565 572 // to reflect this; 566 QHash<Q String, GtkWidget*> oldMap = *gtkWidgetMap();573 QHash<QHashableLatin1Literal, GtkWidget*> oldMap = *gtkWidgetMap(); 567 574 gtkWidgetMap()->clear(); 568 QHashIterator<Q String, GtkWidget*> it(oldMap);575 QHashIterator<QHashableLatin1Literal, GtkWidget*> it(oldMap); 569 576 while (it.hasNext()) { 570 577 it.next(); 571 if (! it.key().contains(QLatin1Char('.'))) {578 if (!strchr(it.key().data(), '.')) { 572 579 addAllSubWidgets(it.value()); 573 580 } 581 free(const_cast<char *>(it.key().data())); 574 582 } 575 583 } … … 584 592 void QGtkStylePrivate::cleanupGtkWidgets() 585 593 { 586 if (gtkWidgetMap()->contains(QLS("GtkWindow"))) // Gtk will destroy all children 587 gtk_widget_destroy(gtkWidgetMap()->value(QLS("GtkWindow"))); 594 if (!widgetMap) 595 return; 596 if (widgetMap->contains("GtkWindow")) // Gtk will destroy all children 597 gtk_widget_destroy(widgetMap->value("GtkWindow")); 598 for (QHash<QHashableLatin1Literal, GtkWidget *>::const_iterator it = widgetMap->constBegin(); 599 it != widgetMap->constEnd(); ++it) 600 free(const_cast<char *>(it.key().data())); 588 601 } 589 602 … … 676 689 { 677 690 const int MIN_ARROW_WIDTH = 6; 678 GtkWidget *spinButton = gtkWidget( QLS("GtkSpinButton"));691 GtkWidget *spinButton = gtkWidget("GtkSpinButton"); 679 692 GtkStyle *style = spinButton->style; 680 693 gint size = pango_font_description_get_size (style->font_desc); … … 696 709 void QGtkStylePrivate::applyCustomPaletteHash() 697 710 { 698 QPalette menuPal = gtkWidgetPalette( QLS("GtkMenu"));699 GdkColor gdkBg = gtkWidget( QLS("GtkMenu"))->style->bg[GTK_STATE_NORMAL];711 QPalette menuPal = gtkWidgetPalette("GtkMenu"); 712 GdkColor gdkBg = gtkWidget("GtkMenu")->style->bg[GTK_STATE_NORMAL]; 700 713 QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); 701 714 menuPal.setBrush(QPalette::Base, bgColor); … … 703 716 qApp->setPalette(menuPal, "QMenu"); 704 717 705 QPalette toolbarPal = gtkWidgetPalette( QLS("GtkToolbar"));718 QPalette toolbarPal = gtkWidgetPalette("GtkToolbar"); 706 719 qApp->setPalette(toolbarPal, "QToolBar"); 707 720 708 QPalette menuBarPal = gtkWidgetPalette( QLS("GtkMenuBar"));721 QPalette menuBarPal = gtkWidgetPalette("GtkMenuBar"); 709 722 qApp->setPalette(menuBarPal, "QMenuBar"); 710 723 } … … 715 728 GtkWidget* QGtkStylePrivate::getTextColorWidget() const 716 729 { 717 return gtkWidget( QLS("GtkEntry"));730 return gtkWidget("GtkEntry"); 718 731 } 719 732 … … 724 737 if (!protoLayout) { 725 738 protoLayout = QGtkStylePrivate::gtk_fixed_new(); 726 QGtkStylePrivate::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value( QLS("GtkWindow"))), protoLayout);739 QGtkStylePrivate::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value("GtkWindow")), protoLayout); 727 740 } 728 741 Q_ASSERT(protoLayout); … … 734 747 } 735 748 749 void QGtkStylePrivate::removeWidgetFromMap(const QHashableLatin1Literal &path) 750 { 751 WidgetMap *map = gtkWidgetMap(); 752 WidgetMap::iterator it = map->find(path); 753 if (it != map->end()) { 754 free(const_cast<char *>(it.key().data())); 755 map->erase(it); 756 } 757 } 758 736 759 void QGtkStylePrivate::addWidgetToMap(GtkWidget *widget) 737 760 { 738 761 if (Q_GTK_IS_WIDGET(widget)) { 739 gtk_widget_realize(widget); 740 gtkWidgetMap()->insert(classPath(widget), widget); 762 gtk_widget_realize(widget); 763 QHashableLatin1Literal widgetPath = classPath(widget); 764 765 removeWidgetFromMap(widgetPath); 766 gtkWidgetMap()->insert(widgetPath, widget); 767 #ifdef DUMP_GTK_WIDGET_TREE 768 qWarning("Inserted Gtk Widget: %s", widgetPath.data()); 769 #endif 741 770 } 742 771 } … … 751 780 752 781 // Updates window/windowtext palette based on the indicated gtk widget 753 QPalette QGtkStylePrivate::gtkWidgetPalette(const Q String>kWidgetName) const782 QPalette QGtkStylePrivate::gtkWidgetPalette(const QHashableLatin1Literal >kWidgetName) const 754 783 { 755 784 GtkWidget *gtkWidget = QGtkStylePrivate::gtkWidget(gtkWidgetName); … … 1087 1116 } 1088 1117 1118 bool operator==(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2) 1119 { 1120 return l1.size() == l2.size() || qstrcmp(l1.data(), l2.data()) == 0; 1121 } 1122 1123 // copied from qHash.cpp 1124 uint qHash(const QHashableLatin1Literal &key) 1125 { 1126 int n = key.size(); 1127 const uchar *p = reinterpret_cast<const uchar *>(key.data()); 1128 uint h = 0; 1129 uint g; 1130 1131 while (n--) { 1132 h = (h << 4) + *p++; 1133 if ((g = (h & 0xf0000000)) != 0) 1134 h ^= g >> 23; 1135 h &= ~g; 1136 } 1137 return h; 1138 } 1139 1089 1140 QT_END_NAMESPACE 1090 1141 -
trunk/src/gui/styles/qgtkstyle_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 57 57 #if !defined(QT_NO_STYLE_GTK) 58 58 59 #include <QtCore/qstring.h> 60 #include <QtCore/qstringbuilder.h> 61 #include <QtCore/qcoreapplication.h> 62 59 63 #include <QtGui/QFileDialog> 60 64 … … 72 76 73 77 #define QLS(x) QLatin1String(x) 78 79 QT_BEGIN_NAMESPACE 80 81 // ### Qt 4.7 - merge with QLatin1Literal 82 class QHashableLatin1Literal 83 { 84 public: 85 int size() const { return m_size; } 86 const char *data() const { return m_data; } 87 88 #ifdef __SUNPRO_CC 89 QHashableLatin1Literal(const char* str) 90 : m_size(strlen(str)), m_data(str) {} 91 #else 92 template <int N> 93 QHashableLatin1Literal(const char (&str)[N]) 94 : m_size(N - 1), m_data(str) {} 95 #endif 96 97 QHashableLatin1Literal(const QHashableLatin1Literal &other) 98 : m_size(other.m_size), m_data(other.m_data) 99 {} 100 101 QHashableLatin1Literal &operator=(const QHashableLatin1Literal &other) 102 { 103 if (this == &other) 104 return *this; 105 *const_cast<int *>(&m_size) = other.m_size; 106 *const_cast<char **>(&m_data) = const_cast<char *>(other.m_data); 107 return *this; 108 } 109 110 QString toString() const { return QString::fromLatin1(m_data, m_size); } 111 112 static QHashableLatin1Literal fromData(const char *str) 113 { 114 return QHashableLatin1Literal(str, qstrlen(str)); 115 } 116 117 private: 118 QHashableLatin1Literal(const char *str, int length) 119 : m_size(length), m_data(str) 120 {} 121 122 const int m_size; 123 const char *m_data; 124 }; 125 126 bool operator==(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2); 127 inline bool operator!=(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2) { return !operator==(l1, l2); } 128 uint qHash(const QHashableLatin1Literal &key); 129 130 QT_END_NAMESPACE 74 131 75 132 class GConf; … … 253 310 GnomeIconLookupResultFlags *result); 254 311 255 256 312 class QGtkStylePrivate : public QCleanlooksStylePrivate 257 313 { … … 263 319 QGtkStyleFilter filter; 264 320 265 static GtkWidget* gtkWidget(const Q String&path);266 static GtkStyle* gtkStyle(const Q String &path = QLatin1String("GtkWindow"));321 static GtkWidget* gtkWidget(const QHashableLatin1Literal &path); 322 static GtkStyle* gtkStyle(const QHashableLatin1Literal &path = QHashableLatin1Literal("GtkWindow")); 267 323 268 324 virtual void resolveGtk() const; … … 419 475 static Ptr_gnome_vfs_init gnome_vfs_init; 420 476 421 virtual QPalette gtkWidgetPalette(const Q String>kWidgetName) const;477 virtual QPalette gtkWidgetPalette(const QHashableLatin1Literal >kWidgetName) const; 422 478 423 479 protected: 424 typedef QHash<QString, GtkWidget*> WidgetMap; 480 typedef QHash<QHashableLatin1Literal, GtkWidget*> WidgetMap; 481 482 static inline void destroyWidgetMap() 483 { 484 cleanupGtkWidgets(); 485 delete widgetMap; 486 widgetMap = 0; 487 } 425 488 426 489 static inline WidgetMap *gtkWidgetMap() 427 490 { 428 static WidgetMap *map = 0; 429 if (!map) 430 map = new WidgetMap(); 431 return map; 491 if (!widgetMap) { 492 widgetMap = new WidgetMap(); 493 qAddPostRoutine(destroyWidgetMap); 494 } 495 return widgetMap; 432 496 } 433 497 … … 439 503 static void addAllSubWidgets(GtkWidget *widget, gpointer v = 0); 440 504 static void addWidget(GtkWidget *widget); 505 static void removeWidgetFromMap(const QHashableLatin1Literal &path); 441 506 442 507 virtual void init(); … … 444 509 private: 445 510 static QList<QGtkStylePrivate *> instances; 511 static WidgetMap *widgetMap; 446 512 friend class QGtkStyleUpdateScheduler; 447 513 }; -
trunk/src/gui/styles/qmacstyle.qdoc
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 7 7 ** This file is part of the documentation of the Qt Toolkit. 8 8 ** 9 ** $QT_BEGIN_LICENSE: LGPL$9 ** $QT_BEGIN_LICENSE:FDL$ 10 10 ** Commercial Usage 11 11 ** Licensees holding valid Qt Commercial licenses may use this file in 12 12 ** accordance with the Qt Commercial License Agreement provided with the 13 ** Software or, alternatively, in accordance with the terms contained in 14 ** a written agreement between you and Nokia. 15 ** 16 ** GNU Lesser General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU Lesser 18 ** General Public License version 2.1 as published by the Free Software 19 ** Foundation and appearing in the file LICENSE.LGPL included in the 20 ** packaging of this file. Please review the following information to 21 ** ensure the GNU Lesser General Public License version 2.1 requirements 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 23 ** 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 ** 28 ** GNU General Public License Usage 29 ** Alternatively, this file may be used under the terms of the GNU 30 ** General Public License version 3.0 as published by the Free Software 31 ** Foundation and appearing in the file LICENSE.GPL included in the 32 ** packaging of this file. Please review the following information to 33 ** ensure the GNU General Public License version 3.0 requirements will be 34 ** met: http://www.gnu.org/copyleft/gpl.html. 13 ** Software or, alternatively, in accordance with the terms contained in a 14 ** written agreement between you and Nokia. 15 ** 16 ** GNU Free Documentation License 17 ** Alternatively, this file may be used under the terms of the GNU Free 18 ** Documentation License version 1.3 as published by the Free Software 19 ** Foundation and appearing in the file included in the packaging of this 20 ** file. 35 21 ** 36 22 ** If you have questions regarding the use of this file, please contact -
trunk/src/gui/styles/qmacstyle_mac.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 61 61 #endif 62 62 63 class QPushButton; 64 class QStyleOptionButton; 63 65 class QMacStylePrivate; 64 66 class Q_GUI_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle … … 134 136 135 137 QMacStylePrivate *d; 138 139 friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); 136 140 }; 137 141 -
trunk/src/gui/styles/qmacstyle_mac.mm
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 57 57 #include <private/qpainter_p.h> 58 58 #include <private/qprintengine_mac_p.h> 59 #include <private/qstylehelper_p.h>60 59 #include <qapplication.h> 61 60 #include <qbitmap.h> … … 98 97 #include <qlibrary.h> 99 98 #include <qdatetimeedit.h> 99 #include <qmath.h> 100 100 #include <QtGui/qgraphicsproxywidget.h> 101 101 #include <QtGui/qgraphicsview.h> 102 102 #include <private/qt_cocoa_helpers_mac_p.h> 103 #include "qmacstyle_mac_p.h" 104 #include <private/qstylehelper_p.h> 103 105 104 106 QT_BEGIN_NAMESPACE 105 106 extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp107 107 108 108 // The following constants are used for adjusting the size 109 109 // of push buttons so that they are drawn inside their bounds. 110 static const intPushButtonLeftOffset = 6;111 static const intPushButtonTopOffset = 4;112 static const intPushButtonRightOffset = 12;113 static const intPushButtonBottomOffset = 12;114 static const intMiniButtonH = 26;115 static const intSmallButtonH = 30;116 static const intBevelButtonW = 50;117 static const intBevelButtonH = 22;118 static const intPushButtonContentPadding = 6;110 const int QMacStylePrivate::PushButtonLeftOffset = 6; 111 const int QMacStylePrivate::PushButtonTopOffset = 4; 112 const int QMacStylePrivate::PushButtonRightOffset = 12; 113 const int QMacStylePrivate::PushButtonBottomOffset = 12; 114 const int QMacStylePrivate::MiniButtonH = 26; 115 const int QMacStylePrivate::SmallButtonH = 30; 116 const int QMacStylePrivate::BevelButtonW = 50; 117 const int QMacStylePrivate::BevelButtonH = 22; 118 const int QMacStylePrivate::PushButtonContentPadding = 6; 119 119 120 120 // These colors specify the titlebar gradient colors on … … 132 132 static const QColor mainWindowGradientEnd(200, 200, 200); 133 133 134 #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5) 135 enum { 136 kThemePushButtonTextured = 31, 137 kThemePushButtonTexturedSmall = 32, 138 kThemePushButtonTexturedMini = 33 139 }; 140 141 /* Search fields */ 142 enum { 143 kHIThemeFrameTextFieldRound = 1000, 144 kHIThemeFrameTextFieldRoundSmall = 1001, 145 kHIThemeFrameTextFieldRoundMini = 1002 146 }; 147 #endif 134 static const int DisclosureOffset = 4; 148 135 149 136 // Resolve these at run-time, since the functions was moved in Leopard. 150 137 typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *); 151 138 static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0; 139 140 static int closeButtonSize = 12; 141 142 extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp 152 143 153 144 static bool isVerticalTabs(const QTabBar::Shape shape) { … … 157 148 || shape == QTabBar::TriangularWest); 158 149 } 159 160 static int closeButtonSize = 12;161 150 162 151 void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected) … … 238 227 // fill body 239 228 if (active) { 240 p->fillRect(rect, QColor(151, 151, 151)); 229 int d = (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) ? 16 : 0; 230 p->fillRect(rect, QColor(151 + d, 151 + d, 151 + d)); 241 231 } else { 232 int d = (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) ? 9 : 0; 242 233 QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); 243 gradient.setColorAt(0, QColor(207 , 207, 207));244 gradient.setColorAt(0.5, QColor(206 , 206, 206));245 gradient.setColorAt(1, QColor(201 , 201, 201));234 gradient.setColorAt(0, QColor(207 + d, 207 + d, 207 + d)); 235 gradient.setColorAt(0.5, QColor(206 + d, 206 + d, 206 + d)); 236 gradient.setColorAt(1, QColor(201 + d, 201 + d, 201 + d)); 246 237 p->fillRect(rect, gradient); 247 238 } … … 376 367 } 377 368 378 /*379 AHIG:380 Apple Human Interface Guidelines381 http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/382 383 Builder:384 Apple Interface Builder v. 3.1.1385 */386 387 // this works as long as we have at most 16 different control types388 #define CT1(c) CT2(c, c)389 #define CT2(c1, c2) ((uint(c1) << 16) | uint(c2))390 391 enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2,392 QAquaSizeUnknown = -1 };393 394 #define SIZE(large, small, mini) \395 (controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini))396 397 // same as return SIZE(...) but optimized398 #define return_SIZE(large, small, mini) \399 do { \400 static const int sizes[] = { (large), (small), (mini) }; \401 return sizes[controlSize]; \402 } while (0)403 404 369 static int getControlSize(const QStyleOption *option, const QWidget *widget) 405 370 { … … 433 398 QString qt_mac_removeMnemonics(const QString &original) 434 399 { 435 // copied from qt_format_text (to be bug-for-bug compatible).436 400 QString returnText(original.size(), 0); 437 401 int finalDest = 0; … … 439 403 int l = original.length(); 440 404 while (l) { 441 if (original.at(currPos) == QLatin1Char('&')) { 405 if (original.at(currPos) == QLatin1Char('&') 406 && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) { 442 407 ++currPos; 443 408 --l; … … 479 444 } 480 445 481 class QMacStylePrivate : public QObject482 {483 Q_OBJECT484 485 public:486 QMacStylePrivate(QMacStyle *style);487 488 // Stuff from QAquaAnimate:489 bool addWidget(QWidget *);490 void removeWidget(QWidget *);491 492 enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen };493 bool animatable(Animates, const QWidget *) const;494 void stopAnimate(Animates, QWidget *);495 void startAnimate(Animates, QWidget *);496 static ThemeDrawState getDrawState(QStyle::State flags);497 QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg,498 QStyle::ContentsType ct = QStyle::CT_CustomBase,499 QSize szHint=QSize(-1, -1), QSize *insz = 0) const;500 void getSliderInfo(QStyle::ComplexControl cc, const QStyleOptionSlider *slider,501 HIThemeTrackDrawInfo *tdi, const QWidget *needToRemoveMe);502 bool doAnimate(Animates);503 inline int animateSpeed(Animates) const { return 33; }504 505 // Utility functions506 void drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi,507 QPainter *p, const QStyleOption *opt) const;508 509 QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const;510 511 HIRect pushButtonContentBounds(const QStyleOptionButton *btn,512 const HIThemeButtonDrawInfo *bdi) const;513 514 void initComboboxBdi(const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi,515 const QWidget *widget, const ThemeDrawState &tds);516 517 static HIRect comboboxInnerBounds(const HIRect &outerBounds, int buttonKind);518 519 static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi);520 521 static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p);522 static void drawTableHeader(const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder,523 const HIThemeButtonDrawInfo &bdi, QPainter *p);524 bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi,525 ThemeButtonKind buttonKindToCheck) const;526 void initHIThemePushButton(const QStyleOptionButton *btn, const QWidget *widget,527 const ThemeDrawState tds,528 HIThemeButtonDrawInfo *bdi) const;529 QPixmap generateBackgroundPattern() const;530 protected:531 bool eventFilter(QObject *, QEvent *);532 void timerEvent(QTimerEvent *);533 534 private slots:535 void startAnimationTimer();536 537 public:538 QPointer<QPushButton> defaultButton; //default push buttons539 int timerID;540 QList<QPointer<QWidget> > progressBars; //existing progress bars that need animation541 542 struct ButtonState {543 int frame;544 enum { ButtonDark, ButtonLight } dir;545 } buttonState;546 UInt8 progressFrame;547 QPointer<QFocusFrame> focusWidget;548 CFAbsoluteTime defaultButtonStart;549 QMacStyle *q;550 bool mouseDown;551 };552 553 446 QT_BEGIN_INCLUDE_NAMESPACE 554 #include "qmacstyle_mac.moc" 447 #include "moc_qmacstyle_mac.cpp" 448 #include "moc_qmacstyle_mac_p.cpp" 555 449 QT_END_INCLUDE_NAMESPACE 556 450 … … 1053 947 // carbon not calculating the content bounds fully correct 1054 948 if (bdi->kind == kThemePushButton || bdi->kind == kThemePushButtonSmall){ 1055 outerBounds.origin.y += PushButtonTopOffset;1056 outerBounds.size.height -= PushButtonBottomOffset;949 outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset; 950 outerBounds.size.height -= QMacStylePrivate::PushButtonBottomOffset; 1057 951 } else if (bdi->kind == kThemePushButtonMini) { 1058 outerBounds.origin.y += PushButtonTopOffset;952 outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset; 1059 953 } 1060 954 … … 1072 966 QSize csz(0, 0); 1073 967 QSize iconSize = btn->icon.isNull() ? QSize(0, 0) 1074 : (btn->iconSize + QSize( PushButtonContentPadding, 0));968 : (btn->iconSize + QSize(QMacStylePrivate::PushButtonContentPadding, 0)); 1075 969 QRect textRect = btn->text.isEmpty() ? QRect(0, 0, 1, 1) 1076 970 : btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text); … … 1147 1041 // same time displays the button contents without clipping. 1148 1042 bdi->kind = kThemeBevelButton; 1149 if (btn->rect.width() >= BevelButtonW && btn->rect.height() >=BevelButtonH){1043 if (btn->rect.width() >= QMacStylePrivate::BevelButtonW && btn->rect.height() >= QMacStylePrivate::BevelButtonH){ 1150 1044 if (widget && widget->testAttribute(Qt::WA_MacVariableSize)) { 1151 if (btn->rect.height() <= MiniButtonH){1045 if (btn->rect.height() <= QMacStylePrivate::MiniButtonH){ 1152 1046 if (contentFitsInPushButton(btn, bdi, kThemePushButtonMini)) 1153 1047 bdi->kind = kThemePushButtonMini; 1154 } else if (btn->rect.height() <= SmallButtonH){1048 } else if (btn->rect.height() <= QMacStylePrivate::SmallButtonH){ 1155 1049 if (contentFitsInPushButton(btn, bdi, kThemePushButtonSmall)) 1156 1050 bdi->kind = kThemePushButtonSmall; … … 1164 1058 } 1165 1059 } 1060 } 1061 1062 bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option) 1063 { 1064 QMacStyle *macStyle = qobject_cast<QMacStyle *>(pushButton->style()); 1065 if (!macStyle) 1066 return false; 1067 HIThemeButtonDrawInfo bdi; 1068 macStyle->d->initHIThemePushButton(option, pushButton, kThemeStateActive, &bdi); 1069 return bdi.kind == kThemeBevelButton; 1166 1070 } 1167 1071 … … 1537 1441 bool QMacStylePrivate::animatable(QMacStylePrivate::Animates as, const QWidget *w) const 1538 1442 { 1443 if (!w) 1444 return false; 1445 1539 1446 if (as == AquaPushButton) { 1540 1447 QPushButton *pb = const_cast<QPushButton *>(static_cast<const QPushButton *>(w)); … … 1915 1822 painter->setClipRegion(rgn); 1916 1823 1917 CGContextRefcg = qt_mac_cg_context(target);1824 QCFType<CGContextRef> cg = qt_mac_cg_context(target); 1918 1825 CGContextSaveGState(cg); 1919 1826 HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted); … … 2141 2048 if (qstyleoption_cast<const QStyleOptionComboBox *>(opt) != 0) 2142 2049 ret = 0; 2050 // Frame of mac style line edits is two pixels on top and one on the bottom 2051 else if (qobject_cast<const QLineEdit *>(widget) != 0) 2052 ret = 2; 2143 2053 else 2144 ret = QWindowsStyle::pixelMetric(metric, opt, widget);2054 ret = 1; 2145 2055 break; 2146 2056 case PM_MaximumDragDistance: … … 3095 3005 bi.value = opt->direction == Qt::LeftToRight ? kThemeDisclosureRight : kThemeDisclosureLeft; 3096 3006 bi.adornment = kThemeAdornmentNone; 3097 HIRect hirect = qt_hirectForQRect(opt->rect );3007 HIRect hirect = qt_hirectForQRect(opt->rect.adjusted(DisclosureOffset,0,-DisclosureOffset,0)); 3098 3008 HIThemeDrawButton(&hirect, &bi, cg, kHIThemeOrientationNormal, 0); 3099 3009 break; } 3010 3100 3011 case PE_Frame: { 3101 3012 QPen oldPen = p->pen(); 3102 QPen newPen; 3103 newPen.setBrush(opt->palette.dark()); 3104 p->setPen(newPen); 3013 p->setPen(opt->palette.base().color().darker(140)); 3105 3014 p->drawRect(opt->rect.adjusted(0, 0, -1, -1)); 3015 p->setPen(opt->palette.base().color().darker(180)); 3016 p->drawLine(opt->rect.topLeft(), opt->rect.topRight()); 3106 3017 p->setPen(oldPen); 3107 3018 break; } 3019 3108 3020 case PE_FrameLineEdit: 3109 3021 if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { … … 3147 3059 case PE_PanelLineEdit: 3148 3060 QWindowsStyle::drawPrimitive(pe, opt, p, w); 3061 // Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit). 3062 // Focus frame is drawn outside the rectangle passed in the option-rect. 3063 if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { 3064 if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) { 3065 int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin); 3066 int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin); 3067 QStyleOptionFrame focusFrame = *panel; 3068 focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin); 3069 drawControl(CE_FocusFrame, &focusFrame, p, w); 3070 } 3071 } 3072 3149 3073 break; 3150 3074 case PE_FrameTabWidget: … … 3170 3094 } break; 3171 3095 case PE_FrameStatusBarItem: 3172 QCommonStyle::drawPrimitive(pe, opt, p, w);3173 3096 break; 3174 3097 case PE_IndicatorTabClose: { … … 3267 3190 switch (header->position) { 3268 3191 case QStyleOptionHeader::Beginning: 3192 ir.adjust(-1, -1, 0, 0); 3269 3193 break; 3270 3194 case QStyleOptionHeader::Middle: 3195 ir.adjust(-1, -1, 0, 0); 3196 break; 3197 case QStyleOptionHeader::OnlyOneSection: 3271 3198 case QStyleOptionHeader::End: 3272 ir.adjust(-1, 0, 0, 0);3199 ir.adjust(-1, -1, 1, 0); 3273 3200 break; 3274 3201 default: … … 3410 3337 QPalette pal = tb->palette; 3411 3338 QPalette::ColorRole role = QPalette::NoRole; 3339 if (!proxy()->styleHint(SH_UnderlineShortcut, tb, w)) 3340 alignment |= Qt::TextHideMnemonic; 3412 3341 if (down) 3413 3342 cr.translate(shiftX, shiftY); … … 3427 3356 } 3428 3357 } 3429 drawItemText(p, cr, alignment, pal,3430 tb->state & State_Enabled, tb->text, role);3358 proxy()->drawItemText(p, cr, alignment, pal, 3359 tb->state & State_Enabled, tb->text, role); 3431 3360 if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 && 3432 3361 (tb->state & State_Sunken)) { 3433 3362 // Draw a "drop shadow" in earlier versions. 3434 drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment,3435 tb->palette, tb->state & State_Enabled, tb->text);3363 proxy()->drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment, 3364 tb->palette, tb->state & State_Enabled, tb->text); 3436 3365 } 3437 3366 } … … 3472 3401 HIRect newRect = qt_hirectForQRect(btn->rect); 3473 3402 if (bdi.kind == kThemePushButton || bdi.kind == kThemePushButtonSmall) { 3474 newRect.origin.x += PushButtonLeftOffset;3475 newRect.origin.y += PushButtonTopOffset;3476 newRect.size.width -= PushButtonRightOffset;3477 newRect.size.height -= PushButtonBottomOffset;3403 newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset; 3404 newRect.origin.y += QMacStylePrivate::PushButtonTopOffset; 3405 newRect.size.width -= QMacStylePrivate::PushButtonRightOffset; 3406 newRect.size.height -= QMacStylePrivate::PushButtonBottomOffset; 3478 3407 } else if (bdi.kind == kThemePushButtonMini) { 3479 newRect.origin.x += PushButtonLeftOffset - 2;3480 newRect.origin.y += PushButtonTopOffset;3481 newRect.size.width -= PushButtonRightOffset - 4;3408 newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset - 2; 3409 newRect.origin.y += QMacStylePrivate::PushButtonTopOffset; 3410 newRect.size.width -= QMacStylePrivate::PushButtonRightOffset - 4; 3482 3411 } 3483 3412 HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); … … 3486 3415 int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); 3487 3416 QRect ir = btn->rect; 3488 HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset,3417 HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, 3489 3418 ir.height() / 2 - 4, mbi, ir.height() / 2); 3490 3419 bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active; … … 3580 3509 state = QIcon::On; 3581 3510 QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state); 3582 contentW += pixmap.width() + PushButtonContentPadding;3511 contentW += pixmap.width() + QMacStylePrivate::PushButtonContentPadding; 3583 3512 int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2; 3584 3513 int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmap.height()) / 2; … … 3587 3516 proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap); 3588 3517 int newOffset = iconDestRect.x() + iconDestRect.width() 3589 + PushButtonContentPadding - textRect.x();3518 + QMacStylePrivate::PushButtonContentPadding - textRect.x(); 3590 3519 textRect.adjust(newOffset, 0, newOffset, 0); 3591 3520 } … … 4330 4259 4331 4260 switch (sr) { 4261 case SE_ItemViewItemText: 4262 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { 4263 int fw = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, widget); 4264 // We add the focusframeargin between icon and text in commonstyle 4265 rect = QCommonStyle::subElementRect(sr, opt, widget); 4266 if (vopt->features & QStyleOptionViewItemV2::HasDecoration) 4267 rect.adjust(-fw, 0, 0, 0); 4268 } 4269 break; 4332 4270 case SE_ToolBoxTabContents: 4333 4271 rect = QCommonStyle::subElementRect(sr, opt, widget); … … 4347 4285 if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) { 4348 4286 rect = QWindowsStyle::subElementRect(sr, opt, widget); 4349 if (widget && widget->height() <= qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight)){4350 // We need to allow the text a bit more space when the header is as4351 // small as kThemeMetricListHeaderHeight, otherwise it gets clipped:4287 if (widget && widget->height() <= 22){ 4288 // We need to allow the text a bit more space when the header is 4289 // small, otherwise it gets clipped: 4352 4290 rect.setY(0); 4353 4291 rect.setHeight(widget->height()); … … 4376 4314 HIThemeGetButtonShape(&inRect, &bdi, &shape); 4377 4315 ptrHIShapeGetBounds(shape, &outRect); 4378 rect = QRect(int(outRect.origin.x), int(outRect.origin.y), 4379 int(contentRect.origin.x - outRect.origin.x), int(outRect.size.height)); 4316 rect = QRect(int(outRect.origin.x + DisclosureOffset), int(outRect.origin.y), 4317 int(contentRect.origin.x - outRect.origin.x + DisclosureOffset), 4318 int(outRect.size.height)); 4380 4319 break; 4381 4320 } … … 5419 5358 QCFString groupText = qt_mac_removeMnemonics(groupBox->text); 5420 5359 HIThemeGetTextDimensions(groupText, 0, &tti, &width, &height, 0); 5421 tw = int(width);5422 h = int(height);5360 tw = qRound(width); 5361 h = qCeil(height); 5423 5362 } else { 5424 QFontMetrics fm = groupBox->fontMetrics; 5425 if (!checkable && !fontIsSet) 5426 fm = QFontMetrics(qt_app_fonts_hash()->value("QSmallFont", QFont())); 5427 h = fm.height(); 5428 tw = fm.size(Qt::TextShowMnemonic, groupBox->text).width(); 5363 QFontMetricsF fm = QFontMetricsF(groupBox->fontMetrics); 5364 h = qCeil(fm.height()); 5365 tw = qCeil(fm.size(Qt::TextShowMnemonic, groupBox->text).width()); 5429 5366 } 5430 5367 ret.setHeight(h); … … 5473 5410 yOffset = 5; 5474 5411 if (hasNoText) 5475 yOffset = - fm.height();5476 } 5477 5478 ret = opt->rect.adjusted(0, fm.height() + yOffset, 0, 0);5412 yOffset = -qCeil(QFontMetricsF(fm).height()); 5413 } 5414 5415 ret = opt->rect.adjusted(0, qCeil(QFontMetricsF(fm).height()) + yOffset, 0, 0); 5479 5416 if (sc == SC_GroupBoxContents) 5480 5417 ret.adjust(3, 3, -3, -4); // guess … … 5675 5612 // Do this by add enough space around the contents so that rounded 5676 5613 // borders (including highlighting when active) will show. 5677 sz.rwidth() += PushButtonLeftOffset +PushButtonRightOffset + 12;5678 sz.rheight() += PushButtonTopOffset +PushButtonBottomOffset;5614 sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12; 5615 sz.rheight() += QMacStylePrivate::PushButtonTopOffset + QMacStylePrivate::PushButtonBottomOffset; 5679 5616 break; 5680 5617 case QStyle::CT_MenuItem: … … 5768 5705 } 5769 5706 break; 5707 case CT_ItemViewItem: 5708 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { 5709 sz = QCommonStyle::sizeFromContents(ct, vopt, csz, widget); 5710 sz.setHeight(sz.height() + 2); 5711 } 5712 break; 5713 5770 5714 default: 5771 5715 sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget); -
trunk/src/gui/styles/qmacstylepixmaps_mac_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 40 40 ****************************************************************************/ 41 41 42 #ifndef QMACSTYLEPIXMAPS_MAC_P_H 43 #define QMACSTYLEPIXMAPS_MAC_P_H 44 42 45 // 43 46 // W A R N I N G … … 66 69 "ab###bb###baaa", 67 70 ".###..###.aaaa"}; 71 72 #endif // QMACSTYLEPIXMAPS_MAC_P_H -
trunk/src/gui/styles/qmotifstyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qmotifstyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qmotifstyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qplastiquestyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 51 51 52 52 #include "qwindowsstyle_p.h" 53 #include <private/qstylehelper_p.h>54 53 #include <qapplication.h> 55 54 #include <qbitmap.h> … … 57 56 #include <qcheckbox.h> 58 57 #include <qcombobox.h> 59 #include <qdatetime.h>60 58 #include <qdebug.h> 61 59 #include <qdialogbuttonbox.h> … … 82 80 #include <qstyleoption.h> 83 81 #include <qtextedit.h> 82 #include <qelapsedtimer.h> 84 83 #include <qtoolbar.h> 85 84 #include <qtoolbox.h> … … 89 88 #include <qvarlengtharray.h> 90 89 #include <limits.h> 90 #include <private/qstylehelper_p.h> 91 91 92 92 QT_BEGIN_NAMESPACE … … 489 489 QPixmap texture = brush->texture(); 490 490 QPixmap pixmap; 491 QString name = QString::fromLatin1("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.cacheKey()); 491 QString name = QLatin1Literal("qbrushtexture-alpha") 492 % HexString<qreal>(alpha) 493 % HexString<qint64>(texture.cacheKey()); 492 494 if (!QPixmapCache::find(name, pixmap)) { 493 495 QImage image = texture.toImage(); … … 550 552 QPixmap texture = brush.texture(); 551 553 QPixmap pixmap; 552 QString name = QString::fromLatin1("qbrushtexture-light-%1-%2").arg(light).arg(texture.cacheKey()); 554 QString name = QLatin1Literal("qbrushtexture-light") 555 % HexString<int>(light) 556 % HexString<qint64>(texture.cacheKey()); 557 553 558 if (!QPixmapCache::find(name, pixmap)) { 554 559 QImage image = texture.toImage(); … … 609 614 QPixmap texture = brush.texture(); 610 615 QPixmap pixmap; 611 QString name = QString::fromLatin1("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().cacheKey()); 616 QString name = QLatin1Literal("qbrushtexture-dark") 617 % HexString<int>(dark) 618 % HexString<qint64>(texture.cacheKey()); 619 612 620 if (!QPixmapCache::find(name, pixmap)) { 613 621 QImage image = texture.toImage(); … … 733 741 const QColor &gradientStop) 734 742 { 735 QString gradientName; 736 gradientName.sprintf("%dx%d-%x-%x", rect.width(), rect.height(), gradientStart.rgba(), gradientStop.rgba()); 743 QString gradientName = QLatin1Literal("qplastique-g") 744 % HexString<int>(rect.width()) 745 % HexString<int>(rect.height()) 746 % HexString<QRgb>(gradientStart.rgba()) 747 % HexString<QRgb>(gradientStop.rgba()); 748 737 749 QPixmap cache; 738 750 QPainter *p = painter; … … 981 993 QList<QProgressBar *> bars; 982 994 int progressBarAnimateTimer; 983 Q Timetimer;995 QElapsedTimer timer; 984 996 #endif 985 997 }; … … 1093 1105 1094 1106 QColor borderColor = option->palette.background().color().darker(178); 1095 QColor gradientStartColor = option->palette.button().color().lighter(104);1096 QColor gradientStopColor = option->palette.button().color().darker(105);1097 QColor highlightedGradientStartColor = option->palette.button().color().lighter(101);1098 QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85);1099 QColor highlightedBaseGradientStartColor = option->palette.base().color();1100 QColor highlightedBaseGradientStopColor = mergedColors(option->palette.base().color().darker(105), option->palette.highlight().color(), 70);1101 QColor highlightedDarkInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 35);1102 QColor highlightedLightInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 58);1103 1107 QColor alphaCornerColor; 1104 1108 if (widget) { … … 1108 1112 alphaCornerColor = mergedColors(option->palette.background().color(), borderColor); 1109 1113 } 1110 QColor alphaInnerColor = mergedColors(highlightedLightInnerBorderColor, gradientStartColor);1111 QColor alphaInnerColorNoHover = mergedColors(borderColor, gradientStartColor);1112 1114 QColor alphaTextColor = mergedColors(option->palette.background().color(), option->palette.text().color()); 1113 QColor alphaLightTextColor = mergedColors(option->palette.background().color().lighter(250), option->palette.text().color().lighter(250));1114 QColor lightShadow = option->palette.button().color().lighter(105);1115 QColor shadowGradientStartColor = option->palette.button().color().darker(115);1116 QColor shadow = shadowGradientStartColor;1117 1115 1118 1116 switch (element) { … … 2058 2056 2059 2057 int lowerTop = selected ? 0 : 3; // to make the selected tab bigger than the rest 2060 QRect adjustedRect;2061 2058 bool atEnd = (tab->position == QStyleOptionTab::End) || onlyTab; 2062 2059 bool atBeginning = ((tab->position == QStyleOptionTab::Beginning) || onlyTab) … … 5847 5844 { 5848 5845 QWindowsStyle::polish(pal); 5849 pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110));5850 5846 #ifdef Q_WS_MAC 5851 5847 pal.setBrush(QPalette::Shadow, Qt::black); -
trunk/src/gui/styles/qplastiquestyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qproxystyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 41 41 42 42 #include <qstyle.h> 43 #include <private/qstyle_p.h>44 43 #include <private/qproxystyle_p.h> 45 44 #include <private/qapplication_p.h> 46 45 #include "qproxystyle.h" 47 46 #include "qstylefactory.h" 47 #include <private/qstyle_p.h> 48 48 49 49 #if !defined(QT_NO_STYLE_PROXY) || defined(QT_PLUGIN) -
trunk/src/gui/styles/qproxystyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qproxystyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qs60style.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 97 97 {360,640,1,19,"NHD Landscape"}, 98 98 {640,360,1,19,"NHD Portrait"}, 99 {352,800,1,12,"E90 Landscape"} 99 {352,800,1,12,"E90 Landscape"}, 100 {480,640,1,19,"VGA Landscape"} 100 101 // *** End of generated data *** 101 102 }; … … 105 106 const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { 106 107 // *** generated pixel metrics *** 107 {5,0,-909,0,0,2,0,0,-1,7,12,22,15,15,7,198,-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,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,46,37,37,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,46,37,37,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,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} 108 {5,0,-909,0,0,2,0,2,-1,7,12,22,15,15,7,198,-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}, 109 {5,0,-909,0,0,1,0,2,-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}, 110 {7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,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,3,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}, 111 {7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,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,3,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}, 112 {7,0,-909,0,0,2,0,2,-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}, 113 {9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} 112 114 // *** End of generated data *** 113 115 }; … … 136 138 {SE_ToolTip, QS60StyleEnums::SP_QsnFrPopupPreviewCenter}, 137 139 {SE_ToolBar, QS60StyleEnums::SP_QsnFrPopupSubCenter}, 138 {SE_ToolBarButton, QS60StyleEnums::SP_Q snFrSctrlButtonCenter},139 {SE_ToolBarButtonPressed, QS60StyleEnums::SP_Q snFrSctrlButtonCenterPressed},140 {SE_ToolBarButton, QS60StyleEnums::SP_QgnFrSctrlButtonCenter}, 141 {SE_ToolBarButtonPressed, QS60StyleEnums::SP_QgnFrSctrlButtonCenterPressed}, 140 142 {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter}, 141 143 {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive}, 142 144 {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter}, 143 145 {SE_TableItemPressed, QS60StyleEnums::SP_QsnFrGridCenterPressed}, 144 {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrList Pressed},146 {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListCenterPressed}, 145 147 }; 146 148 … … 155 157 clearCaches(); //deletes also background image 156 158 deleteThemePalette(); 159 #ifdef Q_WS_S60 160 removeAnimations(); 161 #endif 157 162 } 158 163 … … 403 408 break; 404 409 case CC_ThemeChange: 405 m_colorCache.clear();406 410 QPixmapCache::clear(); 411 #ifdef Q_WS_S60 412 deleteStoredSettings(); 413 #endif 407 414 deleteBackground(); 408 415 break; 409 416 case CC_UndefinedChange: 410 417 default: 411 m_colorCache.clear();412 418 m_mappedFontsCache.clear(); 413 419 QPixmapCache::clear(); … … 417 423 } 418 424 419 // Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use 420 // for QPalette::Button and QPalette::ToolTipBase. Therefore S60Style needs to guesstimate 421 // palette colors by calculating average rgb values for button pixels. 422 // Returns Qt::black if there is an issue with the graphics (image is NULL, or no bits() found). 423 QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const 424 { 425 const bool cachedColorExists = m_colorCache.contains(frame); 426 if (!cachedColorExists) { 427 const int frameCornerWidth = pixelMetric(PM_FrameCornerWidth); 428 const int frameCornerHeight = pixelMetric(PM_FrameCornerHeight); 429 Q_ASSERT(2 * frameCornerWidth < 32); 430 Q_ASSERT(2 * frameCornerHeight < 32); 431 432 const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32, 32)).toImage(); 433 Q_ASSERT(frameImage.bytesPerLine() > 0); 434 if (frameImage.isNull()) 435 return Qt::black; 436 437 const QRgb *pixelRgb = (const QRgb*)frameImage.bits(); 438 const int pixels = frameImage.byteCount()/sizeof(QRgb); 439 440 int estimatedRed = 0; 441 int estimatedGreen = 0; 442 int estimatedBlue = 0; 443 444 int skips = 0; 445 int estimations = 0; 446 447 const int topBorderLastPixel = frameCornerHeight*frameImage.width() - 1; 448 const int bottomBorderFirstPixel = frameImage.width() * frameImage.height() - frameCornerHeight*frameImage.width() - 1; 449 const int rightBorderFirstPixel = frameImage.width() - frameCornerWidth; 450 const int leftBorderLastPixel = frameCornerWidth; 451 452 while ((skips + estimations) < pixels) { 453 if ((skips + estimations) > topBorderLastPixel && 454 (skips + estimations) < bottomBorderFirstPixel) { 455 for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) { 456 if (rowIndex > leftBorderLastPixel && 457 rowIndex < rightBorderFirstPixel) { 458 estimatedRed += qRed(*pixelRgb); 459 estimatedGreen += qGreen(*pixelRgb); 460 estimatedBlue += qBlue(*pixelRgb); 461 } 462 pixelRgb++; 463 estimations++; 425 QColor QS60StylePrivate::calculatedColor(SkinFrameElements frame) const 426 { 427 const int frameCornerWidth = pixelMetric(PM_FrameCornerWidth); 428 const int frameCornerHeight = pixelMetric(PM_FrameCornerHeight); 429 Q_ASSERT(2 * frameCornerWidth < 32); 430 Q_ASSERT(2 * frameCornerHeight < 32); 431 432 const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32, 32)).toImage(); 433 Q_ASSERT(frameImage.bytesPerLine() > 0); 434 if (frameImage.isNull()) 435 return Qt::black; 436 437 const QRgb *pixelRgb = (const QRgb*)frameImage.constBits(); 438 const int pixels = frameImage.byteCount() / sizeof(QRgb); 439 440 int estimatedRed = 0; 441 int estimatedGreen = 0; 442 int estimatedBlue = 0; 443 444 int skips = 0; 445 int estimations = 0; 446 447 const int topBorderLastPixel = frameCornerHeight * frameImage.width() - 1; 448 const int bottomBorderFirstPixel = frameImage.width() * frameImage.height() - topBorderLastPixel; 449 const int rightBorderFirstPixel = frameImage.width() - frameCornerWidth; 450 const int leftBorderLastPixel = frameCornerWidth; 451 452 while ((skips + estimations) < pixels) { 453 if ((skips + estimations) > topBorderLastPixel && 454 (skips + estimations) < bottomBorderFirstPixel) { 455 for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) { 456 if (rowIndex > leftBorderLastPixel && 457 rowIndex < rightBorderFirstPixel) { 458 estimatedRed += qRed(*pixelRgb); 459 estimatedGreen += qGreen(*pixelRgb); 460 estimatedBlue += qBlue(*pixelRgb); 464 461 } 465 } else {466 462 pixelRgb++; 467 skips++; 468 } 469 } 470 QColor frameColor(estimatedRed/estimations, estimatedGreen/estimations, estimatedBlue/estimations); 471 m_colorCache.insert(frame, frameColor); 472 return !estimations ? Qt::black : frameColor; 473 } else { 474 return m_colorCache.value(frame); 475 } 476 463 estimations++; 464 } 465 } else { 466 pixelRgb++; 467 skips++; 468 } 469 } 470 QColor frameColor(estimatedRed/estimations, estimatedGreen/estimations, estimatedBlue/estimations); 471 return !estimations ? Qt::black : frameColor; 477 472 } 478 473 … … 487 482 { 488 483 return m_themePalette; 484 } 485 486 bool QS60StylePrivate::equalToThemePalette(QColor color, QPalette::ColorRole role) 487 { 488 if (!m_themePalette) 489 return false; 490 if (color == m_themePalette->color(role)) 491 return true; 492 return false; 493 } 494 495 bool QS60StylePrivate::equalToThemePalette(qint64 cacheKey, QPalette::ColorRole role) 496 { 497 if (!m_themePalette) 498 return false; 499 if (cacheKey == m_themePalette->brush(role).texture().cacheKey()) 500 return true; 501 return false; 489 502 } 490 503 … … 711 724 // set as transparent so that styled full screen theme background is visible 712 725 palette->setBrush(QPalette::Base, Qt::transparent); 713 // set button and tooltipbase based on pixel colors 726 // set button color based on pixel colors 727 #ifndef Q_WS_S60 728 //For emulated style, just calculate the color every time 729 const QColor buttonColor = calculatedColor(SF_ButtonNormal); 730 #else 714 731 const QColor buttonColor = colorFromFrameGraphics(SF_ButtonNormal); 732 #endif 715 733 palette->setColor(QPalette::Button, buttonColor); 716 const QColor toolTipColor = colorFromFrameGraphics(SF_ToolTip);717 palette->setColor(QPalette::ToolTipBase, toolTipColor);718 734 palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter()); 719 735 palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker()); … … 817 833 QApplication::setPalette(widgetPalette, "QLineEdit"); 818 834 QApplication::setPalette(widgetPalette, "QTextEdit"); 819 widgetPalette = *palette;820 821 widgetPalette.setColor(QPalette::HighlightedText,822 s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));823 835 QApplication::setPalette(widgetPalette, "QComboBox"); 836 QApplication::setPalette(widgetPalette, "QSpinBox"); 824 837 widgetPalette = *palette; 825 838 … … 1061 1074 QStyleOptionFrame buttonOption; 1062 1075 buttonOption.QStyleOption::operator=(*cmb); 1063 const int max Height = cmbxFrame.height();1064 const int maxWidth = cmbxFrame.width() - cmbxEditField.width();1076 const int maxButtonSide = cmbxFrame.width() - cmbxEditField.width(); 1077 const int newTop = cmbxEditField.center().y() - maxButtonSide / 2; 1065 1078 const int topLeftPoint = direction ? 1066 (cmbxEditField.right() + 1) : (cmbxEditField.left() + 1 - max Width);1067 const QRect buttonRect(topLeftPoint, cmbxEditField.top(), maxWidth, maxHeight);1079 (cmbxEditField.right() + 1) : (cmbxEditField.left() + 1 - maxButtonSide); 1080 const QRect buttonRect(topLeftPoint, newTop, maxButtonSide, maxButtonSide); 1068 1081 buttonOption.rect = buttonRect; 1069 1082 buttonOption.state = cmb->state; … … 1098 1111 State mflags = bflags; 1099 1112 if (toolBtn->state & State_Sunken) { 1100 if (toolBtn->activeSubControls & SC_ToolButton) 1101 bflags |= State_Sunken; 1113 bflags |= State_Sunken; 1102 1114 mflags |= State_Sunken; 1103 1115 } … … 1115 1127 tool.rect = button.unite(menuRect); 1116 1128 tool.state = bflags; 1117 const QToolButton *toolButtonWidget = qobject_cast<const QToolButton *>(widget);1118 const QS60StylePrivate::SkinElements element =1119 ((toolButtonWidget && toolButtonWidget->isDown()) || (option->state & State_Sunken)) ?1120 QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton;1121 QS60StylePrivate::drawSkinElement(element, painter, tool.rect, flags);1122 1129 drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); 1123 1130 } … … 1435 1442 const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget); 1436 1443 1437 // draw themed background for table unless background brush has been defined. 1444 const bool singleSelection = itemView && 1445 ((itemView->selectionMode() == QAbstractItemView::SingleSelection || 1446 itemView->selectionMode() == QAbstractItemView::NoSelection)); 1447 const bool selectItems = itemView && (itemView->selectionBehavior() == QAbstractItemView::SelectItems); 1448 1449 // draw themed background for itemview unless background brush has been defined. 1438 1450 if (vopt->backgroundBrush == Qt::NoBrush) { 1439 1451 if (itemView) { 1452 //With single item selection, use highlight focus as selection indicator. 1453 if (singleSelection && isSelected){ 1454 voptAdj.state = voptAdj.state | State_HasFocus; 1455 if (!hasFocus && selectItems) { 1456 painter->save(); 1457 painter->setOpacity(0.5); 1458 } 1459 } 1440 1460 drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget); 1461 if (singleSelection && isSelected && !hasFocus && selectItems) 1462 painter->restore(); 1441 1463 } 1442 1464 } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);} … … 1447 1469 voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state); 1448 1470 1449 // Draw selection check mark. Show check mark only in multi selection modes. 1450 if (itemView) { 1451 const bool singleSelection = 1452 (itemView->selectionMode() == QAbstractItemView::SingleSelection || 1453 itemView->selectionMode() == QAbstractItemView::NoSelection)|| 1454 (itemView->selectionModel()->selectedIndexes().count() < 2 ); 1455 1456 const bool selectItemsOnly = (itemView->selectionBehavior() == QAbstractItemView::SelectItems); 1457 1471 // Draw selection check mark or checkbox 1472 if (itemView && (!singleSelection || (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator))) { 1458 1473 const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); 1459 1474 … … 1462 1477 checkMarkOption.rect = selectionRect; 1463 1478 // Draw selection mark. 1464 if (isSelected && !singleSelection && selectItemsOnly) {1479 if (isSelected && selectItems) { 1465 1480 proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); 1466 1481 // @todo: this should happen in the rect retrievel i.e. subElementRect() 1467 1482 if (textRect.right() > selectionRect.left()) 1468 1483 textRect.setRight(selectionRect.left()); 1469 } else if (singleSelection && 1470 voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { 1484 } else if (voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { 1471 1485 checkMarkOption.state = checkMarkOption.state & ~State_HasFocus; 1472 1486 … … 1488 1502 // draw the text 1489 1503 if (!voptAdj.text.isEmpty()) { 1490 if ( isSelected || hasFocus)1504 if (hasFocus) 1491 1505 painter->setPen(voptAdj.palette.highlightedText().color()); 1492 1506 else … … 1751 1765 const bool enabled = optionMenuItem.state & State_Enabled; 1752 1766 const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; 1767 bool ignoreCheckMark = false; 1768 1769 #ifndef QT_NO_COMBOBOX 1770 if (qobject_cast<const QComboBox*>(widget)) 1771 ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate 1772 #endif 1753 1773 1754 1774 uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip … … 1757 1777 text_flags |= Qt::TextHideMnemonic; 1758 1778 1759 const bool selected = (option->state & State_Selected) && (option->state & State_Enabled);1760 if (selected)1761 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags);1762 1763 1779 QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); 1764 1780 QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); 1765 1781 1766 //todo: move the vertical spacing stuff into subElementRect 1782 QStyleOptionMenuItem optionCheckBox; 1783 1784 //Regardless of checkbox visibility, make room for it, this mirrors native implementation, 1785 //where text and icon placement is static regardless of content of menu item. 1786 optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); 1787 optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); 1788 optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); 1789 1767 1790 const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing); 1768 if (checkable){ 1769 const int hSpacing = QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing); 1770 QStyleOptionMenuItem optionCheckBox; 1771 optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); 1772 optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); 1773 optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); 1774 optionCheckBox.rect.moveCenter(QPoint( 1775 optionCheckBox.rect.center().x(), 1776 menuItem->rect.center().y())); 1777 const int moveByX = optionCheckBox.rect.width() + vSpacing; 1778 if (optionMenuItem.direction == Qt::LeftToRight) { 1779 textRect.translate(moveByX, 0); 1780 iconRect.translate(moveByX, 0); 1781 iconRect.setWidth(iconRect.width() + vSpacing); 1782 textRect.setWidth(textRect.width() - moveByX - vSpacing); 1783 optionCheckBox.rect.translate(vSpacing >> 1, hSpacing >> 1); 1784 } else { 1785 textRect.setWidth(textRect.width() - moveByX); 1786 iconRect.setWidth(iconRect.width() + vSpacing); 1787 iconRect.translate(-optionCheckBox.rect.width() - vSpacing, 0); 1788 optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0); 1789 } 1791 //The vertical spacing is doubled; it needs one spacing to separate checkbox from 1792 //highlight and then it needs one to separate it whatever is shown after it (text/icon/both). 1793 const int moveByX = optionCheckBox.rect.width() + 2 * vSpacing; 1794 optionCheckBox.rect.moveCenter(QPoint( 1795 optionCheckBox.rect.center().x() + moveByX >> 1, 1796 menuItem->rect.center().y())); 1797 1798 if (optionMenuItem.direction != Qt::LeftToRight) 1799 optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0); 1800 1801 1802 const bool selected = (option->state & State_Selected) && (option->state & State_Enabled); 1803 if (selected) { 1804 const int spacing = ignoreCheckMark ? (vSpacing + QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth)) : 0; 1805 const int start = optionMenuItem.rect.left() + spacing; 1806 const int end = optionMenuItem.rect.right() - spacing; 1807 //-1 adjustment to avoid highlight being on top of possible separator item 1808 const QRect highlightRect = QRect( 1809 QPoint(start, option->rect.top()), 1810 QPoint(end, option->rect.bottom() - 1)); 1811 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags); 1812 } 1813 1814 if (checkable && !ignoreCheckMark) 1790 1815 drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget); 1791 } 1816 1792 1817 //draw icon and/or checkState 1793 1818 QPixmap pix = menuItem->icon.pixmap(pixelMetric(PM_SmallIconSize), … … 1800 1825 else 1801 1826 textRect.translate(-vSpacing, 0); 1802 textRect.setWidth(textRect.width() -vSpacing);1827 textRect.setWidth(textRect.width() - vSpacing); 1803 1828 } 1804 1829 … … 1818 1843 painter->save(); 1819 1844 painter->setPen(option->palette.windowText().color()); 1820 QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSub Menu, painter, arrowOptions.rect,1845 QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSubmenu, painter, arrowOptions.rect, 1821 1846 (flags | QS60StylePrivate::SF_ColorSkinned | arrowDirection)); 1822 1847 painter->restore(); … … 1838 1863 optionMenuItem.palette, enabled, 1839 1864 optionMenuItem.text, QPalette::Text); 1865 1866 //In Sym^3, native menu items have "lines" between them 1867 if (QS60StylePrivate::isSingleClickUi()) { 1868 const QColor lineColorAlpha = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 15, 0); 1869 const int spacing = QS60StylePrivate::pixelMetric(PM_FrameCornerWidth); 1870 //native platform sets each color byte to same value for "line 16" which just defines alpha for 1871 //menuitem lines; lets use first byte "red". 1872 QColor lineColor = optionMenuItem.palette.text().color(); 1873 if (lineColorAlpha.isValid()) 1874 lineColor.setAlpha(lineColorAlpha.red()); 1875 painter->save(); 1876 painter->setPen(lineColor); 1877 1878 const int lineStartX = optionMenuItem.rect.left() + (QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) - 2) + spacing; 1879 const int lineEndX = optionMenuItem.rect.right() - (QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) - 2) - spacing; 1880 painter->drawLine(QPoint(lineStartX, optionMenuItem.rect.bottom()), QPoint(lineEndX, optionMenuItem.rect.bottom())); 1881 painter->restore(); 1882 } 1840 1883 if (!enabled) 1841 1884 painter->restore(); … … 1952 1995 if (const QTextEdit *textEdit = qobject_cast<const QTextEdit *>(widget)) { 1953 1996 const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option); 1954 if ( QS60StylePrivate::canDrawThemeBackground(frame->palette.base(), widget))1997 if (frame && QS60StylePrivate::canDrawThemeBackground(frame->palette.base(), widget)) 1955 1998 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags); 1956 1999 else … … 2019 2062 break; 2020 2063 case CE_Splitter: 2021 if (option->state & State_Sunken && option->state & State_Enabled ) {2064 if (option->state & State_Sunken && option->state & State_Enabled && QS60StylePrivate::themePalette()) { 2022 2065 painter->save(); 2023 2066 painter->setOpacity(0.5); … … 2046 2089 //Draw themed highlight to radiobuttons and checkboxes. 2047 2090 //For other widgets skip, unless palette has been modified. In that case, draw with commonstyle. 2048 if ( option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) {2091 if (QS60StylePrivate::equalToThemePalette(option->palette.highlight().color(), QPalette::Highlight)) { 2049 2092 if ((qstyleoption_cast<const QStyleOptionFocusRect *>(option) && 2050 2093 (qobject_cast<const QRadioButton *>(widget) || qobject_cast<const QCheckBox *>(widget)))) … … 2078 2121 painter->save(); 2079 2122 2080 const QColor themeColor = QS60StylePrivate::themePalette()->windowText().color(); 2081 const QColor windowTextColor = option->palette.windowText().color(); 2082 2083 if (themeColor != windowTextColor) 2084 painter->setPen(windowTextColor); 2123 if (QS60StylePrivate::equalToThemePalette(option->palette.windowText().color(), QPalette::WindowText)) 2124 painter->setPen(option->palette.windowText().color()); 2085 2125 2086 2126 QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags | QS60StylePrivate::SF_ColorSkinned ); … … 2146 2186 case PE_FrameButtonBevel: 2147 2187 if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)) { 2148 const bool isPressed = option->state & State_Sunken; 2149 const QS60StylePrivate::SkinElements skinElement = 2150 isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; 2188 const bool isPressed = (option->state & State_Sunken) || (option->state & State_On); 2189 QS60StylePrivate::SkinElements skinElement; 2190 if (element == PE_PanelButtonTool) 2191 skinElement = isPressed ? QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton; 2192 else 2193 skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; 2151 2194 QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); 2152 2195 } else { … … 2232 2275 //Need extra check since dialogs have their own theme background 2233 2276 if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) && 2234 option->palette.window().texture().cacheKey() == 2235 QS60StylePrivate::m_themePalette->window().texture().cacheKey()) 2277 QS60StylePrivate::equalToThemePalette(option->palette.window().texture().cacheKey(), QPalette::Window)) 2278 //todo: for combobox listviews, the background should include area for menu scrollers, 2279 //but this produces drawing issues as we need to turn clipping off. 2236 2280 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, option->rect, flags); 2237 2281 else … … 2278 2322 const bool isPressed = QS60StylePrivate::isWidgetPressed(widget); 2279 2323 2280 if ( option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) {2324 if (QS60StylePrivate::equalToThemePalette(option->palette.highlight().color(), QPalette::Highlight)) { 2281 2325 QRect highlightRect = vopt->rect.adjusted(1,1,-1,-1); 2282 2326 const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget); … … 2284 2328 itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; 2285 2329 // Set the draw area for highlights (focus, select rect or pressed rect) 2286 if (hasFocus || is Selected || isPressed) {2330 if (hasFocus || isPressed) { 2287 2331 if (selectionBehavior != QAbstractItemView::SelectItems) { 2288 2332 // set highlight rect so that it is continuous from cell to cell, yet sligthly … … 2310 2354 2311 2355 QS60StylePrivate::SkinElements element; 2356 bool themeGraphicDefined = false; 2312 2357 QRect elementRect = option->rect; 2313 2358 2314 2359 //draw item is drawn as pressed, if it already has focus. 2315 if (isPressed && (hasFocus || isSelected)) { 2360 if (isPressed && hasFocus) { 2361 themeGraphicDefined = true; 2316 2362 element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed; 2317 2363 } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) { 2318 2364 element = QS60StylePrivate::SE_ListHighlight; 2319 2365 elementRect = highlightRect; 2366 themeGraphicDefined = true; 2320 2367 } 2321 QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); 2368 if (themeGraphicDefined) 2369 QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); 2322 2370 } else { 2323 2371 QCommonStyle::drawPrimitive(element, option, painter, widget); … … 2399 2447 #ifndef QT_NO_ITEMVIEWS 2400 2448 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { 2401 if ( vopt->palette.base().texture().cacheKey() != QS60StylePrivate::m_themePalette->base().texture().cacheKey()) {2449 if (!QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) { 2402 2450 //QPalette::Base has been changed, let commonstyle draw the item 2403 2451 commonStyleDraws = true; … … 2470 2518 } 2471 2519 2472 if (widget && (metric == PM_LayoutTopMargin ))2520 if (widget && (metric == PM_LayoutTopMargin || metric == PM_LayoutLeftMargin || metric == PM_LayoutRightMargin)) 2473 2521 if (widget->windowType() == Qt::Dialog) 2474 //double the top layout marginfor dialogs, it is very close to real value2522 //double the layout margins (except bottom) for dialogs, it is very close to real value 2475 2523 //without having to define custom pixel metric 2476 2524 metricValue *= 2; 2477 2478 if (widget && (metric == PM_FocusFrameHMargin))2479 if (qobject_cast<const QTableView *>(widget))2480 //Halve the focus frame margin for table items2481 metricValue /= 2;2482 2525 2483 2526 return metricValue; … … 2497 2540 if (toolBtn->subControls & SC_ToolButtonMenu) 2498 2541 sz += QSize(pixelMetric(PM_MenuButtonIndicator), 0); 2542 2543 //Make toolbuttons in toolbar stretch the whole screen area 2544 if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) { 2545 const QToolBar *tb = qobject_cast<const QToolBar *>(widget->parentWidget()); 2546 const bool parentCanGrowHorizontally = !(tb->sizePolicy().horizontalPolicy() == QSizePolicy::Fixed || 2547 tb->sizePolicy().horizontalPolicy() == QSizePolicy::Maximum) && tb->orientation() == Qt::Horizontal; 2548 2549 if (parentCanGrowHorizontally) { 2550 int visibleButtons = 0; 2551 //Make the auto-stretch to happen only for horizontal orientation 2552 if (tb && tb->orientation() == Qt::Horizontal) { 2553 QList<QAction*> actionList = tb->actions(); 2554 for (int i = 0; i < actionList.count(); i++) { 2555 if (actionList.at(i)->isVisible()) 2556 visibleButtons++; 2557 } 2558 } 2559 2560 if (widget->parentWidget() && visibleButtons > 0) { 2561 QWidget *w = const_cast<QWidget *>(widget); 2562 int toolBarMaxWidth = 0; 2563 int totalMargin = 0; 2564 while (w) { 2565 //honor fixed width parents 2566 if (w->maximumWidth() == w->minimumWidth()) 2567 toolBarMaxWidth = qMax(toolBarMaxWidth, w->maximumWidth()); 2568 if (w->layout() && w->windowType() == Qt::Widget) { 2569 totalMargin += w->layout()->contentsMargins().left() + 2570 w->layout()->contentsMargins().right(); 2571 } 2572 w = w->parentWidget(); 2573 } 2574 totalMargin += 2 * pixelMetric(QStyle::PM_ToolBarFrameWidth); 2575 2576 if (toolBarMaxWidth == 0) 2577 toolBarMaxWidth = 2578 QApplication::desktop()->availableGeometry(widget->parentWidget()).width(); 2579 //Reduce the margins, toolbar frame, item spacing and internal margin from available area 2580 toolBarMaxWidth -= totalMargin; 2581 2582 //ensure that buttons are side-by-side and not on top of each other 2583 const int toolButtonWidth = (toolBarMaxWidth / visibleButtons) 2584 - pixelMetric(QStyle::PM_ToolBarItemSpacing) 2585 - pixelMetric(QStyle::PM_ToolBarItemMargin) 2586 //toolbar frame needs to be reduced again, since QToolBarLayout adds it for each toolbar action 2587 - 2 * pixelMetric(QStyle::PM_ToolBarFrameWidth) - 1; 2588 sz.setWidth(qMax(toolButtonWidth, sz.width())); 2589 } 2590 } 2591 } 2499 2592 break; 2500 2593 case CT_PushButton: … … 2549 2642 } 2550 2643 sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); 2644 //native items have small empty areas at the beginning and end of menu item 2645 sz.setWidth(sz.width() + 2 * pixelMetric(PM_MenuHMargin) + 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth)); 2551 2646 if (QS60StylePrivate::isTouchSupported()) 2552 2647 //Make itemview easier to use in touch devices 2553 2648 //QCommonStyle does not adjust height with horizontal margin, it only adjusts width 2554 sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin) );2649 sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin) - 8); //QCommonstyle adds 8 to height that this style handles through PM values 2555 2650 break; 2556 2651 #ifndef QT_NO_COMBOBOX … … 2569 2664 break; 2570 2665 } 2666 if (!sz.isValid()) 2667 sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); 2571 2668 return sz; 2572 2669 } … … 2790 2887 const int width = cmb->rect.width(); 2791 2888 const int height = cmb->rect.height(); 2792 const int buttonIconSize = QS60StylePrivate::pixelMetric(PM_ButtonIconSize);2793 2889 const int buttonMargin = cmb->frame ? 2 : 0; 2794 2890 // lets use spinbox frame here as well, as no combobox specific value available. 2795 2891 const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0; 2796 const int buttonWidth = qMax(cmb->rect.height(), buttonIconSize); 2797 2892 const int buttonMinSize = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin; 2798 2893 QSize buttonSize; 2799 buttonSize.setWidth(buttonWidth + 2 * buttonMargin); 2800 buttonSize.setHeight(qMax(8, (cmb->rect.height() >> 1) - frameThickness)); //buttons should be squares 2894 //allow button to grow to one fourth of the frame height, if the frame is really tall 2895 buttonSize.setHeight(qMin(height, qMax(width / 4, buttonMinSize))); 2896 buttonSize.setWidth(buttonSize.height()); 2801 2897 buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); 2802 2898 switch (scontrol) { 2803 2899 case SC_ComboBoxArrow: { 2804 const int xposMod = cmb->rect.x() + width - buttonMargin - button Width;2900 const int xposMod = cmb->rect.x() + width - buttonMargin - buttonSize.width(); 2805 2901 const int ypos = cmb->rect.y(); 2806 ret.setRect(xposMod, ypos + buttonMargin, button Width, height - 2 * buttonMargin);2902 ret.setRect(xposMod, ypos + buttonMargin, buttonSize.width(), height - 2 * buttonMargin); 2807 2903 } 2808 2904 break; 2809 2905 case SC_ComboBoxEditField: { 2810 const int withFrameX = cmb->rect.x() + width - frameThickness - buttonSize.width(); 2811 ret = QRect( 2812 frameThickness, 2813 frameThickness, 2814 withFrameX - frameThickness, 2815 height - 2 * frameThickness); 2906 ret = QRect(0, 0, cmb->rect.x() + width - buttonSize.width(), height); 2816 2907 } 2817 2908 break; 2818 2909 case SC_ComboBoxListBoxPopup: { 2819 const QRect desktopContent = QApplication::desktop()->availableGeometry(); 2820 2821 // take the size of this and position bottom above available area 2822 QRect popupRect; 2823 const int width = desktopContent.width() - pixelMetric(PM_LayoutRightMargin) - pixelMetric(PM_LayoutLeftMargin); 2824 popupRect.setWidth(width); 2825 popupRect.setHeight(desktopContent.height()); //combobox resets height anyway based on content 2826 popupRect.setBottom(desktopContent.bottom()); 2827 popupRect.translate(pixelMetric(PM_LayoutLeftMargin), 0); 2828 ret = popupRect; 2910 ret = QApplication::desktop()->availableGeometry(); 2829 2911 } 2830 2912 break; … … 2957 3039 case SE_ItemViewItemDecoration: 2958 3040 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { 2959 const Q ListWidget *listItem = qobject_cast<const QListWidget*>(widget);3041 const QAbstractItemView *listItem = qobject_cast<const QAbstractItemView *>(widget); 2960 3042 const bool multiSelection = !listItem ? false : 2961 3043 listItem->selectionMode() == QAbstractItemView::MultiSelection || … … 2981 3063 ret = menuItem->rect; 2982 3064 3065 QRect checkBoxRect = checkable ? menuItem->rect : QRect(); 3066 if (checkable) { 3067 checkBoxRect.setWidth(pixelMetric(PM_IndicatorWidth)); 3068 checkBoxRect.setHeight(pixelMetric(PM_IndicatorHeight)); 3069 } 3070 3071 const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing); 3072 //The vertical spacing is doubled; it needs one spacing to separate checkbox from 3073 //highlight and then it needs one to separate it whatever is shown after it (text/icon/both). 3074 const int moveByX = checkBoxRect.width() + 2 * vSpacing; 3075 2983 3076 if (element == SE_ItemViewItemDecoration) { 2984 3077 if (menuItem->icon.isNull()) { … … 2986 3079 } else { 2987 3080 if (menuItem->direction == Qt::RightToLeft) 2988 ret.translate(ret.width() - indicatorWidth, 0); 3081 ret.translate(ret.width() - indicatorWidth - moveByX, 0); 3082 else 3083 ret.translate(moveByX, 0); 2989 3084 ret.setWidth(indicatorWidth); 2990 3085 } 2991 3086 } else { 2992 ret = menuItem->rect; 2993 if (!menuItem->icon.isNull()) 3087 if (!menuItem->icon.isNull()) { 2994 3088 if (menuItem->direction == Qt::LeftToRight) 2995 3089 ret.adjust(indicatorWidth, 0, 0, 0); 2996 3090 else 2997 3091 ret.adjust(0, 0, -indicatorWidth, 0); 3092 } 3093 if (menuItem->direction == Qt::LeftToRight) 3094 ret.adjust(moveByX, 0, 0, 0); 3095 else 3096 ret.adjust(0, 0, -moveByX, 0); 2998 3097 2999 3098 // Make room for submenu indicator … … 3010 3109 case SE_ItemViewItemCheckIndicator: 3011 3110 if (const QStyleOptionViewItemV2 *vopt = qstyleoption_cast<const QStyleOptionViewItemV2 *>(opt)) { 3012 const Q ListWidget *listItem = qobject_cast<const QListWidget*>(widget);3111 const QAbstractItemView *listItem = qobject_cast<const QAbstractItemView *>(widget); 3013 3112 3014 3113 const bool singleSelection = listItem && … … 3073 3172 ret = opt->rect; 3074 3173 break; 3174 case SE_ProgressBarLabel: 3175 case SE_ProgressBarContents: 3176 case SE_ProgressBarGroove: 3177 ret = opt->rect; 3178 break; 3075 3179 default: 3076 3180 ret = QCommonStyle::subElementRect(element, opt, widget); … … 3322 3426 break; 3323 3427 case SP_ToolBarHorizontalExtensionButton: 3324 part = QS60StyleEnums::SP_QgnIndiSub Menu;3428 part = QS60StyleEnums::SP_QgnIndiSubmenu; 3325 3429 if (QApplication::layoutDirection() == Qt::RightToLeft) 3326 3430 adjustedFlags |= QS60StylePrivate::SF_PointSouth; … … 3328 3432 case SP_ToolBarVerticalExtensionButton: 3329 3433 adjustedFlags |= QS60StylePrivate::SF_PointEast; 3330 part = QS60StyleEnums::SP_QgnIndiSub Menu;3434 part = QS60StyleEnums::SP_QgnIndiSubmenu; 3331 3435 break; 3332 3436 … … 3361 3465 d->m_pressedWidget = w; 3362 3466 3363 if ( 3467 if (d->m_pressedWidget) 3364 3468 d->m_pressedWidget->update(); 3365 3469 } … … 3367 3471 } 3368 3472 case QEvent::MouseButtonRelease: { 3369 const QWidget *w = QApplication::widgetAt(QCursor::pos()); 3370 if (w && d->m_pressedWidget) { 3473 if (d->m_pressedWidget) { 3371 3474 d->m_pressedWidget->update(); 3372 3475 d->m_pressedWidget = 0; -
trunk/src/gui/styles/qs60style.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 51 51 QT_MODULE(Gui) 52 52 53 #if !defined(QT_NO_STYLE_S60)54 55 53 //Public custom pixel metrics values. 56 54 //These can be used to fetch custom pixel metric value from outside QS60Style. … … 92 90 bool event(QEvent *e); 93 91 94 #ifndef Q_ WS_S6092 #ifndef Q_OS_SYMBIAN 95 93 static QStringList partKeys(); 96 94 static QStringList colorListKeys(); … … 99 97 bool loadS60ThemeFromBlob(const QString &blobFile); 100 98 bool saveS60ThemeToBlob(const QString &blobFile) const; 101 #endif // !Q_ WS_S6099 #endif // !Q_OS_SYMBIAN 102 100 103 101 protected Q_SLOTS: … … 114 112 }; 115 113 116 #endif // QT_NO_STYLE_S60117 118 114 QT_END_NAMESPACE 119 115 -
trunk/src/gui/styles/qs60style_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 155 155 SP_QgnGrafNsliderMarker, 156 156 SP_QgnGrafNsliderMarkerSelected, 157 SP_QgnIndiSub Menu,157 SP_QgnIndiSubmenu, 158 158 SP_QgnNoteErased, 159 159 SP_QgnNoteError, … … 167 167 SP_QgnPropFolderSmallNew, 168 168 SP_QgnPropPhoneMemcLarge, 169 SP_QgnFrSctrlButtonCornerTl, // Toolbar button 170 SP_QgnFrSctrlButtonCornerTr, 171 SP_QgnFrSctrlButtonCornerBl, 172 SP_QgnFrSctrlButtonCornerBr, 173 SP_QgnFrSctrlButtonSideT, 174 SP_QgnFrSctrlButtonSideB, 175 SP_QgnFrSctrlButtonSideL, 176 SP_QgnFrSctrlButtonSideR, 177 SP_QgnFrSctrlButtonCenter, 178 SP_QgnFrSctrlButtonCornerTlPressed, // Toolbar button, pressed 179 SP_QgnFrSctrlButtonCornerTrPressed, 180 SP_QgnFrSctrlButtonCornerBlPressed, 181 SP_QgnFrSctrlButtonCornerBrPressed, 182 SP_QgnFrSctrlButtonSideTPressed, 183 SP_QgnFrSctrlButtonSideBPressed, 184 SP_QgnFrSctrlButtonSideLPressed, 185 SP_QgnFrSctrlButtonSideRPressed, 186 SP_QgnFrSctrlButtonCenterPressed, 169 187 SP_QsnCpScrollHandleBottomPressed, //ScrollBar handle, pressed state 170 188 SP_QsnCpScrollHandleMiddlePressed, … … 199 217 SP_QsnFrCaleCornerBl, 200 218 SP_QsnFrCaleCornerBr, 201 SP_QsnFrCale GSideT,202 SP_QsnFrCale GSideB,203 SP_QsnFrCale GSideL,204 SP_QsnFrCale GSideR,219 SP_QsnFrCaleSideT, 220 SP_QsnFrCaleSideB, 221 SP_QsnFrCaleSideL, 222 SP_QsnFrCaleSideR, 205 223 SP_QsnFrCaleCenter, 206 224 SP_QsnFrCaleHeadingCornerTl, // calendar grid header … … 267 285 SP_QsnFrPopupSubSideR, 268 286 SP_QsnFrPopupSubCenter, 269 SP_QsnFrSctrlButtonCornerTl, // Toolbar button270 SP_QsnFrSctrlButtonCornerTr,271 SP_QsnFrSctrlButtonCornerBl,272 SP_QsnFrSctrlButtonCornerBr,273 SP_QsnFrSctrlButtonSideT,274 SP_QsnFrSctrlButtonSideB,275 SP_QsnFrSctrlButtonSideL,276 SP_QsnFrSctrlButtonSideR,277 SP_QsnFrSctrlButtonCenter,278 SP_QsnFrSctrlButtonCornerTlPressed, // Toolbar button, pressed279 SP_QsnFrSctrlButtonCornerTrPressed,280 SP_QsnFrSctrlButtonCornerBlPressed,281 SP_QsnFrSctrlButtonCornerBrPressed,282 SP_QsnFrSctrlButtonSideTPressed,283 SP_QsnFrSctrlButtonSideBPressed,284 SP_QsnFrSctrlButtonSideLPressed,285 SP_QsnFrSctrlButtonSideRPressed,286 SP_QsnFrSctrlButtonCenterPressed,287 287 SP_QsnFrButtonCornerTlInactive, // Inactive button 288 288 SP_QsnFrButtonCornerTrInactive, … … 311 311 SP_QsnFrListSideLPressed, 312 312 SP_QsnFrListSideRPressed, 313 SP_QsnFrList Pressed,313 SP_QsnFrListCenterPressed, 314 314 }; 315 315 … … 523 523 static bool isWidgetPressed(const QWidget *widget); 524 524 525 // calculates average color based on button skin graphics (minus borders). 525 #ifdef Q_WS_S60 526 static void deleteStoredSettings(); 527 // calculates average color based on theme graphics (minus borders). 526 528 QColor colorFromFrameGraphics(SkinFrameElements frame) const; 529 #endif 530 QColor calculatedColor(SkinFrameElements frame) const; 527 531 528 532 //set theme palette for application … … 542 546 543 547 mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache; 544 mutable QHash<SkinFrameElements, QColor> m_colorCache;545 548 546 549 // Has one entry per SkinFrameElements … … 572 575 void stopAnimation(QS60StyleEnums::SkinParts animation); 573 576 static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part); 577 static void removeAnimations(); 574 578 575 579 #endif … … 598 602 static void storeThemePalette(QPalette *palette); 599 603 static void deleteThemePalette(); 604 static bool equalToThemePalette(QColor color, QPalette::ColorRole role); 605 static bool equalToThemePalette(qint64 cacheKey, QPalette::ColorRole role); 600 606 601 607 static QSize partSize(QS60StyleEnums::SkinParts part, -
trunk/src/gui/styles/qs60style_s60.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 49 49 #include "private/qcore_symbian_p.h" 50 50 #include "qapplication.h" 51 #include "qsettings.h" 51 52 52 53 #include <w32std.h> … … 66 67 #include <AknBitmapAnimation.h> 67 68 69 #include <centralrepository.h> 70 68 71 #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) 69 72 … … 77 80 ENoDraw 78 81 }; 82 83 const TUid personalisationUID = { 0x101F876F }; 79 84 80 85 enum TSupportRelease { … … 180 185 /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1}, 181 186 // No drop area for 3.x non-touch devices 182 /* SP_QgnGrafOrgBgGrid */ {KAknsIIDNone, EDrawIcon, ES60_3_X, EAknsMajorGeneric ,0x1eba}, //KAknsIIDQgnGrafOrgBgGrid 187 /* SP_QgnGrafOrgBgGrid */ {KAknsIIDNone, EDrawIcon, ES60_3_X, EAknsMajorGeneric ,0x1eba}, //KAknsIIDQgnGrafOrgBgGrid 183 188 /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1}, 184 189 /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1}, … … 215 220 /* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */}, 216 221 /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */}, 217 /* SP_QgnIndiSub Menu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1},222 /* SP_QgnIndiSubmenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1}, 218 223 /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1}, 219 224 /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1}, … … 228 233 /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1}, 229 234 235 // Toolbar graphics is different in 3.1/3.2 vs. 5.0 236 /* SP_QgnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/ 237 /* SP_QgnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302}, 238 /* SP_QgnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303}, 239 /* SP_QgnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304}, 240 /* SP_QgnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305}, 241 /* SP_QgnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306}, 242 /* SP_QgnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307}, 243 /* SP_QgnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308}, 244 /* SP_QgnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/ 245 246 // No pressed state for toolbar button in 3.1/3.2. 247 /* SP_QgnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQgnFrSctrlButtonCornerTlPressed*/ 248 /* SP_QgnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622}, 249 /* SP_QgnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623}, 250 /* SP_QgnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624}, 251 /* SP_QgnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625}, 252 /* SP_QgnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626}, 253 /* SP_QgnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627}, 254 /* SP_QgnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628}, 255 /* SP_QgnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629}, 256 230 257 // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead. 231 258 /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/ … … 267 294 /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_All, -1,-1}, 268 295 /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_All, -1,-1}, 269 /* SP_QsnFrCale GSideT */{KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1},270 /* SP_QsnFrCale GSideB */{KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1},271 /* SP_QsnFrCale GSideL */{KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1},272 /* SP_QsnFrCale GSideR */{KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1},296 /* SP_QsnFrCaleSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1}, 297 /* SP_QsnFrCaleSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1}, 298 /* SP_QsnFrCaleSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1}, 299 /* SP_QsnFrCaleSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1}, 273 300 /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_All, -1,-1}, 274 301 … … 345 372 /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_X, -1,-1}, 346 373 347 // Toolbar graphics is different in 3.1/3.2 vs. 5.0348 /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/349 /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302},350 /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303},351 /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304},352 /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305},353 /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306},354 /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307},355 /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308},356 /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/357 358 // No pressed state for toolbar button in 3.1/3.2.359 /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/360 /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622},361 /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623},362 /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624},363 /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625},364 /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626},365 /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627},366 /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628},367 /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629},368 369 374 // No inactive button graphics in 3.1/3.2 370 375 /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/ … … 398 403 /* SP_QsnFrListSideLPressed */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2691}, 399 404 /* SP_QsnFrListSideRPressed */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2692}, 400 /* SP_QsnFrList Pressed */ {KAknsIIDQsnFrList,ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693},405 /* SP_QsnFrListCenterPressed */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693}, 401 406 }; 402 407 … … 515 520 fallbackIndex = 17574; /* EMbmAvkonQgn_graf_nslider_marker_selected */ 516 521 break; 517 case QS60StyleEnums::SP_QgnIndiSub Menu:522 case QS60StyleEnums::SP_QgnIndiSubmenu: 518 523 fallbackIndex = EMbmAvkonQgn_indi_submenu; 519 524 break; … … 684 689 { 685 690 return (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0); 691 } 692 693 void QS60StylePrivate::deleteStoredSettings() 694 { 695 QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); 696 settings.beginGroup(QLatin1String("QS60Style")); 697 settings.remove(QString()); 698 settings.endGroup(); 699 } 700 701 // Since S60Style has 'button' as a graphic, we don't have any native color which to use 702 // for QPalette::Button. Therefore S60Style needs to guesstimate palette color by calculating 703 // average rgb values for button pixels. 704 // Returns Qt::black if there is an issue with the graphics (image is NULL, or no constBits() found). 705 QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const 706 { 707 #ifndef QT_NO_SETTINGS 708 TInt themeID = 0; 709 //First we need to fetch active theme ID. We need to store the themeID at the same time 710 //as color, so that we can later check if the stored color is still from the same theme. 711 //Native side stores active theme UID/Timestamp into central repository. 712 int error = 0; 713 QT_TRAP_THROWING( 714 CRepository *themeRepository = CRepository::NewLC(personalisationUID); 715 if (themeRepository) { 716 TBuf<32> value; //themeID is currently max of 8 + 1 + 8 characters, but lets have some extra space 717 const TUint32 key = 0x00000002; //active theme key in the repository 718 error = themeRepository->Get(key, value); 719 if (error == KErrNone) { 720 TLex lex(value); 721 TPtrC numberToken(lex.NextToken()); 722 if (numberToken.Length()) 723 error = TLex(numberToken).Val(themeID); 724 else 725 error = KErrArgument; 726 } 727 } 728 CleanupStack::PopAndDestroy(themeRepository); 729 ); 730 731 QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); 732 settings.beginGroup(QLatin1String("QS60Style")); 733 if (themeID != 0) { 734 QVariant buttonColor = settings.value(QLatin1String("ButtonColor")); 735 if (!buttonColor.isNull()) { 736 //there is a stored color value, lets see if the theme ID matches 737 if (error == KErrNone) { 738 QVariant themeUID = settings.value(QLatin1String("ThemeUID")); 739 if (!themeUID.isNull() && themeUID.toInt() == themeID) { 740 QColor storedColor(buttonColor.value<QColor>()); 741 if (storedColor.isValid()) 742 return storedColor; 743 } 744 } 745 settings.remove(QString()); //if color was invalid, or theme has been changed, just delete all stored settings 746 } 747 } 748 #endif 749 750 QColor color = calculatedColor(frame); 751 752 #ifndef QT_NO_SETTINGS 753 settings.setValue(QLatin1String("ThemeUID"), QVariant(themeID)); 754 if (frame == SF_ButtonNormal) //other colors are not currently calculated from graphics 755 settings.setValue(QLatin1String("ButtonColor"), QVariant(color)); 756 settings.endGroup(); 757 #endif 758 759 return color; 686 760 } 687 761 … … 1024 1098 break; 1025 1099 case QS60StylePrivate::SF_ListHighlight: 1026 widthShrink = widthShrink - 2; 1027 heightShrink = heightShrink - 2; 1100 //In Sym^3 devices highlights are less blocky 1101 if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { 1102 widthShrink += 2; 1103 heightShrink += 2; 1104 } else { 1105 widthShrink -= 2; 1106 heightShrink -= 2; 1107 } 1028 1108 break; 1029 1109 case QS60StylePrivate::SF_PopupBackground: … … 1145 1225 // No need to set active layout, if dynamic metrics API is available 1146 1226 setActiveLayout(); 1227 } 1228 1229 void QS60StylePrivate::removeAnimations() 1230 { 1231 //currently only one animation in the list. 1232 m_animations()->removeFirst(); 1147 1233 } 1148 1234 … … 1293 1379 { 1294 1380 bool createNewBackground = false; 1381 TRect applicationRect = (static_cast<CEikAppUi*>(S60->appUi())->ApplicationRect()); 1295 1382 if (!m_background) { 1296 1383 createNewBackground = true; 1297 1384 } else { 1298 1385 //if background brush does not match screensize, re-create it 1299 if (m_background->width() != S60->screenWidthInPixels||1300 m_background->height() != S60->screenHeightInPixels) {1386 if (m_background->width() != applicationRect.Width() || 1387 m_background->height() != applicationRect.Height()) { 1301 1388 delete m_background; 1302 1389 createNewBackground = true; … … 1306 1393 if (createNewBackground) { 1307 1394 QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, 1308 QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), 0, SkinElementFlags());1395 QSize(applicationRect.Width(), applicationRect.Height()), 0, SkinElementFlags()); 1309 1396 m_background = new QPixmap(background); 1310 1397 } … … 1326 1413 { 1327 1414 clearCaches(QS60StylePrivate::CC_LayoutChange); 1328 setBackgroundTexture(qApp);1329 1415 setActiveLayout(); 1330 1416 refreshUI(); -
trunk/src/gui/styles/qs60style_simulated.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 95 95 } 96 96 97 const int picturesCount =partPictures.count();98 dataOut << picturesCount;99 foreach (const QString &key, partPictures.keys()) {100 const QPicture picture = partPictures.value(key);101 dataOut << key;102 dataOut << picture;97 dataOut << partPictures.count(); 98 QHashIterator<QString, QPicture> i(partPictures); 99 while (i.hasNext()) { 100 i.next(); 101 dataOut << i.key(); 102 dataOut << i.value(); // the QPicture 103 103 } 104 104 -
trunk/src/gui/styles/qstyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 326 326 327 327 \sa QStyleOption, QStylePainter, {Styles Example}, 328 { ImplementingStyles and Style Aware Widgets}, QStyledItemDelegate328 {Styles and Style Aware Widgets}, QStyledItemDelegate 329 329 */ 330 330 … … 368 368 actions in this function might be to call the 369 369 QWidget::setBackgroundMode() function for the widget. Do not use 370 the function to set, for example, the geometry ; reimplementing371 this function do providea back-door through which the appearance372 of a widget can be changed, but with Qt 4.0's style engine there373 is rarely necessary to implement this function; reimplement the370 the function to set, for example, the geometry. Reimplementing 371 this function provides a back-door through which the appearance 372 of a widget can be changed, but with Qt's style engine it is 373 rarely necessary to implement this function; reimplement 374 374 drawItemPixmap(), drawItemText(), drawPrimitive(), etc. instead. 375 375 … … 2422 2422 QT_END_INCLUDE_NAMESPACE 2423 2423 2424 #if !defined(QT_NO_DEBUG_STREAM) 2424 2425 QDebug operator<<(QDebug debug, QStyle::State state) 2425 2426 { 2426 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)2427 #if !defined(QT_NO_DEBUG) 2427 2428 debug << "QStyle::State("; 2428 2429 … … 2456 2457 debug << states.join(QLatin1String(" | ")); 2457 2458 debug << ')'; 2459 #else 2460 Q_UNUSED(state); 2458 2461 #endif 2459 2462 return debug; 2460 2463 } 2464 #endif 2461 2465 2462 2466 /*! -
trunk/src/gui/styles/qstyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 879 879 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls) 880 880 881 #if !defined(QT_NO_DEBUG_STREAM) 881 882 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state); 883 #endif 882 884 883 885 QT_END_NAMESPACE -
trunk/src/gui/styles/qstyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 44 44 45 45 #include "private/qobject_p.h" 46 #include "private/qstylehelper_p.h"47 46 #include <QtGui/qstyle.h> 48 47 -
trunk/src/gui/styles/qstylefactory.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 82 82 #endif 83 83 84 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)84 #ifndef QT_NO_LIBRARY 85 85 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, 86 86 (QStyleFactoryInterface_iid, QLatin1String("/styles"), Qt::CaseInsensitive)) -
trunk/src/gui/styles/qstylefactory.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylehelper.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 40 40 ****************************************************************************/ 41 41 42 #include "qstylehelper_p.h"43 44 42 #include <qstyleoption.h> 45 43 #include <qpainter.h> … … 55 53 #endif 56 54 55 #include "qstylehelper_p.h" 56 #include <qstringbuilder.h> 57 57 58 QT_BEGIN_NAMESPACE 58 59 … … 62 63 { 63 64 const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option); 64 QString tmp = QString::fromLatin1("%1-%2-%3-%4-%5-%6x%7").arg(key).arg(uint(option->state)).arg(option->direction) 65 .arg(complexOption ? uint(complexOption->activeSubControls) : uint(0)) 66 .arg(option->palette.cacheKey()).arg(size.width()).arg(size.height()); 65 QString tmp = key % HexString<uint>(option->state) 66 % HexString<uint>(option->direction) 67 % HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u) 68 % HexString<quint64>(option->palette.cacheKey()) 69 % HexString<uint>(size.width()) 70 % HexString<uint>(size.height()); 71 67 72 #ifndef QT_NO_SPINBOX 68 73 if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { 69 tmp.append(QLatin1Char('-')); 70 tmp.append(QString::number(spinBox->buttonSymbols)); 71 tmp.append(QLatin1Char('-')); 72 tmp.append(QString::number(spinBox->stepEnabled)); 73 tmp.append(QLatin1Char('-')); 74 tmp.append(QLatin1Char(spinBox->frame ? '1' : '0')); 74 tmp = tmp % HexString<uint>(spinBox->buttonSymbols) 75 % HexString<uint>(spinBox->stepEnabled) 76 % QLatin1Char(spinBox->frame ? '1' : '0'); ; 75 77 } 76 78 #endif // QT_NO_SPINBOX -
trunk/src/gui/styles/qstylehelper_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 42 42 #include <QtCore/qglobal.h> 43 43 #include <QtCore/qpoint.h> 44 #include <QtCore/qstring.h> 44 45 #include <QtGui/qpolygon.h> 46 #include <QtCore/qstringbuilder.h> 45 47 46 48 #ifndef QSTYLEHELPER_P_H … … 80 82 } 81 83 84 // internal helper. Converts an integer value to an unique string token 85 template <typename T> 86 struct HexString 87 { 88 inline HexString(const T t) 89 : val(t) 90 {} 91 92 inline void write(QChar *&dest) const 93 { 94 const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; 95 const char *c = reinterpret_cast<const char *>(&val); 96 for (uint i = 0; i < sizeof(T); ++i) { 97 *dest++ = hexChars[*c & 0xf]; 98 *dest++ = hexChars[(*c & 0xf0) >> 4]; 99 ++c; 100 } 101 } 102 const T val; 103 }; 104 105 // specialization to enable fast concatenating of our string tokens to a string 106 template <typename T> 107 struct QConcatenable<HexString<T> > 108 { 109 typedef HexString<T> type; 110 enum { ExactSize = true }; 111 static int size(const HexString<T> &) { return sizeof(T) * 2; } 112 static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); } 113 }; 114 82 115 QT_END_NAMESPACE 83 116 -
trunk/src/gui/styles/qstyleoption.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 5420 5420 */ 5421 5421 5422 #if !defined(QT_NO_DEBUG_STREAM) 5422 5423 QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType) 5423 5424 { 5424 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)5425 #if !defined(QT_NO_DEBUG) 5425 5426 switch (optionType) { 5426 5427 case QStyleOption::SO_Default: … … 5483 5484 debug << "SO_GraphicsItem"; break; 5484 5485 } 5486 #else 5487 Q_UNUSED(optionType); 5485 5488 #endif 5486 5489 return debug; … … 5489 5492 QDebug operator<<(QDebug debug, const QStyleOption &option) 5490 5493 { 5491 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)5494 #if !defined(QT_NO_DEBUG) 5492 5495 debug << "QStyleOption("; 5493 5496 debug << QStyleOption::OptionType(option.type); … … 5496 5499 debug << ',' << option.rect; 5497 5500 debug << ')'; 5501 #else 5502 Q_UNUSED(option); 5498 5503 #endif 5499 5504 return debug; 5500 5505 } 5506 #endif 5501 5507 5502 5508 QT_END_NAMESPACE -
trunk/src/gui/styles/qstyleoption.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 959 959 } 960 960 961 #if !defined(QT_NO_DEBUG_STREAM) 961 962 Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType); 962 963 Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option); 964 #endif 963 965 964 966 QT_END_NAMESPACE -
trunk/src/gui/styles/qstyleplugin.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstyleplugin.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylesheetstyle.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 1066 1066 } 1067 1067 } 1068 if ( !hasNativeBorder() && (flags & Border)) {1068 if (hasBorder() && (flags & Border)) { 1069 1069 const int *b = border()->borders; 1070 1070 r.adjust(-b[LeftEdge], -b[TopEdge], b[RightEdge], b[BottomEdge]); … … 1353 1353 p->setBrush(br, bg->brush); 1354 1354 p->setBrush(QPalette::Window, bg->brush); 1355 if (bg->brush.style() == Qt::SolidPattern) { 1356 p->setBrush(QPalette::Light, bg->brush.color().lighter(115)); 1357 p->setBrush(QPalette::Midlight, bg->brush.color().lighter(107)); 1358 p->setBrush(QPalette::Dark, bg->brush.color().darker(150)); 1359 p->setBrush(QPalette::Shadow, bg->brush.color().darker(300)); 1360 } 1355 1361 } 1356 1362 … … 2538 2544 QPalette::ColorGroup group; 2539 2545 } map[3] = { 2540 { PseudoClass_Active | PseudoClass_Enabled, QPalette::Active },2546 { int(PseudoClass_Active | PseudoClass_Enabled), QPalette::Active }, 2541 2547 { PseudoClass_Disabled, QPalette::Disabled }, 2542 2548 { PseudoClass_Enabled, QPalette::Inactive } … … 3171 3177 QRect r(gr.topLeft(), 3172 3178 slider->orientation == Qt::Horizontal 3173 ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height() )3174 : QPoint(gr.x()+gr.width() , hr.y()+hr.height()/2));3179 ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height() - 1) 3180 : QPoint(gr.x()+gr.width() - 1, hr.y()+hr.height()/2)); 3175 3181 subRule1.drawRule(p, r); 3176 3182 } … … 3185 3191 } 3186 3192 3187 handleSubRule.drawRule(p, grooveSubRule.boxRect(hr, Margin));3193 handleSubRule.drawRule(p, handleSubRule.boxRect(hr, Margin)); 3188 3194 } 3189 3195 … … 3459 3465 case CE_RadioButton: 3460 3466 case CE_CheckBox: 3461 rule.drawRule(p, opt->rect); 3462 ParentStyle::drawControl(ce, opt, p, w); 3463 return; 3464 3467 if (rule.hasBox() || !rule.hasNativeBorder() || rule.hasDrawable() || hasStyleRule(w, PseudoElement_Indicator)) { 3468 rule.drawRule(p, opt->rect); 3469 ParentStyle::drawControl(ce, opt, p, w); 3470 return; 3471 } else if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { 3472 QStyleOptionButton butOpt(*btn); 3473 rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button); 3474 baseStyle()->drawControl(ce, &butOpt, p, w); 3475 return; 3476 } 3477 break; 3465 3478 case CE_RadioButtonLabel: 3466 3479 case CE_CheckBoxLabel: … … 4082 4095 QRenderRule subRule = renderRule(w, opt, pe1); 4083 4096 if (subRule.bg != 0 || subRule.hasDrawable()) { 4084 //We test subRule.bg dir rectly because hasBackground() would return false for background:none.4097 //We test subRule.bg directly because hasBackground() would return false for background:none. 4085 4098 //But we still don't want the default drawning in that case (example for QScrollBar::add-page) (task 198926) 4086 4099 subRule.drawRule(p, opt->rect); … … 4270 4283 } 4271 4284 break; 4285 4286 case PE_FrameMenu: 4287 if (rule.hasDrawable()) { 4288 // Drawn by PE_PanelMenu 4289 return; 4290 } 4291 break; 4272 4292 4273 4293 case PE_PanelMenuBar: -
trunk/src/gui/styles/qstylesheetstyle_default.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylesheetstyle_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowscestyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowscestyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowscestyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsmobilestyle.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 80 80 extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp 81 81 #endif // Q_WS_WINCE 82 83 #include "qstylehelper_p.h" 82 84 83 85 QT_BEGIN_NAMESPACE -
trunk/src/gui/styles/qwindowsmobilestyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsmobilestyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsstyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 42 42 #include "qwindowsstyle.h" 43 43 #include "qwindowsstyle_p.h" 44 #include <private/qstylehelper_p.h>45 44 46 45 #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) 47 46 48 #include "qlibrary.h"47 #include <private/qsystemlibrary_p.h> 49 48 #include "qapplication.h" 50 49 #include "qbitmap.h" … … 71 70 #include <qmath.h> 72 71 73 74 72 #ifdef Q_WS_X11 75 73 #include "qfileinfo.h" … … 77 75 #include <private/qt_x11_p.h> 78 76 #endif 77 78 #include <private/qstylehelper_p.h> 79 79 80 80 QT_BEGIN_NAMESPACE … … 127 127 if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA 128 128 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { 129 Q Library shellLib(QLatin1String("shell32"));129 QSystemLibrary shellLib(QLatin1String("shell32")); 130 130 pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo"); 131 131 } 132 132 #endif 133 startTime.start(); 133 134 } 134 135 … … 506 507 #ifndef Q_OS_WINCE 507 508 NONCLIENTMETRICS ncm; 508 ncm.cbSize = sizeof(NONCLIENTMETRICS);509 ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT); 509 510 if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)) 510 511 ret = qMax(ncm.iScrollHeight, ncm.iScrollWidth); … … 930 931 { 931 932 #ifdef Q_OS_WINCE 932 HMODULE hmod = LoadLibrary(L"ceshell .dll");933 HMODULE hmod = LoadLibrary(L"ceshell"); 933 934 #else 934 HMODULE hmod = LoadLibrary(L"shell32.dll");935 HMODULE hmod = QSystemLibrary::load(L"shell32"); 935 936 #endif 936 937 if( hmod ) { … … 1397 1398 int size = qMin(r.height(), r.width()); 1398 1399 QPixmap pixmap; 1399 QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") + QLatin1String(metaObject()->className()), opt, QSize(size, size)) 1400 + QLatin1Char('-') + QString::number(pe); 1400 QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") 1401 % QLatin1String(metaObject()->className()), opt, QSize(size, size)) 1402 % HexString<uint>(pe); 1401 1403 if (!QPixmapCache::find(pixmapName, pixmap)) { 1402 1404 int border = size/5; 1403 1405 int sqsize = 2*(size/2); 1404 QImage image(sqsize, sqsize, QImage::Format_ARGB32 );1405 image.fill( Qt::transparent);1406 QImage image(sqsize, sqsize, QImage::Format_ARGB32_Premultiplied); 1407 image.fill(0); 1406 1408 QPainter imagePainter(&image); 1407 1409 … … 1920 1922 } 1921 1923 1922 int xm = QWindowsStylePrivate::windowsItemFrame + checkcol + QWindowsStylePrivate::windowsItemHMargin;1924 int xm = int(QWindowsStylePrivate::windowsItemFrame) + checkcol + int(QWindowsStylePrivate::windowsItemHMargin); 1923 1925 int xpos = menuitem->rect.x() + xm; 1924 1926 QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin, … … 2404 2406 case CE_ProgressBarContents: 2405 2407 if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) { 2406 2407 2408 QRect rect = pb->rect; 2409 if (!rect.isValid()) 2410 return; 2411 2408 2412 bool vertical = false; 2409 2413 bool inverted = false; … … 3114 3118 ©.palette.brush(QPalette::Button)); 3115 3119 copy.rect.adjust(4, 1, -5, -1); 3116 if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) ) { 3120 if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) 3121 && proxy()->styleHint(SH_EtchDisabledText, opt, widget) ) 3122 { 3117 3123 QStyleOptionSpinBox lightCopy = copy; 3118 3124 lightCopy.rect.adjust(1, 1, 1, 1); … … 3147 3153 ©.palette.brush(QPalette::Button)); 3148 3154 copy.rect.adjust(4, 0, -5, -1); 3149 if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) ) { 3155 if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) 3156 && proxy()->styleHint(SH_EtchDisabledText, opt, widget) ) 3157 { 3150 3158 QStyleOptionSpinBox lightCopy = copy; 3151 3159 lightCopy.rect.adjust(1, 1, 1, 1); … … 3228 3236 int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column 3229 3237 w += checkcol; 3230 w += QWindowsStylePrivate::windowsRightBorder+ 10;3238 w += int(QWindowsStylePrivate::windowsRightBorder) + 10; 3231 3239 sz.setWidth(w); 3232 3240 } -
trunk/src/gui/styles/qwindowsstyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsstyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 59 59 #ifndef QT_NO_STYLE_WINDOWS 60 60 #include <qlist.h> 61 #include <qdatetime.h>62 61 #include <qhash.h> 62 #include <qelapsedtimer.h> 63 63 64 64 QT_BEGIN_NAMESPACE … … 81 81 int animationFps; 82 82 int animateTimer; 83 Q TimestartTime;83 QElapsedTimer startTime; 84 84 int animateStep; 85 85 QColor inactiveCaptionText; -
trunk/src/gui/styles/qwindowsvistastyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 43 43 #include "qwindowsvistastyle_p.h" 44 44 #include <private/qstylehelper_p.h> 45 #include <private/qsystemlibrary_p.h> 45 46 46 47 #if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN) … … 1927 1928 1928 1929 QSize sz(size); 1929 1930 QSize newSize = QWindowsXPStyle::sizeFromContents(type, option, size, widget);1931 1930 switch (type) { 1932 case CT_LineEdit:1933 case CT_ComboBox:1934 {1935 HTHEME theme = pOpenThemeData(0, L"Button");1936 MARGINS borderSize;1937 if (theme) {1938 int result = pGetThemeMargins(theme,1939 NULL,1940 BP_PUSHBUTTON,1941 PBS_NORMAL,1942 TMT_CONTENTMARGINS,1943 NULL,1944 &borderSize);1945 if (result == S_OK) {1946 sz += QSize(borderSize.cxLeftWidth + borderSize.cxRightWidth - 2,1947 borderSize.cyBottomHeight + borderSize.cyTopHeight - 2);1948 }1949 sz += QSize(23, 0); //arrow button1950 }1951 }1952 return sz;1953 1931 case CT_MenuItem: 1954 1932 sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget); … … 1991 1969 break; 1992 1970 } 1993 return newSize;1971 return QWindowsXPStyle::sizeFromContents(type, option, size, widget); 1994 1972 } 1995 1973 … … 2598 2576 if (!tried) { 2599 2577 tried = true; 2600 Q Library themeLib(QLatin1String("uxtheme"));2578 QSystemLibrary themeLib(QLatin1String("uxtheme")); 2601 2579 pSetWindowTheme = (PtrSetWindowTheme )themeLib.resolve("SetWindowTheme"); 2602 2580 pIsThemePartDefined = (PtrIsThemePartDefined )themeLib.resolve("IsThemePartDefined"); -
trunk/src/gui/styles/qwindowsvistastyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsvistastyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 87 87 #include <qtableview.h> 88 88 #include <qbasictimer.h> 89 #include <qdatetime.h> 89 90 #include <qcommandlinkbutton.h> 90 91 -
trunk/src/gui/styles/qwindowsxpstyle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 49 49 #include <private/qstylehelper_p.h> 50 50 #include <private/qwidget_p.h> 51 #include < qlibrary.h>51 #include <private/qsystemlibrary_p.h> 52 52 #include <qpainter.h> 53 53 #include <qpaintengine.h> … … 303 303 limboWidget->createWinId(); 304 304 limboWidget->setObjectName(QLatin1String("xp_limbo_widget")); 305 // We don t need this internal widget to appear in QApplication::topLevelWidgets()305 // We don't need this internal widget to appear in QApplication::topLevelWidgets() 306 306 if (QWidgetPrivate::allWidgets) 307 307 QWidgetPrivate::allWidgets->remove(limboWidget); … … 345 345 if (!tried) { 346 346 tried = true; 347 Q Library themeLib(QLatin1String("uxtheme"));347 QSystemLibrary themeLib(QLatin1String("uxtheme")); 348 348 pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); 349 349 if (pIsAppThemed) { … … 2155 2155 p->setBrush(Qt::NoBrush); 2156 2156 if (checked) 2157 p->drawRect(vIconRect.adjusted(-1, - 2, 1, 1));2157 p->drawRect(vIconRect.adjusted(-1, -1, 0, 0)); 2158 2158 p->drawPixmap(vIconRect.topLeft(), pixmap); 2159 2159 … … 3679 3679 borderSize.cyBottomHeight + borderSize.cyTopHeight - 2); 3680 3680 } 3681 sz += QSize(23, 0); //arrow button 3681 const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1); 3682 sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget) 3683 + textMargins, 23), 0); //arrow button 3682 3684 } 3683 3685 } -
trunk/src/gui/styles/qwindowsxpstyle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsxpstyle_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/styles.pri
r769 r846 47 47 HEADERS += \ 48 48 styles/qmacstyle_mac.h \ 49 styles/qmacstylepixmaps_mac_p.h 49 styles/qmacstylepixmaps_mac_p.h \ 50 styles/qmacstyle_mac_p.h 50 51 OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm 51 52 … … 171 172 symbian { 172 173 SOURCES += styles/qs60style_s60.cpp 173 LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils -legul -lbmpanim 174 LIBS += -legul -lbmpanim 175 contains(CONFIG, is_using_gnupoc) { 176 LIBS += -laknicon -laknskins -laknskinsrv -lfontutils 177 } else { 178 LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils 179 } 174 180 } else { 175 181 SOURCES += styles/qs60style_simulated.cpp … … 177 183 } 178 184 } else { 185 symbian { 186 HEADERS += styles/qs60style.h 187 SOURCES += styles/qs60style_stub.cpp 188 } 179 189 DEFINES += QT_NO_STYLE_S60 180 190 }
Note:
See TracChangeset
for help on using the changeset viewer.