Changeset 846 for trunk/src/gui/styles


Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
63 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/styles/qcdestyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qcdestyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qcleanlooksstyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4545#if !defined(QT_NO_STYLE_CLEANLOOKS) || defined(QT_PLUGIN)
    4646
    47 #include <private/qstylehelper_p.h>
    4847#include "qwindowsstyle_p.h"
    4948#include <qcombobox.h>
     
    6867#include <qwizard.h>
    6968#include <qlibrary.h>
     69#include <private/qstylehelper_p.h>
    7070
    7171#define CL_MAX(a,b) (a)>(b) ? (a):(b) // ### qMin/qMax does not work for vc6
     
    885885        painter->restore();
    886886        break;
    887 #ifndef QT_NO_LINEDIT
     887#ifndef QT_NO_LINEEDIT
    888888    case PE_FrameLineEdit:
    889889        // fall through
     
    13981398
    13991399    QColor highlight = option->palette.highlight().color();
    1400     QColor highlightText = option->palette.highlightedText().color();
    14011400
    14021401    switch(element) {
     
    21592158
    21602159            if (button->features & QStyleOptionButton::HasMenu)
    2161                 ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
     2160                ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
    21622161            proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled),
    21632162                         button->text, QPalette::ButtonText);
     
    27242723                // Fill title bar gradient
    27252724                QColor titlebarColor = QColor(active ? highlight: palette.background().color());
    2726                 QColor titleBarGradientStop(active ? highlight.darker(150): palette.background().color().darker(120));
    27272725                QLinearGradient gradient(option->rect.center().x(), option->rect.top(),
    27282726                                         option->rect.center().x(), option->rect.bottom());
     
    29872985            painter->fillRect(option->rect, option->palette.background());
    29882986
    2989             QRect rect = scrollBar->rect;
    29902987            QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
    29912988            QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
     
    37153712    int ret = -1;
    37163713    switch (metric) {
     3714    case PM_ToolTipLabelFrameWidth:
     3715        ret = 2;
     3716        break;
    37173717    case PM_ButtonDefaultIndicator:
    37183718        ret = 0;
     
    40154015            case SC_SliderHandle: {
    40164016                if (slider->orientation == Qt::Horizontal) {
    4017                     rect.setHeight(pixelMetric(PM_SliderThickness));
    4018                     rect.setWidth(pixelMetric(PM_SliderLength));
     4017                    rect.setHeight(proxy()->pixelMetric(PM_SliderThickness));
     4018                    rect.setWidth(proxy()->pixelMetric(PM_SliderLength));
    40194019                    int centerY = slider->rect.center().y() - rect.height() / 2;
    40204020                    if (slider->tickPosition & QSlider::TicksAbove)
     
    40244024                    rect.moveTop(centerY);
    40254025                } else {
    4026                     rect.setWidth(pixelMetric(PM_SliderThickness));
    4027                     rect.setHeight(pixelMetric(PM_SliderLength));
     4026                    rect.setWidth(proxy()->pixelMetric(PM_SliderThickness));
     4027                    rect.setHeight(proxy()->pixelMetric(PM_SliderLength));
    40284028                    int centerX = slider->rect.center().x() - rect.width() / 2;
    40294029                    if (slider->tickPosition & QSlider::TicksAbove)
  • trunk/src/gui/styles/qcleanlooksstyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qcleanlooksstyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qcommonstyle.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6666#include <private/qcommonstylepixmaps_p.h>
    6767#include <private/qmath_p.h>
    68 #include <private/qstylehelper_p.h>
    6968#include <qdebug.h>
    7069#include <qtextformat.h>
     
    9291#   include <qt_os2.h>
    9392#endif
     93
     94#include <private/qstylehelper_p.h>
    9495
    9596QT_BEGIN_NAMESPACE
     
    766767    case PE_PanelItemViewRow:
    767768        if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
    768             QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
     769            QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
    769770                                      ? QPalette::Normal : QPalette::Disabled;
    770771            if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
     
    779780    case PE_PanelItemViewItem:
    780781        if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
    781             QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
     782            QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
    782783                                      ? QPalette::Normal : QPalette::Disabled;
    783784            if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
     
    986987            p->save();
    987988            p->setFont(option->font);
    988             p->drawText(int(x), int(y), elidedText);
     989            p->drawText(QPointF(x, y), elidedText);
    989990            p->restore();
    990991            break;
     
    14071408        break;
    14081409    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));
    14111413        break;
    14121414    case CE_ProgressBarLabel:
     
    47834785            int margins = 0;
    47844786            // we add 4 pixels for label margins
    4785             if (btn->icon.isNull() || !btn->text.isEmpty())
     4787            if (!btn->icon.isNull() || !btn->text.isEmpty())
    47864788                margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing
    47874789                                                  : PM_CheckBoxLabelSpacing, opt, widget);
     
    56855687        switch (standardIcon) {
    56865688        case QStyle::SP_MessageBoxQuestion:
     5689            iconType = kQuestionMarkIcon;
     5690            break;
    56875691        case QStyle::SP_MessageBoxInformation:
     5692            iconType = kAlertNoteIcon;
     5693            break;
    56885694        case QStyle::SP_MessageBoxWarning:
     5695            iconType = kAlertCautionIcon;
     5696            break;
    56895697        case QStyle::SP_MessageBoxCritical:
    5690             iconType = kGenericApplicationIcon;
     5698            iconType = kAlertStopIcon;
    56915699            break;
    56925700        case SP_DesktopIcon:
     
    57785786#ifndef QT_NO_IMAGEFORMAT_PNG
    57795787     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));
    57835791        break;
    57845792    case SP_FileDialogBack:
     
    57875795        return standardIconImplementation(SP_ArrowUp, option, widget);
    57885796    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));
    57925800        break;
    57935801    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));
    57975805        break;
    57985806    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));
    58025810        break;
    58035811    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));
    58075815        break;
    58085816    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));
    58125820        break;
    58135821    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));
    58175825        break;
    58185826    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));
    58225830        break;
    58235831    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));
    58275835        break;
    58285836    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));
    58325840        break;
    58335841    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));
    58375845        break;
    58385846    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));
    58425850        break;
    58435851    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));
    58475855        break;
    58485856    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));
    58525860        break;
    58535861    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));
    58575865        break;
    58585866    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));
    58625870        break;
    58635871    case SP_ArrowForward:
     
    58705878        return standardIconImplementation(SP_ArrowLeft, option, widget);
    58715879    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));
    58755883        break;
    58765884    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));
    58805888        break;
    58815889    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));
    58855893        break;
    58865894    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));
    58905898        break;
    58915899   case SP_DirHomeIcon:
     
    59055913        break;
    59065914    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));
    59105918        break;
    59115919    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));
    59155923        break;
    59165924    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));
    59205928        break;
    59215929    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));
    59255933        break;
    59265934    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));
    59305938        break;
    59315939    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));
    59345942        break;
    59355943    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));
    59385946        break;
    59395947    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));
    59425950        break;
    59435951    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));
    59465954        break;
    59475955    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));
    59505958        break;
    59515959    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));
    59545962        break;
    59555963    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));
    59585966        break;
    59595967    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));
    59625970        break;
    59635971    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));
    59665974        break;
    59675975    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));
    59695977        break;
    59705978    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));
    59725980        break;
    59735981#endif // QT_NO_IMAGEFORMAT_PNG
  • trunk/src/gui/styles/qcommonstyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qcommonstyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qcommonstylepixmaps_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qgtkpainter.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4848// and takes care of converting all such calls into cached Qt pixmaps.
    4949
     50#include <private/qstylehelper_p.h>
    5051#include <QtGui/QWidget>
    5152#include <QtGui/QStyleOption>
     
    143144
    144145QGtkPainter::QGtkPainter(QPainter *_painter)
    145         : m_window(QGtkStylePrivate::gtkWidget(QLatin1String("GtkWindow")))
     146        : m_window(QGtkStylePrivate::gtkWidget("GtkWindow"))
    146147        , m_painter(_painter)
    147148        , m_alpha(true)
     
    156157{
    157158    // 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));
    160165    return tmp;
    161166}
     
    237242        rect.setHeight(2 * border + 1);
    238243
    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);
    241248
    242249    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
     
    303310
    304311    QString pixmapName = uniqueName(QLS(part), state, shadow,
    305                                     rect.size(), gtkWidget) + pmKey;
     312                                    rect.size(), gtkWidget) % pmKey;
    306313
    307314    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
     
    353360
    354361    QPixmap cache;
    355     QString hLineExtras = QString(QLS("%0 %1 %2")).arg(x1).arg(x2).arg(y);
    356362    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;
    358367    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    359368        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_hline (style,
     
    380389
    381390    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
    385397    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    386398        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_vline (style,
     
    408420
    409421    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
    412426    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    413427        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_expander (style, pixmap,
     
    432446
    433447    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;
    435449    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    436450        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_focus (style, pixmap, state, NULL,
     
    457471
    458472    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;
    460474    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    461475        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_resize_grip (style, pixmap, state,
     
    482496
    483497    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;
    486501
    487502    GdkRectangle gtkCliprect = {0, 0, rect.width(), rect.height()};
     
    514529    QPixmap cache;
    515530    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size())
    516                          + QString::number(orientation);
     531                         % HexString<uchar>(orientation);
     532
    517533    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    518534        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_handle (style,
     
    542558
    543559    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;
    545561    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    546562        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_slider (style,
     
    573589    QRect r = rect;
    574590    QPixmap cache;
    575     QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey;
     591    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey;
    576592    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    577593        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_shadow(style, pixmap, state, shadow, NULL,
     
    592608    QRect r = rect;
    593609    QPixmap cache;
    594     QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey;
     610    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey;
    595611    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    596612        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_flat_box (style,
     
    619635    QRect r = rect;
    620636    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);
    623639
    624640    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
  • trunk/src/gui/styles/qgtkpainter_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qgtkstyle.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6868#include <QtGui/QCheckBox>
    6969#include <QtGui/QTreeView>
     70#include <QtGui/QStyledItemDelegate>
    7071#include <qpixmapcache.h>
    7172#undef signals // Collides with GTK stymbols
     
    223224    if (d->isThemeAvailable()) {
    224225        GtkStyle *style = d->gtkStyle();
    225         GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     226        GtkWidget *gtkButton = d->gtkWidget("GtkButton");
    226227        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;
    230230        gdkBg = style->bg[GTK_STATE_NORMAL];
    231231        gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL];
     
    237237        gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED];
    238238        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
    239244        bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
    240245        text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
     
    243248        highlight = QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8);
    244249        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);
    245252
    246253        palette.setColor(QPalette::HighlightedText, highlightText);
     254
     255
    247256        palette.setColor(QPalette::Light, bg.lighter(125));
    248257        palette.setColor(QPalette::Shadow, bg.darker(130));
     
    254263
    255264        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");
    257266        GdkColor *gtkAltBase = NULL;
    258267        d->gtk_widget_style_get(gtkTreeView, "odd-row-color", &gtkAltBase, NULL);
     
    279288        palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight);
    280289        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
    281294        style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow",
    282295                d->gtk_window_get_type());
     
    326339            qt_filedialog_open_filenames_hook = &QGtkStylePrivate::openFilenames;
    327340            qt_filedialog_existing_directory_hook = &QGtkStylePrivate::openDirectory;
     341            qApp->installEventFilter(&d->filter);
    328342        }
    329343    }
     
    346360        qt_filedialog_open_filenames_hook = 0;
    347361        qt_filedialog_existing_directory_hook = 0;
     362        qApp->removeEventFilter(&d->filter);
    348363    }
    349364}
     
    422437
    423438    case PM_ButtonShiftHorizontal: {
    424         GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     439        GtkWidget *gtkButton = d->gtkWidget("GtkButton");
    425440        guint horizontal_shift;
    426441        d->gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL);
     
    429444
    430445    case PM_ButtonShiftVertical: {
    431         GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     446        GtkWidget *gtkButton = d->gtkWidget("GtkButton");
    432447        guint vertical_shift;
    433448        d->gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL);
     
    439454
    440455    case PM_MenuPanelWidth: {
    441         GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
     456        GtkWidget *gtkMenu = d->gtkWidget("GtkMenu");
    442457        guint horizontal_padding = 0;
    443458        // horizontal-padding is used by Maemo to get thicker borders
     
    496511    case PM_SliderThickness:
    497512    case PM_SliderControlThickness: {
    498         GtkWidget *gtkScale = d->gtkWidget(QLS("GtkHScale"));
     513        GtkWidget *gtkScale = d->gtkWidget("GtkHScale");
    499514        gint val;
    500515        d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL);
     
    507522        gint sliderLength;
    508523        gint trough_border;
    509         GtkWidget *hScrollbar = d->gtkWidget(QLS("GtkHScrollbar"));
     524        GtkWidget *hScrollbar = d->gtkWidget("GtkHScrollbar");
    510525        d->gtk_widget_style_get(hScrollbar,
    511526                               "trough-border",   &trough_border,
     
    520535    case PM_SliderLength:
    521536        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);
    523538        return val;
    524539
     
    527542    case PM_IndicatorWidth:
    528543    case PM_IndicatorHeight: {
    529         GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
     544        GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton");
    530545        gint size, spacing;
    531546        d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL);
     
    534549
    535550    case PM_MenuBarVMargin: {
    536         GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
     551        GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
    537552        return  qMax(0, gtkMenubar->style->ythickness);
    538553    }
     
    540555    {
    541556        gint spacing = 3;
    542         GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow"));
     557        GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow");
    543558        Q_ASSERT(gtkScrollWindow);
    544559        d->gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL);
     
    547562    case PM_SubMenuOverlap: {
    548563        gint offset = 0;
    549         GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
     564        GtkWidget *gtkMenu = d->gtkWidget("GtkMenu");
    550565        d->gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL);
    551566        return offset;
     
    588603        if (d->isKDE4Session())
    589604            return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
    590         GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
     605        GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar");
    591606        GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
    592607        g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL);
     
    611626
    612627    case SH_ComboBox_Popup: {
    613         GtkWidget *gtkComboBox = d->gtkWidget(QLS("GtkComboBox"));
     628        GtkWidget *gtkComboBox = d->gtkWidget("GtkComboBox");
    614629        gboolean appears_as_list;
    615630        d->gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL);
     
    635650            scrollbars_within_bevel = true;
    636651        else if (!d->gtk_check_version(2, 12, 0)) {
    637             GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow"));
     652            GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow");
    638653            d->gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
    639654        }
     
    691706        const int pmSize = 64;
    692707        const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
    693         const QString pmKey = QString(QLS("windowframe %0")).arg(option->state);
     708        const QString pmKey = QLatin1Literal("windowframe") % HexString<uint>(option->state);
    694709
    695710        QPixmap pixmap;
     
    713728                                     "*.GtkScrolledWindow", "*.GtkScrolledWindow", d->gtk_window_get_type());
    714729            if (style)
    715                 gtkFramePainter.paintShadow(d->gtkWidget(QLS("GtkFrame")), "viewport", pmRect,
     730                gtkFramePainter.paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect,
    716731                                         option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
    717732                                         shadow_type, style);
     
    740755
    741756    case PE_PanelTipLabel: {
    742         GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed
     757        GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed
    743758        style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow",
    744759                d->gtk_window_get_type());
     
    755770        }
    756771        GtkShadowType shadow_type;
    757         GtkWidget *gtkStatusbarFrame = d->gtkWidget(QLS("GtkStatusbar.GtkFrame"));
     772        GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame");
    758773        d->gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL);
    759774        gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL,
     
    764779    case PE_IndicatorHeaderArrow:
    765780        if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
    766             GtkWidget *gtkTreeHeader = d->gtkWidget(QLS("GtkTreeView.GtkButton"));
     781            GtkWidget *gtkTreeHeader = d->gtkWidget("GtkTreeView.GtkButton");
    767782            GtkStateType state = gtkPainter.gtkState(option);
    768783            style = gtkTreeHeader->style;
     
    770785            QRect r = header->rect;
    771786            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
    772789            if (header->sortIndicator & QStyleOptionHeader::SortUp)
    773790                type = GTK_ARROW_UP;
     
    787804            QRect frameRect = option->rect.adjusted(1, 1, -1, -2);
    788805
    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            }
    793813        }
    794814        break;
     
    802822            GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED;
    803823            GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED;
    804             GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView"));
     824            GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView");
    805825
    806826            GtkStateType state = GTK_STATE_NORMAL;
     
    814834        }
    815835        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
    816852    case PE_PanelItemViewItem:
    817853        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);
    833875                }
     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);
    834883            }
    835884        }
     
    838887        {
    839888            const int margin = 6;
    840             GtkWidget *gtkSeparator = d->gtkWidget(QLS("GtkToolbar.GtkSeparatorToolItem"));
     889            GtkWidget *gtkSeparator = d->gtkWidget("GtkToolbar.GtkSeparatorToolItem");
    841890            if (option->state & State_Horizontal) {
    842891                const int offset = option->rect.width()/2;
     
    858907
    859908    case PE_IndicatorToolBarHandle: {
    860         GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
     909        GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar");
    861910        GtkShadowType shadow_type;
    862911        d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
     
    906955
    907956        QColor arrowColor = option->palette.buttonText().color();
    908         GtkWidget *gtkArrow = d->gtkWidget(QLS("GtkArrow"));
     957        GtkWidget *gtkArrow = d->gtkWidget("GtkArrow");
    909958        GdkColor color = fromQColor(arrowColor);
    910959        d->gtk_widget_modify_fg (gtkArrow, state, &color);
     
    922971
    923972    case PE_PanelMenu: {
    924             GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
     973            GtkWidget *gtkMenu = d->gtkWidget("GtkMenu");
    925974            gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons
    926975            gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style, QString());
     
    934983        // This is only used by floating tool bars
    935984        if (qobject_cast<const QToolBar *>(widget)) {
    936             GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
     985            GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
    937986            gtkPainter.paintBox( gtkMenubar, "toolbar",  option->rect,
    938987                                 GTK_STATE_NORMAL, GTK_SHADOW_OUT, style);
     
    943992
    944993    case PE_FrameLineEdit: {
    945         GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
     994        GtkWidget *gtkEntry = d->gtkWidget("GtkEntry");
    946995
    947996
     
    9771026    case PE_PanelLineEdit:
    9781027        if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
    979             GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
     1028            GtkWidget *gtkEntry = d->gtkWidget("GtkEntry");
    9801029            if (panel->lineWidth > 0)
    9811030                proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget);
     
    9951044    case PE_FrameTabWidget:
    9961045        if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(option)) {
    997             GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook"));
     1046            GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook");
    9981047            style = gtkPainter.getStyle(gtkNotebook);
    9991048            gtkPainter.setAlphaSupport(false);
     
    10431092        if (option->state & State_On || option->state & State_Sunken)
    10441093            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");
    10461095        gint focusWidth, focusPad;
    10471096        gboolean interiorFocus = false;
     
    10991148            shadow = GTK_SHADOW_OUT;
    11001149
    1101         GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton"));
     1150        GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton");
    11021151        gint spacing;
    11031152        d->gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL);
     
    11061155        // ### Note: Ubuntulooks breaks when the proper widget is passed
    11071156        //           Murrine engine requires a widget not to get RGBA check - warnings
    1108         GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
     1157        GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton");
    11091158        QString key(QLS("radiobutton"));
    11101159        if (option->state & State_HasFocus) { // Themes such as Nodoka check this flag
     
    11341183        int spacing;
    11351184
    1136         GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
     1185        GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton");
    11371186        QString key(QLS("checkbutton"));
    11381187        if (option->state & State_HasFocus) { // Themes such as Nodoka checks this flag
     
    11621211                = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
    11631212            QRect tabRect = tbb->rect;
    1164             QRegion region(tabRect);
    11651213            painter->save();
    11661214            painter->setPen(QPen(option->palette.dark().color().dark(110), 0));
     
    12441292        alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline);
    12451293
    1246     QPalette palette = option->palette;
    1247 
    12481294    switch (control) {
    12491295
     
    12761322            if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
    12771323                // Draw prelight background
    1278                 GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
     1324                GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton");
    12791325
    12801326                if (option->state & State_MouseOver) {
     
    13321378            bool isEnabled = (comboBox->state & State_Enabled);
    13331379            bool focus = isEnabled && (comboBox->state & State_HasFocus);
    1334             QColor buttonShadow = option->palette.dark().color();
    13351380            GtkStateType state = gtkPainter.gtkState(option);
    13361381            int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget);
    1337             QPixmap cache;
    1338             QString pixmapName;
    13391382            QStyleOptionComboBox comboBoxCopy = *comboBox;
    13401383            comboBoxCopy.rect = option->rect;
     
    13441387            QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
    13451388                                                   SC_ComboBoxArrow, widget);
    1346             QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
    1347                                             SC_ComboBoxEditField, widget);
    13481389
    13491390            GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
    13501391                                   GTK_SHADOW_IN : GTK_SHADOW_OUT;
    1351             QString comboBoxPath = QLS(comboBox->editable ? "GtkComboBoxEntry" : "GtkComboBox");
     1392            const QHashableLatin1Literal comboBoxPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox");
    13521393
    13531394            // We use the gtk widget to position arrows and separators for us
     
    13571398            d->gtk_widget_size_allocate(gtkCombo, &geometry);
    13581399
    1359             QString buttonPath = comboBoxPath + QLS(".GtkToggleButton");
     1400            QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton")
     1401                                : QHashableLatin1Literal("GtkComboBox.GtkToggleButton");
    13601402            GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath);
    13611403            d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
     
    13661408                if (comboBox->editable || appears_as_list) {
    13671409                    GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state;
    1368                     QString entryPath = QLS(comboBox->editable ? "GtkComboBoxEntry.GtkEntry" : "GtkComboBox.GtkFrame");
     1410                    QHashableLatin1Literal entryPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame");
    13691411                    GtkWidget *gtkEntry = d->gtkWidget(entryPath);
    13701412                    d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
     
    13921434                        gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect,
    13931435                                                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));
    13951437                    }
    13961438
    13971439                    gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState,
    1398                                            GTK_SHADOW_IN, gtkEntry->style, entryPath +
     1440                                           GTK_SHADOW_IN, gtkEntry->style, entryPath.toString() +
    13991441                                           QString::number(focus) + QString::number(comboBox->editable) +
    14001442                                           QString::number(option->direction));
     
    14121454                    buttonState = GTK_STATE_PRELIGHT;
    14131455
    1414                 QRect buttonrect = QRect(gtkToggleButton->allocation.x, gtkToggleButton->allocation.y,
    1415                                          gtkToggleButton->allocation.width, gtkToggleButton->allocation.height);
    1416 
    14171456                Q_ASSERT(gtkToggleButton);
    14181457                gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState,
    1419                                      shadow, gtkToggleButton->style, buttonPath +
     1458                                     shadow, gtkToggleButton->style, buttonPath.toString() +
    14201459                                     QString::number(focus) + QString::number(option->direction));
    14211460                if (focus)
     
    14301469                                    buttonRect, state,
    14311470                                    shadow, gtkToggleButton->style,
    1432                                     buttonPath + QString::number(focus));
     1471                                    buttonPath.toString() + QString::number(focus));
    14331472                if (focus)
    14341473                    GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
    14351474
     1475
    14361476                // 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");
    14381480
    14391481                if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) {
     
    14451487                    gtkCachedPainter.paintVline( gtkVSeparator, "vseparator",
    14461488                                           vLineRect, state, gtkVSeparator->style,
    1447                                            0, vLineRect.height(), 0,  vSeparatorPath);
     1489                                           0, vLineRect.height(), 0,  vSeparatorPath.toString());
    14481490
    14491491
     
    14701512                    state = GTK_STATE_NORMAL;
    14711513
    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                }
    14741526
    14751527                GtkWidget *gtkArrow = d->gtkWidget(arrowPath);
     
    14981550                if (sunken) {
    14991551                    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);
    15011557                    d->gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL);
    15021558                    d->gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL);
     
    15101566                    gtkCachedPainter.paintArrow( gtkArrow, "arrow", arrowRect,
    15111567                                           GTK_ARROW_DOWN, state, GTK_SHADOW_NONE, TRUE,
    1512                                            style, arrowPath + QString::number(option->direction));
     1568                                           style, arrowPath.toString() + QString::number(option->direction));
    15131569                }
    15141570            }
     
    15711627            QStyleOptionToolButton label = *toolbutton;
    15721628            label.state = bflags;
    1573             GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton"));
     1629            GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton");
    15741630            QPalette pal = toolbutton->palette;
    15751631            if (option->state & State_Enabled &&
     
    16061662    case CC_ScrollBar:
    16071663        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");
    16101666
    16111667            // Fill background in case the scrollbar is partially transparent
     
    16221678            gboolean trough_under_steppers = true;
    16231679            gboolean trough_side_details = false;
     1680            gboolean activate_slider = false;
    16241681            gboolean stepper_size = 14;
    16251682            gint trough_border = 1;
     
    16291686                                           "trough-side-details",   &trough_side_details,
    16301687                                           "trough-under-steppers", &trough_under_steppers,
     1688                                           "activate-slider",       &activate_slider,
    16311689                                           "stepper-size",          &stepper_size, NULL);
    16321690            }
     
    16741732                if (!(option->state & State_Enabled))
    16751733                    state = GTK_STATE_INSENSITIVE;
     1734                else if (activate_slider &&
     1735                         option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSlider))
     1736                    state = GTK_STATE_ACTIVE;
    16761737                else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSlider))
    16771738                    state = GTK_STATE_PRELIGHT;
     
    17521813        if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
    17531814
    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");
    17581818            bool isEnabled = (spinBox->state & State_Enabled);
    17591819            bool hover = isEnabled && (spinBox->state & State_MouseOver);
     
    19071967    case CC_Slider:
    19081968        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");
    19111971
    19121972            QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
    19131973            QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
    1914             QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
    19151974
    19161975            bool horizontal = slider->orientation == Qt::Horizontal;
    19171976            bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
    19181977            bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
    1919             QColor activeHighlight = option->palette.color(QPalette::Normal, QPalette::Highlight);
    1920 
    1921             QPixmap cache;
     1978
    19221979            QBrush oldBrush = painter->brush();
    19231980            QPen oldPen = painter->pen();
     
    19281985            highlightAlpha.setAlpha(80);
    19291986
     1987            QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ?
     1988                                                       GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
    19301989            GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
    19311990            style = scaleWidget->style;
     
    19612020
    19622021                    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                        }
    19652029                    } 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                        }
    19682037                    }
    19692038
     
    20982167    case CE_ProgressBarLabel:
    20992168        if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
    2100             GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar"));
     2169            GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar");
    21012170            if (!gtkProgressBar)
    21022171                return;
     
    22012270                ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
    22022271
    2203             GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     2272            GtkWidget *gtkButton = d->gtkWidget("GtkButton");
    22042273            QPalette pal = button->palette;
    22052274            int labelState = GTK_STATE_INSENSITIVE;
     
    22222291
    22232292            // Draw prelight background
    2224             GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton"));
     2293            GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton");
    22252294
    22262295            if (option->state & State_MouseOver) {
     
    22902359
    22912360            if (!cb->currentText.isEmpty() && !cb->editable) {
    2292                 GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox"));
     2361                GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox");
    22932362                QPalette pal = cb->palette;
    22942363                int labelState = GTK_STATE_INSENSITIVE;
     
    23672436        if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
    23682437            Q_UNUSED(header);
    2369             GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView"));
     2438            GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView");
    23702439            // Get the middle column
    23712440            GtkTreeViewColumn *column = d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1);
     
    23882457
    23892458    case CE_SizeGrip: {
    2390         GtkWidget *gtkStatusbar = d->gtkWidget(QLS("GtkStatusbar.GtkFrame"));
     2459        GtkWidget *gtkStatusbar = d->gtkWidget("GtkStatusbar.GtkFrame");
    23912460        QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness);
    23922461        gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL,
     
    24002469
    24012470    case CE_MenuBarEmptyArea: {
    2402         GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
     2471        GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
    24032472        GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
    24042473        painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
     
    24232492
    24242493        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");
    24272496
    24282497            style = gtkMenubarItem->style;
     
    24802549
    24812550    case CE_Splitter: {
    2482         GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed
     2551        GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed
    24832552        gtkPainter.paintHandle(gtkWindow, "splitter", option->rect, gtkPainter.gtkState(option), GTK_SHADOW_NONE,
    24842553                                !(option->state & State_Horizontal) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL,
     
    25002569                rect.adjust(0, 0, 1, 0);
    25012570
    2502             GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
     2571            GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar");
    25032572            GtkShadowType shadow_type = GTK_SHADOW_NONE;
    25042573            d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
     
    25192588            const int windowsItemVMargin      = 26; // menu item ver text margin
    25202589            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");
    25232592
    25242593            style = gtkPainter.getStyle(gtkMenuItem);
    2525             QColor borderColor = option->palette.background().color().darker(160);
    25262594            QColor shadow = option->palette.dark().color();
    25272595
    25282596            if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
    2529                 GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem"));
     2597                GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem");
    25302598                painter->setPen(shadow.lighter(106));
    25312599                gboolean wide_separators = 0;
     
    25712639
    25722640            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);
    25742642
    25752643            int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize));
     
    27482816            // Arrow
    27492817            if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
    2750                 QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
    2751                                    proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));
    27522818
    27532819                QFontMetrics fm(menuitem->font);
     
    27822848    case CE_PushButton:
    27832849        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
    2784             GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     2850            GtkWidget *gtkButton = d->gtkWidget("GtkButton");
    27852851            proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget);
    27862852            QStyleOptionButton subopt = *btn;
     
    28082874    case CE_TabBarTabShape:
    28092875        if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
    2810             GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook"));
     2876            GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook");
    28112877            style = gtkPainter.getStyle(gtkNotebook);
    28122878
     
    28752941        if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
    28762942            Q_UNUSED(bar);
    2877             GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar"));
     2943            GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar");
    28782944            GtkStateType state = gtkPainter.gtkState(option);
    28792945            gtkPainter.paintBox( gtkProgressBar, "trough",  option->rect, state, GTK_SHADOW_IN, gtkProgressBar->style);
     
    28852951        if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
    28862952            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");
    28882954            style = gtkProgressBar->style;
    28892955            gtkPainter.paintBox( gtkProgressBar, "trough",  option->rect, state, GTK_SHADOW_IN, style);
     
    30433109    case CC_SpinBox:
    30443110        if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
    3045             GtkWidget *gtkSpinButton = d->gtkWidget(QLS("GtkSpinButton"));
     3111            GtkWidget *gtkSpinButton = d->gtkWidget("GtkSpinButton");
    30463112            int center = spinbox->rect.height() / 2;
    30473113            int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0;
     
    30963162        if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
    30973163            // 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");
    31003166            d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
    31013167            GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())};
    31023168            d->gtk_widget_size_allocate(gtkCombo, &geometry);
    31033169            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            }
    31083177
    31093178            GtkWidget *arrowWidget = d->gtkWidget(arrowPath);
     
    31643233    case CT_ToolButton:
    31653234        if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
    3166             GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton"));
     3235            GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton");
    31673236            newSize = size + QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness);
    31683237            if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
     
    31823251
    31833252            if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
    3184                 GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem"));
     3253                GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem");
    31853254                GtkRequisition sizeReq = {0, 0};
    31863255                d->gtk_widget_size_request(gtkMenuSeparator, &sizeReq);
     
    31893258            }
    31903259
    3191             GtkWidget *gtkMenuItem = d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem"));
     3260            GtkWidget *gtkMenuItem = d->gtkWidget("GtkMenu.GtkCheckMenuItem");
    31923261            GtkStyle* style = gtkMenuItem->style;
    31933262
     
    32113280    case CT_SpinBox:
    32123281        // 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);
    32143283        break;
    32153284
    32163285    case CT_PushButton:
    32173286        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
    3218             GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     3287            GtkWidget *gtkButton = d->gtkWidget("GtkButton");
    32193288            gint focusPadding, focusWidth;
    32203289            d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL);
     
    32243293            newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding));
    32253294
    3226             GtkWidget *gtkButtonBox = d->gtkWidget(QLS("GtkHButtonBox"));
     3295            GtkWidget *gtkButtonBox = d->gtkWidget("GtkHButtonBox");
    32273296            gint minWidth = 85, minHeight = 0;
    32283297            d->gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth,
     
    32373306
    32383307    case CT_Slider: {
    3239         GtkWidget *gtkSlider = d->gtkWidget(QLS("GtkHScale"));
     3308        GtkWidget *gtkSlider = d->gtkWidget("GtkHScale");
    32403309        newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness);
    32413310    }
     
    32433312
    32443313    case CT_LineEdit: {
    3245         GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
     3314        GtkWidget *gtkEntry = d->gtkWidget("GtkEntry");
    32463315        newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness);
    32473316    }
     
    32543323    case CT_ComboBox:
    32553324        if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
    3256             GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox"));
     3325            GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox");
    32573326            QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget);
    32583327            newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness);
     
    34093478    case SE_PushButtonContents:
    34103479        if (!d->gtk_check_version(2, 10, 0)) {
    3411             GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     3480            GtkWidget *gtkButton = d->gtkWidget("GtkButton");
    34123481            GtkBorder *border = 0;
    34133482            d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL);
  • trunk/src/gui/styles/qgtkstyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qgtkstyle_p.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6161#include <QtCore/QUrl>
    6262#include <QtCore/QLibrary>
     63#include <QtCore/QDebug>
    6364
    6465#include <private/qapplication_p.h>
     
    234235}
    235236
    236 static QString classPath(GtkWidget *widget)
    237 {
    238     char* class_path;
     237static QHashableLatin1Literal classPath(GtkWidget *widget)
     238{
     239    char *class_path;
    239240    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
    241250    g_free(class_path);
    242251
    243     // Remove the prefixes
    244     path.remove(QLS("GtkWindow."));
    245     path.remove(QLS("GtkFixed."));
    246     return path;
     252    return QHashableLatin1Literal::fromData(copy);
    247253}
    248254
     
    262268
    263269QList<QGtkStylePrivate *> QGtkStylePrivate::instances;
     270QGtkStylePrivate::WidgetMap *QGtkStylePrivate::widgetMap = 0;
    264271
    265272QGtkStylePrivate::QGtkStylePrivate()
     
    279286    resolveGtk();
    280287    initGtkWidgets();
    281     if (isThemeAvailable())
    282         qApp->installEventFilter(&filter);
    283 }
    284 
    285 GtkWidget* QGtkStylePrivate::gtkWidget(const QString &path)
     288}
     289
     290GtkWidget* QGtkStylePrivate::gtkWidget(const QHashableLatin1Literal &path)
    286291{
    287292    GtkWidget *widget = gtkWidgetMap()->value(path);
     
    293298}
    294299
    295 GtkStyle* QGtkStylePrivate::gtkStyle(const QString &path)
    296 {
    297     if (gtkWidgetMap()->contains(path))
    298         return gtkWidgetMap()->value(path)->style;
     300GtkStyle* QGtkStylePrivate::gtkStyle(const QHashableLatin1Literal &path)
     301{
     302    if (GtkWidget *w = gtkWidgetMap()->value(path))
     303        return w->style;
    299304    return 0;
    300305}
     
    495500
    496501    static QString themeName;
    497     if (!gtkWidgetMap()->contains(QLS("GtkWindow")) && themeName.isEmpty()) {
     502    if (!gtkWidgetMap()->contains("GtkWindow") && themeName.isEmpty()) {
    498503        themeName = getThemeName();
    499504
     
    520525        if (displayDepth == -1)
    521526            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);
    523530
    524531
     
    527534            QGtkStylePrivate::gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL);
    528535
    529         if (!gtkWidgetMap()->contains(QLS("GtkButton"))) {
     536        if (!gtkWidgetMap()->contains("GtkButton")) {
    530537            GtkWidget *gtkButton = QGtkStylePrivate::gtk_button_new();
    531538            addWidget(gtkButton);
     
    564571            // as with the combo box. We need to update the widget map
    565572            // to reflect this;
    566             QHash<QString, GtkWidget*> oldMap = *gtkWidgetMap();
     573            QHash<QHashableLatin1Literal, GtkWidget*> oldMap = *gtkWidgetMap();
    567574            gtkWidgetMap()->clear();
    568             QHashIterator<QString, GtkWidget*> it(oldMap);
     575            QHashIterator<QHashableLatin1Literal, GtkWidget*> it(oldMap);
    569576            while (it.hasNext()) {
    570577                it.next();
    571                 if (!it.key().contains(QLatin1Char('.'))) {
     578                if (!strchr(it.key().data(), '.')) {
    572579                    addAllSubWidgets(it.value());
    573580                }
     581                free(const_cast<char *>(it.key().data()));
    574582            }
    575583        }
     
    584592void QGtkStylePrivate::cleanupGtkWidgets()
    585593{
    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()));
    588601}
    589602
     
    676689{
    677690    const int MIN_ARROW_WIDTH = 6;
    678     GtkWidget *spinButton = gtkWidget(QLS("GtkSpinButton"));
     691    GtkWidget *spinButton = gtkWidget("GtkSpinButton");
    679692    GtkStyle *style = spinButton->style;
    680693    gint size = pango_font_description_get_size (style->font_desc);
     
    696709void QGtkStylePrivate::applyCustomPaletteHash()
    697710{
    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];
    700713    QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
    701714    menuPal.setBrush(QPalette::Base, bgColor);
     
    703716    qApp->setPalette(menuPal, "QMenu");
    704717
    705     QPalette toolbarPal = gtkWidgetPalette(QLS("GtkToolbar"));
     718    QPalette toolbarPal = gtkWidgetPalette("GtkToolbar");
    706719    qApp->setPalette(toolbarPal, "QToolBar");
    707720
    708     QPalette menuBarPal = gtkWidgetPalette(QLS("GtkMenuBar"));
     721    QPalette menuBarPal = gtkWidgetPalette("GtkMenuBar");
    709722    qApp->setPalette(menuBarPal, "QMenuBar");
    710723}
     
    715728GtkWidget* QGtkStylePrivate::getTextColorWidget() const
    716729{
    717     return  gtkWidget(QLS("GtkEntry"));
     730    return  gtkWidget("GtkEntry");
    718731}
    719732
     
    724737        if (!protoLayout) {
    725738            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);
    727740        }
    728741        Q_ASSERT(protoLayout);
     
    734747}
    735748
     749void 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
    736759void QGtkStylePrivate::addWidgetToMap(GtkWidget *widget)
    737760{
    738761    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
    741770    }
    742771 }
     
    751780
    752781// Updates window/windowtext palette based on the indicated gtk widget
    753 QPalette QGtkStylePrivate::gtkWidgetPalette(const QString &gtkWidgetName) const
     782QPalette QGtkStylePrivate::gtkWidgetPalette(const QHashableLatin1Literal &gtkWidgetName) const
    754783{
    755784    GtkWidget *gtkWidget = QGtkStylePrivate::gtkWidget(gtkWidgetName);
     
    10871116}
    10881117
     1118bool 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
     1124uint 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
    10891140QT_END_NAMESPACE
    10901141
  • trunk/src/gui/styles/qgtkstyle_p.h

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5757#if !defined(QT_NO_STYLE_GTK)
    5858
     59#include <QtCore/qstring.h>
     60#include <QtCore/qstringbuilder.h>
     61#include <QtCore/qcoreapplication.h>
     62
    5963#include <QtGui/QFileDialog>
    6064
     
    7276
    7377#define QLS(x) QLatin1String(x)
     78
     79QT_BEGIN_NAMESPACE
     80
     81// ### Qt 4.7 - merge with QLatin1Literal
     82class QHashableLatin1Literal
     83{
     84public:
     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
     117private:
     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
     126bool operator==(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2);
     127inline bool operator!=(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2) { return !operator==(l1, l2); }
     128uint qHash(const QHashableLatin1Literal &key);
     129
     130QT_END_NAMESPACE
    74131
    75132class GConf;
     
    253310        GnomeIconLookupResultFlags *result);
    254311
    255 
    256312class QGtkStylePrivate : public QCleanlooksStylePrivate
    257313{
     
    263319    QGtkStyleFilter filter;
    264320
    265     static GtkWidget* gtkWidget(const QString &path);
    266     static GtkStyle* gtkStyle(const QString &path = QLatin1String("GtkWindow"));
     321    static GtkWidget* gtkWidget(const QHashableLatin1Literal &path);
     322    static GtkStyle* gtkStyle(const QHashableLatin1Literal &path = QHashableLatin1Literal("GtkWindow"));
    267323
    268324    virtual void resolveGtk() const;
     
    419475    static Ptr_gnome_vfs_init gnome_vfs_init;
    420476
    421     virtual QPalette gtkWidgetPalette(const QString &gtkWidgetName) const;
     477    virtual QPalette gtkWidgetPalette(const QHashableLatin1Literal &gtkWidgetName) const;
    422478
    423479protected:
    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    }
    425488
    426489    static inline WidgetMap *gtkWidgetMap()
    427490    {
    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;
    432496    }
    433497
     
    439503    static void addAllSubWidgets(GtkWidget *widget, gpointer v = 0);
    440504    static void addWidget(GtkWidget *widget);
     505    static void removeWidgetFromMap(const QHashableLatin1Literal &path);
    441506
    442507    virtual void init();
     
    444509private:
    445510    static QList<QGtkStylePrivate *> instances;
     511    static WidgetMap *widgetMap;
    446512    friend class QGtkStyleUpdateScheduler;
    447513};
  • trunk/src/gui/styles/qmacstyle.qdoc

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    77** This file is part of the documentation of the Qt Toolkit.
    88**
    9 ** $QT_BEGIN_LICENSE:LGPL$
     9** $QT_BEGIN_LICENSE:FDL$
    1010** Commercial Usage
    1111** Licensees holding valid Qt Commercial licenses may use this file in
    1212** 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.
    3521**
    3622** If you have questions regarding the use of this file, please contact
  • trunk/src/gui/styles/qmacstyle_mac.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6161#endif
    6262
     63class QPushButton;
     64class QStyleOptionButton;
    6365class QMacStylePrivate;
    6466class Q_GUI_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle
     
    134136
    135137    QMacStylePrivate *d;
     138
     139    friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
    136140};
    137141
  • trunk/src/gui/styles/qmacstyle_mac.mm

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5757#include <private/qpainter_p.h>
    5858#include <private/qprintengine_mac_p.h>
    59 #include <private/qstylehelper_p.h>
    6059#include <qapplication.h>
    6160#include <qbitmap.h>
     
    9897#include <qlibrary.h>
    9998#include <qdatetimeedit.h>
     99#include <qmath.h>
    100100#include <QtGui/qgraphicsproxywidget.h>
    101101#include <QtGui/qgraphicsview.h>
    102102#include <private/qt_cocoa_helpers_mac_p.h>
     103#include "qmacstyle_mac_p.h"
     104#include <private/qstylehelper_p.h>
    103105
    104106QT_BEGIN_NAMESPACE
    105 
    106 extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
    107107
    108108// The following constants are used for adjusting the size
    109109// of push buttons so that they are drawn inside their bounds.
    110 static const int PushButtonLeftOffset = 6;
    111 static const int PushButtonTopOffset = 4;
    112 static const int PushButtonRightOffset = 12;
    113 static const int PushButtonBottomOffset = 12;
    114 static const int MiniButtonH = 26;
    115 static const int SmallButtonH = 30;
    116 static const int BevelButtonW = 50;
    117 static const int BevelButtonH = 22;
    118 static const int PushButtonContentPadding = 6;
     110const int QMacStylePrivate::PushButtonLeftOffset = 6;
     111const int QMacStylePrivate::PushButtonTopOffset = 4;
     112const int QMacStylePrivate::PushButtonRightOffset = 12;
     113const int QMacStylePrivate::PushButtonBottomOffset = 12;
     114const int QMacStylePrivate::MiniButtonH = 26;
     115const int QMacStylePrivate::SmallButtonH = 30;
     116const int QMacStylePrivate::BevelButtonW = 50;
     117const int QMacStylePrivate::BevelButtonH = 22;
     118const int QMacStylePrivate::PushButtonContentPadding = 6;
    119119
    120120// These colors specify the titlebar gradient colors on
     
    132132static const QColor mainWindowGradientEnd(200, 200, 200);
    133133
    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
     134static const int DisclosureOffset = 4;
    148135
    149136// Resolve these at run-time, since the functions was moved in Leopard.
    150137typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
    151138static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0;
     139
     140static int closeButtonSize = 12;
     141
     142extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
    152143
    153144static bool isVerticalTabs(const QTabBar::Shape shape) {
     
    157148                || shape == QTabBar::TriangularWest);
    158149}
    159 
    160 static int closeButtonSize = 12;
    161150
    162151void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected)
     
    238227        // fill body
    239228        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));
    241231        } else {
     232            int d = (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) ? 9 : 0;
    242233            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));
    246237            p->fillRect(rect, gradient);
    247238        }
     
    376367}
    377368
    378 /*
    379     AHIG:
    380         Apple Human Interface Guidelines
    381         http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/
    382 
    383     Builder:
    384         Apple Interface Builder v. 3.1.1
    385 */
    386 
    387 // this works as long as we have at most 16 different control types
    388 #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 optimized
    398 #define return_SIZE(large, small, mini) \
    399     do { \
    400         static const int sizes[] = { (large), (small), (mini) }; \
    401         return sizes[controlSize]; \
    402     } while (0)
    403 
    404369static int getControlSize(const QStyleOption *option, const QWidget *widget)
    405370{
     
    433398QString qt_mac_removeMnemonics(const QString &original)
    434399{
    435     // copied from qt_format_text (to be bug-for-bug compatible).
    436400    QString returnText(original.size(), 0);
    437401    int finalDest = 0;
     
    439403    int l = original.length();
    440404    while (l) {
    441         if (original.at(currPos) == QLatin1Char('&')) {
     405        if (original.at(currPos) == QLatin1Char('&')
     406            && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
    442407            ++currPos;
    443408            --l;
     
    479444}
    480445
    481 class QMacStylePrivate : public QObject
    482 {
    483     Q_OBJECT
    484 
    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 functions
    506     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 buttons
    539     int timerID;
    540     QList<QPointer<QWidget> > progressBars; //existing progress bars that need animation
    541 
    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 
    553446QT_BEGIN_INCLUDE_NAMESPACE
    554 #include "qmacstyle_mac.moc"
     447#include "moc_qmacstyle_mac.cpp"
     448#include "moc_qmacstyle_mac_p.cpp"
    555449QT_END_INCLUDE_NAMESPACE
    556450
     
    1053947    // carbon not calculating the content bounds fully correct
    1054948    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;
    1057951    } else if (bdi->kind == kThemePushButtonMini) {
    1058         outerBounds.origin.y += PushButtonTopOffset;
     952        outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset;
    1059953    }
    1060954
     
    1072966    QSize csz(0, 0);
    1073967    QSize iconSize = btn->icon.isNull() ? QSize(0, 0)
    1074                 : (btn->iconSize + QSize(PushButtonContentPadding, 0));
     968                : (btn->iconSize + QSize(QMacStylePrivate::PushButtonContentPadding, 0));
    1075969    QRect textRect = btn->text.isEmpty() ? QRect(0, 0, 1, 1)
    1076970                : btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text);
     
    11471041            // same time displays the button contents without clipping.
    11481042            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){
    11501044                if (widget && widget->testAttribute(Qt::WA_MacVariableSize)) {
    1151                     if (btn->rect.height() <= MiniButtonH){
     1045                    if (btn->rect.height() <= QMacStylePrivate::MiniButtonH){
    11521046                        if (contentFitsInPushButton(btn, bdi, kThemePushButtonMini))
    11531047                            bdi->kind = kThemePushButtonMini;
    1154                     } else if (btn->rect.height() <= SmallButtonH){
     1048                    } else if (btn->rect.height() <= QMacStylePrivate::SmallButtonH){
    11551049                        if (contentFitsInPushButton(btn, bdi, kThemePushButtonSmall))
    11561050                            bdi->kind = kThemePushButtonSmall;
     
    11641058        }
    11651059    }
     1060}
     1061
     1062bool 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;
    11661070}
    11671071
     
    15371441bool QMacStylePrivate::animatable(QMacStylePrivate::Animates as, const QWidget *w) const
    15381442{
     1443    if (!w)
     1444        return false;
     1445
    15391446    if (as == AquaPushButton) {
    15401447        QPushButton *pb = const_cast<QPushButton *>(static_cast<const QPushButton *>(w));
     
    19151822        painter->setClipRegion(rgn);
    19161823
    1917         CGContextRef cg = qt_mac_cg_context(target);
     1824        QCFType<CGContextRef> cg = qt_mac_cg_context(target);
    19181825        CGContextSaveGState(cg);
    19191826        HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted);
     
    21412048        if (qstyleoption_cast<const QStyleOptionComboBox *>(opt) != 0)
    21422049            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;
    21432053        else
    2144             ret = QWindowsStyle::pixelMetric(metric, opt, widget);
     2054            ret = 1;
    21452055        break;
    21462056    case PM_MaximumDragDistance:
     
    30953005            bi.value = opt->direction == Qt::LeftToRight ? kThemeDisclosureRight : kThemeDisclosureLeft;
    30963006        bi.adornment = kThemeAdornmentNone;
    3097         HIRect hirect = qt_hirectForQRect(opt->rect);
     3007        HIRect hirect = qt_hirectForQRect(opt->rect.adjusted(DisclosureOffset,0,-DisclosureOffset,0));
    30983008        HIThemeDrawButton(&hirect, &bi, cg, kHIThemeOrientationNormal, 0);
    30993009        break; }
     3010
    31003011    case PE_Frame: {
    31013012        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));
    31053014        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());
    31063017        p->setPen(oldPen);
    31073018        break; }
     3019
    31083020    case PE_FrameLineEdit:
    31093021        if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
     
    31473059    case PE_PanelLineEdit:
    31483060        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
    31493073        break;
    31503074    case PE_FrameTabWidget:
     
    31703094        } break;
    31713095    case PE_FrameStatusBarItem:
    3172         QCommonStyle::drawPrimitive(pe, opt, p, w);
    31733096        break;
    31743097    case PE_IndicatorTabClose: {
     
    32673190                switch (header->position) {
    32683191                case QStyleOptionHeader::Beginning:
     3192                    ir.adjust(-1, -1, 0, 0);
    32693193                    break;
    32703194                case QStyleOptionHeader::Middle:
     3195                    ir.adjust(-1, -1, 0, 0);
     3196                    break;
     3197                case QStyleOptionHeader::OnlyOneSection:
    32713198                case QStyleOptionHeader::End:
    3272                     ir.adjust(-1, 0, 0, 0);
     3199                    ir.adjust(-1, -1, 1, 0);
    32733200                    break;
    32743201                default:
     
    34103337                        QPalette pal = tb->palette;
    34113338                        QPalette::ColorRole role = QPalette::NoRole;
     3339                        if (!proxy()->styleHint(SH_UnderlineShortcut, tb, w))
     3340                            alignment |= Qt::TextHideMnemonic;
    34123341                        if (down)
    34133342                            cr.translate(shiftX, shiftY);
     
    34273356                            }
    34283357                        }
    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);
    34313360                        if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 &&
    34323361                            (tb->state & State_Sunken)) {
    34333362                            // 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);
    34363365                        }
    34373366                    }
     
    34723401            HIRect newRect = qt_hirectForQRect(btn->rect);
    34733402            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;
    34783407            } 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;
    34823411            }
    34833412            HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
     
    34863415                int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
    34873416                QRect ir = btn->rect;
    3488                 HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset,
     3417                HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset,
    34893418                                              ir.height() / 2 - 4, mbi, ir.height() / 2);
    34903419                bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active;
     
    35803509                            state = QIcon::On;
    35813510                        QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state);
    3582                         contentW += pixmap.width() + PushButtonContentPadding;
     3511                        contentW += pixmap.width() + QMacStylePrivate::PushButtonContentPadding;
    35833512                        int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2;
    35843513                        int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmap.height()) / 2;
     
    35873516                        proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap);
    35883517                        int newOffset = iconDestRect.x() + iconDestRect.width()
    3589                                         + PushButtonContentPadding - textRect.x();
     3518                                        + QMacStylePrivate::PushButtonContentPadding - textRect.x();
    35903519                        textRect.adjust(newOffset, 0, newOffset, 0);
    35913520                    }
     
    43304259
    43314260    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;
    43324270    case SE_ToolBoxTabContents:
    43334271        rect = QCommonStyle::subElementRect(sr, opt, widget);
     
    43474285        if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
    43484286            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 as
    4351                 // 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:
    43524290                rect.setY(0);
    43534291                rect.setHeight(widget->height());
     
    43764314        HIThemeGetButtonShape(&inRect, &bdi, &shape);
    43774315        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));
    43804319        break;
    43814320    }
     
    54195358                    QCFString groupText = qt_mac_removeMnemonics(groupBox->text);
    54205359                    HIThemeGetTextDimensions(groupText, 0, &tti, &width, &height, 0);
    5421                     tw = int(width);
    5422                     h = int(height);
     5360                    tw = qRound(width);
     5361                    h = qCeil(height);
    54235362                } 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());
    54295366                }
    54305367                ret.setHeight(h);
     
    54735410                    yOffset = 5;
    54745411                    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);
    54795416                if (sc == SC_GroupBoxContents)
    54805417                    ret.adjust(3, 3, -3, -4);    // guess
     
    56755612        // Do this by add enough space around the contents so that rounded
    56765613        // 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;
    56795616        break;
    56805617    case QStyle::CT_MenuItem:
     
    57685705        }
    57695706        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
    57705714    default:
    57715715        sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget);
  • trunk/src/gui/styles/qmacstylepixmaps_mac_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4040****************************************************************************/
    4141
     42#ifndef QMACSTYLEPIXMAPS_MAC_P_H
     43#define QMACSTYLEPIXMAPS_MAC_P_H
     44
    4245//
    4346//  W A R N I N G
     
    6669    "ab###bb###baaa",
    6770    ".###..###.aaaa"};
     71
     72#endif //  QMACSTYLEPIXMAPS_MAC_P_H
  • trunk/src/gui/styles/qmotifstyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qmotifstyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qmotifstyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qplastiquestyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5151
    5252#include "qwindowsstyle_p.h"
    53 #include <private/qstylehelper_p.h>
    5453#include <qapplication.h>
    5554#include <qbitmap.h>
     
    5756#include <qcheckbox.h>
    5857#include <qcombobox.h>
    59 #include <qdatetime.h>
    6058#include <qdebug.h>
    6159#include <qdialogbuttonbox.h>
     
    8280#include <qstyleoption.h>
    8381#include <qtextedit.h>
     82#include <qelapsedtimer.h>
    8483#include <qtoolbar.h>
    8584#include <qtoolbox.h>
     
    8988#include <qvarlengtharray.h>
    9089#include <limits.h>
     90#include <private/qstylehelper_p.h>
    9191
    9292QT_BEGIN_NAMESPACE
     
    489489        QPixmap texture = brush->texture();
    490490        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());
    492494        if (!QPixmapCache::find(name, pixmap)) {
    493495            QImage image = texture.toImage();
     
    550552        QPixmap texture = brush.texture();
    551553        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
    553558        if (!QPixmapCache::find(name, pixmap)) {
    554559            QImage image = texture.toImage();
     
    609614        QPixmap texture = brush.texture();
    610615        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
    612620        if (!QPixmapCache::find(name, pixmap)) {
    613621            QImage image = texture.toImage();
     
    733741                                       const QColor &gradientStop)
    734742{
    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
    737749    QPixmap cache;
    738750    QPainter *p = painter;
     
    981993    QList<QProgressBar *> bars;
    982994    int progressBarAnimateTimer;
    983     QTime timer;
     995    QElapsedTimer timer;
    984996#endif
    985997};
     
    10931105
    10941106    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);
    11031107    QColor alphaCornerColor;
    11041108    if (widget) {
     
    11081112        alphaCornerColor = mergedColors(option->palette.background().color(), borderColor);
    11091113    }
    1110     QColor alphaInnerColor = mergedColors(highlightedLightInnerBorderColor, gradientStartColor);
    1111     QColor alphaInnerColorNoHover = mergedColors(borderColor, gradientStartColor);
    11121114    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;
    11171115
    11181116    switch (element) {
     
    20582056
    20592057            int lowerTop = selected ? 0 : 3; // to make the selected tab bigger than the rest
    2060             QRect adjustedRect;
    20612058            bool atEnd = (tab->position == QStyleOptionTab::End) || onlyTab;
    20622059            bool atBeginning = ((tab->position == QStyleOptionTab::Beginning) || onlyTab)
     
    58475844{
    58485845    QWindowsStyle::polish(pal);
    5849     pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110));
    58505846#ifdef Q_WS_MAC
    58515847    pal.setBrush(QPalette::Shadow, Qt::black);
  • trunk/src/gui/styles/qplastiquestyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qproxystyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4141
    4242#include <qstyle.h>
    43 #include <private/qstyle_p.h>
    4443#include <private/qproxystyle_p.h>
    4544#include <private/qapplication_p.h>
    4645#include "qproxystyle.h"
    4746#include "qstylefactory.h"
     47#include <private/qstyle_p.h>
    4848
    4949#if !defined(QT_NO_STYLE_PROXY) || defined(QT_PLUGIN)
  • trunk/src/gui/styles/qproxystyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qproxystyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qs60style.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    9797{360,640,1,19,"NHD Landscape"},
    9898{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"}
    100101// *** End of generated data ***
    101102};
     
    105106const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
    106107// *** 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}
    112114// *** End of generated data ***
    113115};
     
    136138    {SE_ToolTip,                QS60StyleEnums::SP_QsnFrPopupPreviewCenter},
    137139    {SE_ToolBar,                QS60StyleEnums::SP_QsnFrPopupSubCenter},
    138     {SE_ToolBarButton,          QS60StyleEnums::SP_QsnFrSctrlButtonCenter},
    139     {SE_ToolBarButtonPressed,   QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed},
     140    {SE_ToolBarButton,          QS60StyleEnums::SP_QgnFrSctrlButtonCenter},
     141    {SE_ToolBarButtonPressed,   QS60StyleEnums::SP_QgnFrSctrlButtonCenterPressed},
    140142    {SE_PanelBackground,        QS60StyleEnums::SP_QsnFrSetOptCenter},
    141143    {SE_ButtonInactive,         QS60StyleEnums::SP_QsnFrButtonCenterInactive},
    142144    {SE_Editor,                 QS60StyleEnums::SP_QsnFrInputCenter},
    143145    {SE_TableItemPressed,       QS60StyleEnums::SP_QsnFrGridCenterPressed},
    144     {SE_ListItemPressed,        QS60StyleEnums::SP_QsnFrListPressed},
     146    {SE_ListItemPressed,        QS60StyleEnums::SP_QsnFrListCenterPressed},
    145147};
    146148
     
    155157    clearCaches(); //deletes also background image
    156158    deleteThemePalette();
     159#ifdef Q_WS_S60
     160    removeAnimations();
     161#endif
    157162}
    158163
     
    403408        break;
    404409    case CC_ThemeChange:
    405         m_colorCache.clear();
    406410        QPixmapCache::clear();
     411#ifdef Q_WS_S60
     412        deleteStoredSettings();
     413#endif
    407414        deleteBackground();
    408415        break;
    409416    case CC_UndefinedChange:
    410417    default:
    411         m_colorCache.clear();
    412418        m_mappedFontsCache.clear();
    413419        QPixmapCache::clear();
     
    417423}
    418424
    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++;
     425QColor 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);
    464461                }
    465             } else {
    466462                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;
    477472}
    478473
     
    487482{
    488483    return m_themePalette;
     484}
     485
     486bool 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
     495bool 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;
    489502}
    490503
     
    711724    // set as transparent so that styled full screen theme background is visible
    712725    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
    714731    const QColor buttonColor = colorFromFrameGraphics(SF_ButtonNormal);
     732#endif
    715733    palette->setColor(QPalette::Button, buttonColor);
    716     const QColor toolTipColor = colorFromFrameGraphics(SF_ToolTip);
    717     palette->setColor(QPalette::ToolTipBase, toolTipColor);
    718734    palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter());
    719735    palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker());
     
    817833    QApplication::setPalette(widgetPalette, "QLineEdit");
    818834    QApplication::setPalette(widgetPalette, "QTextEdit");
    819     widgetPalette = *palette;
    820 
    821     widgetPalette.setColor(QPalette::HighlightedText,
    822         s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
    823835    QApplication::setPalette(widgetPalette, "QComboBox");
     836    QApplication::setPalette(widgetPalette, "QSpinBox");
    824837    widgetPalette = *palette;
    825838
     
    10611074            QStyleOptionFrame  buttonOption;
    10621075            buttonOption.QStyleOption::operator=(*cmb);
    1063             const int maxHeight = 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;
    10651078            const int topLeftPoint = direction ?
    1066                 (cmbxEditField.right() + 1) : (cmbxEditField.left() + 1 - maxWidth);
    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);
    10681081            buttonOption.rect = buttonRect;
    10691082            buttonOption.state = cmb->state;
     
    10981111            State mflags = bflags;
    10991112            if (toolBtn->state & State_Sunken) {
    1100                 if (toolBtn->activeSubControls & SC_ToolButton)
    1101                     bflags |= State_Sunken;
     1113                bflags |= State_Sunken;
    11021114                mflags |= State_Sunken;
    11031115            }
     
    11151127                    tool.rect = button.unite(menuRect);
    11161128                    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);
    11221129                    drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
    11231130                }
     
    14351442            const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
    14361443
    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.
    14381450            if (vopt->backgroundBrush == Qt::NoBrush) {
    14391451                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                    }
    14401460                    drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);
     1461                    if (singleSelection && isSelected && !hasFocus && selectItems)
     1462                        painter->restore();
    14411463                }
    14421464            } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);}
     
    14471469             voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state);
    14481470
    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))) {
    14581473                 const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget);
    14591474
     
    14621477                     checkMarkOption.rect = selectionRect;
    14631478                 // Draw selection mark.
    1464                  if (isSelected && !singleSelection && selectItemsOnly) {
     1479                 if (isSelected && selectItems) {
    14651480                     proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget);
    14661481                     // @todo: this should happen in the rect retrievel i.e. subElementRect()
    14671482                     if (textRect.right() > selectionRect.left())
    14681483                         textRect.setRight(selectionRect.left());
    1469                  } else if (singleSelection &&
    1470                      voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) {
     1484                 } else if (voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) {
    14711485                     checkMarkOption.state = checkMarkOption.state & ~State_HasFocus;
    14721486
     
    14881502             // draw the text
    14891503            if (!voptAdj.text.isEmpty()) {
    1490                 if (isSelected || hasFocus )
     1504                if (hasFocus)
    14911505                    painter->setPen(voptAdj.palette.highlightedText().color());
    14921506                else
     
    17511765            const bool enabled = optionMenuItem.state & State_Enabled;
    17521766            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
    17531773
    17541774            uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip
     
    17571777                text_flags |= Qt::TextHideMnemonic;
    17581778
    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 
    17631779            QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget);
    17641780            QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget);
    17651781
    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
    17671790            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)
    17901815                drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget);
    1791             }
     1816
    17921817            //draw icon and/or checkState
    17931818            QPixmap pix = menuItem->icon.pixmap(pixelMetric(PM_SmallIconSize),
     
    18001825                else
    18011826                    textRect.translate(-vSpacing, 0);
    1802                 textRect.setWidth(textRect.width()-vSpacing);
     1827                textRect.setWidth(textRect.width() - vSpacing);
    18031828            }
    18041829
     
    18181843                painter->save();
    18191844                painter->setPen(option->palette.windowText().color());
    1820                 QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSubMenu, painter, arrowOptions.rect,
     1845                QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSubmenu, painter, arrowOptions.rect,
    18211846                    (flags | QS60StylePrivate::SF_ColorSkinned | arrowDirection));
    18221847                painter->restore();
     
    18381863                    optionMenuItem.palette, enabled,
    18391864                    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            }
    18401883            if (!enabled)
    18411884                painter->restore();
     
    19521995        if (const QTextEdit *textEdit = qobject_cast<const QTextEdit *>(widget)) {
    19531996            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))
    19551998                QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags);
    19561999            else
     
    20192062        break;
    20202063    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()) {
    20222065            painter->save();
    20232066            painter->setOpacity(0.5);
     
    20462089            //Draw themed highlight to radiobuttons and checkboxes.
    20472090            //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)) {
    20492092                if ((qstyleoption_cast<const QStyleOptionFocusRect *>(option) &&
    20502093                    (qobject_cast<const QRadioButton *>(widget) || qobject_cast<const QCheckBox *>(widget))))
     
    20782121            painter->save();
    20792122
    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());
    20852125
    20862126            QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags | QS60StylePrivate::SF_ColorSkinned );
     
    21462186    case PE_FrameButtonBevel:
    21472187        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;
    21512194            QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
    21522195        } else {
     
    22322275            //Need extra check since dialogs have their own theme background
    22332276            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.
    22362280                QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, option->rect, flags);
    22372281            else
     
    22782322            const bool isPressed = QS60StylePrivate::isWidgetPressed(widget);
    22792323
    2280             if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) {
     2324            if (QS60StylePrivate::equalToThemePalette(option->palette.highlight().color(), QPalette::Highlight)) {
    22812325                QRect highlightRect = vopt->rect.adjusted(1,1,-1,-1);
    22822326                const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
     
    22842328                    itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems;
    22852329                // Set the draw area for highlights (focus, select rect or pressed rect)
    2286                 if (hasFocus || isSelected || isPressed) {
     2330                if (hasFocus || isPressed) {
    22872331                    if (selectionBehavior != QAbstractItemView::SelectItems) {
    22882332                        // set highlight rect so that it is continuous from cell to cell, yet sligthly
     
    23102354
    23112355                QS60StylePrivate::SkinElements element;
     2356                bool themeGraphicDefined = false;
    23122357                QRect elementRect = option->rect;
    23132358
    23142359                //draw item is drawn as pressed, if it already has focus.
    2315                 if (isPressed && (hasFocus || isSelected)) {
     2360                if (isPressed && hasFocus) {
     2361                    themeGraphicDefined = true;
    23162362                    element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed;
    23172363                } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) {
    23182364                    element = QS60StylePrivate::SE_ListHighlight;
    23192365                    elementRect = highlightRect;
     2366                    themeGraphicDefined = true;
    23202367                }
    2321                 QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags);
     2368                if (themeGraphicDefined)
     2369                    QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags);
    23222370            } else {
    23232371                QCommonStyle::drawPrimitive(element, option, painter, widget);
     
    23992447#ifndef QT_NO_ITEMVIEWS
    24002448        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)) {
    24022450                //QPalette::Base has been changed, let commonstyle draw the item
    24032451                commonStyleDraws = true;
     
    24702518    }
    24712519
    2472     if (widget && (metric == PM_LayoutTopMargin))
     2520    if (widget && (metric == PM_LayoutTopMargin || metric == PM_LayoutLeftMargin || metric == PM_LayoutRightMargin))
    24732521        if (widget->windowType() == Qt::Dialog)
    2474             //double the top layout margin for dialogs, it is very close to real value
     2522            //double the layout margins (except bottom) for dialogs, it is very close to real value
    24752523            //without having to define custom pixel metric
    24762524            metricValue *= 2;
    2477 
    2478     if (widget && (metric == PM_FocusFrameHMargin))
    2479         if (qobject_cast<const QTableView *>(widget))
    2480             //Halve the focus frame margin for table items
    2481             metricValue /= 2;
    24822525
    24832526    return metricValue;
     
    24972540                if (toolBtn->subControls & SC_ToolButtonMenu)
    24982541                    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            }
    24992592            break;
    25002593        case CT_PushButton:
     
    25492642            }
    25502643            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));
    25512646            if (QS60StylePrivate::isTouchSupported())
    25522647                //Make itemview easier to use in touch devices
    25532648                //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
    25552650            break;
    25562651#ifndef QT_NO_COMBOBOX
     
    25692664            break;
    25702665    }
     2666    if (!sz.isValid())
     2667        sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
    25712668    return sz;
    25722669}
     
    27902887            const int width = cmb->rect.width();
    27912888            const int height = cmb->rect.height();
    2792             const int buttonIconSize = QS60StylePrivate::pixelMetric(PM_ButtonIconSize);
    27932889            const int buttonMargin = cmb->frame ? 2 : 0;
    27942890            // lets use spinbox frame here as well, as no combobox specific value available.
    27952891            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;
    27982893            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());
    28012897            buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
    28022898            switch (scontrol) {
    28032899                case SC_ComboBoxArrow: {
    2804                     const int xposMod = cmb->rect.x() + width - buttonMargin - buttonWidth;
     2900                    const int xposMod = cmb->rect.x() + width - buttonMargin - buttonSize.width();
    28052901                    const int ypos = cmb->rect.y();
    2806                     ret.setRect(xposMod, ypos + buttonMargin, buttonWidth, height - 2 * buttonMargin);
     2902                    ret.setRect(xposMod, ypos + buttonMargin, buttonSize.width(), height - 2 * buttonMargin);
    28072903                    }
    28082904                    break;
    28092905                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);
    28162907                    }
    28172908                break;
    28182909                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();
    28292911                    }
    28302912                break;
     
    29573039        case SE_ItemViewItemDecoration:
    29583040            if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
    2959                 const QListWidget *listItem = qobject_cast<const QListWidget *>(widget);
     3041                const QAbstractItemView *listItem = qobject_cast<const QAbstractItemView *>(widget);
    29603042                const bool multiSelection = !listItem ? false :
    29613043                    listItem->selectionMode() == QAbstractItemView::MultiSelection ||
     
    29813063                ret = menuItem->rect;
    29823064
     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
    29833076                if (element == SE_ItemViewItemDecoration) {
    29843077                    if (menuItem->icon.isNull()) {
     
    29863079                    } else {
    29873080                        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);
    29893084                        ret.setWidth(indicatorWidth);
    29903085                    }
    29913086                } else {
    2992                     ret = menuItem->rect;
    2993                     if (!menuItem->icon.isNull())
     3087                    if (!menuItem->icon.isNull()) {
    29943088                        if (menuItem->direction == Qt::LeftToRight)
    29953089                            ret.adjust(indicatorWidth, 0, 0, 0);
    29963090                        else
    29973091                            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);
    29983097
    29993098                    // Make room for submenu indicator
     
    30103109        case SE_ItemViewItemCheckIndicator:
    30113110            if (const QStyleOptionViewItemV2 *vopt = qstyleoption_cast<const QStyleOptionViewItemV2 *>(opt)) {
    3012                 const QListWidget *listItem = qobject_cast<const QListWidget *>(widget);
     3111                const QAbstractItemView *listItem = qobject_cast<const QAbstractItemView *>(widget);
    30133112
    30143113                const bool singleSelection = listItem &&
     
    30733172            ret = opt->rect;
    30743173            break;
     3174        case SE_ProgressBarLabel:
     3175        case SE_ProgressBarContents:
     3176        case SE_ProgressBarGroove:
     3177            ret = opt->rect;
     3178            break;
    30753179        default:
    30763180            ret = QCommonStyle::subElementRect(element, opt, widget);
     
    33223426            break;
    33233427        case SP_ToolBarHorizontalExtensionButton:
    3324             part = QS60StyleEnums::SP_QgnIndiSubMenu;
     3428            part = QS60StyleEnums::SP_QgnIndiSubmenu;
    33253429            if (QApplication::layoutDirection() == Qt::RightToLeft)
    33263430                adjustedFlags |= QS60StylePrivate::SF_PointSouth;
     
    33283432        case SP_ToolBarVerticalExtensionButton:
    33293433            adjustedFlags |= QS60StylePrivate::SF_PointEast;
    3330             part = QS60StyleEnums::SP_QgnIndiSubMenu;
     3434            part = QS60StyleEnums::SP_QgnIndiSubmenu;
    33313435            break;
    33323436
     
    33613465                    d->m_pressedWidget = w;
    33623466
    3363                 if ( d->m_pressedWidget)
     3467                if (d->m_pressedWidget)
    33643468                    d->m_pressedWidget->update();
    33653469            }
     
    33673471        }
    33683472        case QEvent::MouseButtonRelease: {
    3369             const QWidget *w = QApplication::widgetAt(QCursor::pos());
    3370             if (w && d->m_pressedWidget) {
     3473            if (d->m_pressedWidget) {
    33713474                d->m_pressedWidget->update();
    33723475                d->m_pressedWidget = 0;
  • trunk/src/gui/styles/qs60style.h

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5151QT_MODULE(Gui)
    5252
    53 #if !defined(QT_NO_STYLE_S60)
    54 
    5553//Public custom pixel metrics values.
    5654//These can be used to fetch custom pixel metric value from outside QS60Style.
     
    9290    bool event(QEvent *e);
    9391
    94 #ifndef Q_WS_S60
     92#ifndef Q_OS_SYMBIAN
    9593    static QStringList partKeys();
    9694    static QStringList colorListKeys();
     
    9997    bool loadS60ThemeFromBlob(const QString &blobFile);
    10098    bool saveS60ThemeToBlob(const QString &blobFile) const;
    101 #endif // !Q_WS_S60
     99#endif // !Q_OS_SYMBIAN
    102100
    103101protected Q_SLOTS:
     
    114112};
    115113
    116 #endif // QT_NO_STYLE_S60
    117 
    118114QT_END_NAMESPACE
    119115
  • trunk/src/gui/styles/qs60style_p.h

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    155155        SP_QgnGrafNsliderMarker,
    156156        SP_QgnGrafNsliderMarkerSelected,
    157         SP_QgnIndiSubMenu,
     157        SP_QgnIndiSubmenu,
    158158        SP_QgnNoteErased,
    159159        SP_QgnNoteError,
     
    167167        SP_QgnPropFolderSmallNew,
    168168        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,
    169187        SP_QsnCpScrollHandleBottomPressed, //ScrollBar handle, pressed state
    170188        SP_QsnCpScrollHandleMiddlePressed,
     
    199217        SP_QsnFrCaleCornerBl,
    200218        SP_QsnFrCaleCornerBr,
    201         SP_QsnFrCaleGSideT,
    202         SP_QsnFrCaleGSideB,
    203         SP_QsnFrCaleGSideL,
    204         SP_QsnFrCaleGSideR,
     219        SP_QsnFrCaleSideT,
     220        SP_QsnFrCaleSideB,
     221        SP_QsnFrCaleSideL,
     222        SP_QsnFrCaleSideR,
    205223        SP_QsnFrCaleCenter,
    206224        SP_QsnFrCaleHeadingCornerTl,        // calendar grid header
     
    267285        SP_QsnFrPopupSubSideR,
    268286        SP_QsnFrPopupSubCenter,
    269         SP_QsnFrSctrlButtonCornerTl,        // Toolbar button
    270         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, pressed
    279         SP_QsnFrSctrlButtonCornerTrPressed,
    280         SP_QsnFrSctrlButtonCornerBlPressed,
    281         SP_QsnFrSctrlButtonCornerBrPressed,
    282         SP_QsnFrSctrlButtonSideTPressed,
    283         SP_QsnFrSctrlButtonSideBPressed,
    284         SP_QsnFrSctrlButtonSideLPressed,
    285         SP_QsnFrSctrlButtonSideRPressed,
    286         SP_QsnFrSctrlButtonCenterPressed,
    287287        SP_QsnFrButtonCornerTlInactive,     // Inactive button
    288288        SP_QsnFrButtonCornerTrInactive,
     
    311311        SP_QsnFrListSideLPressed,
    312312        SP_QsnFrListSideRPressed,
    313         SP_QsnFrListPressed,
     313        SP_QsnFrListCenterPressed,
    314314    };
    315315
     
    523523    static bool isWidgetPressed(const QWidget *widget);
    524524
    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).
    526528    QColor colorFromFrameGraphics(SkinFrameElements frame) const;
     529#endif
     530    QColor calculatedColor(SkinFrameElements frame) const;
    527531
    528532    //set theme palette for application
     
    542546
    543547    mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache;
    544     mutable QHash<SkinFrameElements, QColor> m_colorCache;
    545548
    546549    // Has one entry per SkinFrameElements
     
    572575    void stopAnimation(QS60StyleEnums::SkinParts animation);
    573576    static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part);
     577    static void removeAnimations();
    574578
    575579#endif
     
    598602    static void storeThemePalette(QPalette *palette);
    599603    static void deleteThemePalette();
     604    static bool equalToThemePalette(QColor color, QPalette::ColorRole role);
     605    static bool equalToThemePalette(qint64 cacheKey, QPalette::ColorRole role);
    600606
    601607    static QSize partSize(QS60StyleEnums::SkinParts part,
  • trunk/src/gui/styles/qs60style_s60.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4949#include "private/qcore_symbian_p.h"
    5050#include "qapplication.h"
     51#include "qsettings.h"
    5152
    5253#include <w32std.h>
     
    6667#include <AknBitmapAnimation.h>
    6768
     69#include <centralrepository.h>
     70
    6871#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
    6972
     
    7780    ENoDraw
    7881};
     82
     83const TUid personalisationUID = { 0x101F876F };
    7984
    8085enum TSupportRelease {
     
    180185    /* SP_QgnGrafBarProgress */            {KAknsIIDQgnGrafBarProgress,            EDrawIcon,   ES60_All,    -1,-1},
    181186    // 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
    183188    /* SP_QgnGrafScrollArrowDown */        {KAknsIIDQgnGrafScrollArrowDown,     EDrawGulIcon,   ES60_All,    -1,-1},
    184189    /* SP_QgnGrafScrollArrowLeft */        {KAknsIIDQgnGrafScrollArrowLeft,     EDrawGulIcon,   ES60_All,    -1,-1},
     
    215220    /* SP_QgnGrafNsliderMarker */          {KAknsIIDQgnIndiSliderEdit,             EDrawIcon,   ES60_3_1,    EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */},
    216221    /* SP_QgnGrafNsliderMarkerSelected */  {KAknsIIDQgnIndiSliderEdit,             EDrawIcon,   ES60_3_1,    EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */},
    217     /* SP_QgnIndiSubMenu */                {KAknsIIDQgnIndiSubmenu,                EDrawIcon,   ES60_All,    -1,-1},
     222    /* SP_QgnIndiSubmenu */                {KAknsIIDQgnIndiSubmenu,                EDrawIcon,   ES60_All,    -1,-1},
    218223    /* SP_QgnNoteErased */                 {KAknsIIDQgnNoteErased,                 EDrawIcon,   ES60_All,    -1,-1},
    219224    /* SP_QgnNoteError */                  {KAknsIIDQgnNoteError,                  EDrawIcon,   ES60_All,    -1,-1},
     
    228233    /* SP_QgnPropPhoneMemcLarge */         {KAknsIIDQgnPropPhoneMemcLarge,         EDrawIcon,   ES60_All,    -1,-1},
    229234
     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
    230257    // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
    231258    /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom,    EDrawIcon,   ES60_3_X,    EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
     
    267294    /* SP_QsnFrCaleCornerBl */          {KAknsIIDQsnFrCaleCornerBl,             ENoDraw,     ES60_All,    -1,-1},
    268295    /* SP_QsnFrCaleCornerBr */          {KAknsIIDQsnFrCaleCornerBr,             ENoDraw,     ES60_All,    -1,-1},
    269     /* SP_QsnFrCaleGSideT */            {KAknsIIDQsnFrCaleSideT,                ENoDraw,     ES60_All,    -1,-1},
    270     /* SP_QsnFrCaleGSideB */            {KAknsIIDQsnFrCaleSideB,                ENoDraw,     ES60_All,    -1,-1},
    271     /* SP_QsnFrCaleGSideL */            {KAknsIIDQsnFrCaleSideL,                ENoDraw,     ES60_All,    -1,-1},
    272     /* SP_QsnFrCaleGSideR */            {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},
    273300    /* SP_QsnFrCaleCenter */            {KAknsIIDQsnFrCaleCenter,               ENoDraw,     ES60_All,    -1,-1},
    274301
     
    345372    /* SP_QsnFrPopupSubCenter */        {KAknsIIDQsnFrPopupCenterSubmenu,       ENoDraw,     ES60_3_X,    -1,-1},
    346373
    347     // Toolbar graphics is different in 3.1/3.2 vs. 5.0
    348     /* 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 
    369374    // No inactive button graphics in 3.1/3.2
    370375    /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl,        ENoDraw,     ES60_3_X,    EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
     
    398403    /* SP_QsnFrListSideLPressed */       {KAknsIIDQsnFrListSideL,       ENoDraw,     ES60_3_X,    EAknsMajorSkin, 0x2691},
    399404    /* SP_QsnFrListSideRPressed */       {KAknsIIDQsnFrListSideR,       ENoDraw,     ES60_3_X,    EAknsMajorSkin, 0x2692},
    400     /* SP_QsnFrListPressed */            {KAknsIIDQsnFrList,            ENoDraw,     ES60_3_X,    EAknsMajorSkin, 0x2693},
     405    /* SP_QsnFrListCenterPressed */      {KAknsIIDQsnFrListCenter,      ENoDraw,     ES60_3_X,    EAknsMajorSkin, 0x2693},
    401406};
    402407
     
    515520            fallbackIndex = 17574; /* EMbmAvkonQgn_graf_nslider_marker_selected */
    516521            break;
    517         case QS60StyleEnums::SP_QgnIndiSubMenu:
     522        case QS60StyleEnums::SP_QgnIndiSubmenu:
    518523            fallbackIndex = EMbmAvkonQgn_indi_submenu;
    519524            break;
     
    684689{
    685690    return (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0);
     691}
     692
     693void 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).
     705QColor 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;
    686760}
    687761
     
    10241098            break;
    10251099        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            }
    10281108            break;
    10291109        case QS60StylePrivate::SF_PopupBackground:
     
    11451225    // No need to set active layout, if dynamic metrics API is available
    11461226    setActiveLayout();
     1227}
     1228
     1229void QS60StylePrivate::removeAnimations()
     1230{
     1231    //currently only one animation in the list.
     1232    m_animations()->removeFirst();
    11471233}
    11481234
     
    12931379{
    12941380    bool createNewBackground = false;
     1381    TRect applicationRect = (static_cast<CEikAppUi*>(S60->appUi())->ApplicationRect());
    12951382    if (!m_background) {
    12961383        createNewBackground = true;
    12971384    } else {
    12981385        //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()) {
    13011388            delete m_background;
    13021389            createNewBackground = true;
     
    13061393    if (createNewBackground) {
    13071394        QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen,
    1308             QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), 0, SkinElementFlags());
     1395                QSize(applicationRect.Width(), applicationRect.Height()), 0, SkinElementFlags());
    13091396        m_background = new QPixmap(background);
    13101397    }
     
    13261413{
    13271414    clearCaches(QS60StylePrivate::CC_LayoutChange);
    1328     setBackgroundTexture(qApp);
    13291415    setActiveLayout();
    13301416    refreshUI();
  • trunk/src/gui/styles/qs60style_simulated.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    9595    }
    9696
    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
    103103    }
    104104
  • trunk/src/gui/styles/qstyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    326326
    327327    \sa QStyleOption, QStylePainter, {Styles Example},
    328         {Implementing Styles and Style Aware Widgets}, QStyledItemDelegate
     328        {Styles and Style Aware Widgets}, QStyledItemDelegate
    329329*/
    330330
     
    368368    actions in this function might be to call the
    369369    QWidget::setBackgroundMode() function for the widget. Do not use
    370     the function to set, for example, the geometry; reimplementing
    371     this function do provide a back-door through which the appearance
    372     of a widget can be changed, but with Qt 4.0's style engine there
    373     is rarely necessary to implement this function; reimplement the
     370    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
    374374    drawItemPixmap(), drawItemText(), drawPrimitive(), etc. instead.
    375375
     
    24222422QT_END_INCLUDE_NAMESPACE
    24232423
     2424#if !defined(QT_NO_DEBUG_STREAM)
    24242425QDebug operator<<(QDebug debug, QStyle::State state)
    24252426{
    2426 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
     2427#if !defined(QT_NO_DEBUG)
    24272428    debug << "QStyle::State(";
    24282429
     
    24562457    debug << states.join(QLatin1String(" | "));
    24572458    debug << ')';
     2459#else
     2460    Q_UNUSED(state);
    24582461#endif
    24592462    return debug;
    24602463}
     2464#endif
    24612465
    24622466/*!
  • trunk/src/gui/styles/qstyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    879879Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
    880880
     881#if !defined(QT_NO_DEBUG_STREAM)
    881882Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
     883#endif
    882884
    883885QT_END_NAMESPACE
  • trunk/src/gui/styles/qstyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4444
    4545#include "private/qobject_p.h"
    46 #include "private/qstylehelper_p.h"
    4746#include <QtGui/qstyle.h>
    4847
  • trunk/src/gui/styles/qstylefactory.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    8282#endif
    8383
    84 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
     84#ifndef QT_NO_LIBRARY
    8585Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
    8686    (QStyleFactoryInterface_iid, QLatin1String("/styles"), Qt::CaseInsensitive))
  • trunk/src/gui/styles/qstylefactory.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qstylehelper.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4040****************************************************************************/
    4141
    42 #include "qstylehelper_p.h"
    43 
    4442#include <qstyleoption.h>
    4543#include <qpainter.h>
     
    5553#endif
    5654
     55#include "qstylehelper_p.h"
     56#include <qstringbuilder.h>
     57
    5758QT_BEGIN_NAMESPACE
    5859
     
    6263{
    6364    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
    6772#ifndef QT_NO_SPINBOX
    6873    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'); ;
    7577    }
    7678#endif // QT_NO_SPINBOX
  • trunk/src/gui/styles/qstylehelper_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4242#include <QtCore/qglobal.h>
    4343#include <QtCore/qpoint.h>
     44#include <QtCore/qstring.h>
    4445#include <QtGui/qpolygon.h>
     46#include <QtCore/qstringbuilder.h>
    4547
    4648#ifndef QSTYLEHELPER_P_H
     
    8082}
    8183
     84// internal helper. Converts an integer value to an unique string token
     85template <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
     106template <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
    82115QT_END_NAMESPACE
    83116
  • trunk/src/gui/styles/qstyleoption.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    54205420*/
    54215421
     5422#if !defined(QT_NO_DEBUG_STREAM)
    54225423QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
    54235424{
    5424 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
     5425#if !defined(QT_NO_DEBUG)
    54255426    switch (optionType) {
    54265427    case QStyleOption::SO_Default:
     
    54835484        debug << "SO_GraphicsItem"; break;
    54845485    }
     5486#else
     5487    Q_UNUSED(optionType);
    54855488#endif
    54865489    return debug;
     
    54895492QDebug operator<<(QDebug debug, const QStyleOption &option)
    54905493{
    5491 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
     5494#if !defined(QT_NO_DEBUG)
    54925495    debug << "QStyleOption(";
    54935496    debug << QStyleOption::OptionType(option.type);
     
    54965499    debug << ',' << option.rect;
    54975500    debug << ')';
     5501#else
     5502    Q_UNUSED(option);
    54985503#endif
    54995504    return debug;
    55005505}
     5506#endif
    55015507
    55025508QT_END_NAMESPACE
  • trunk/src/gui/styles/qstyleoption.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    959959}
    960960
     961#if !defined(QT_NO_DEBUG_STREAM)
    961962Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType);
    962963Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option);
     964#endif
    963965
    964966QT_END_NAMESPACE
  • trunk/src/gui/styles/qstyleplugin.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qstyleplugin.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qstylesheetstyle.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    10661066        }
    10671067    }
    1068     if (!hasNativeBorder() && (flags & Border)) {
     1068    if (hasBorder() && (flags & Border)) {
    10691069        const int *b = border()->borders;
    10701070        r.adjust(-b[LeftEdge], -b[TopEdge], b[RightEdge], b[BottomEdge]);
     
    13531353            p->setBrush(br, bg->brush);
    13541354        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        }
    13551361    }
    13561362
     
    25382544        QPalette::ColorGroup group;
    25392545    } map[3] = {
    2540         { PseudoClass_Active | PseudoClass_Enabled, QPalette::Active },
     2546        { int(PseudoClass_Active | PseudoClass_Enabled), QPalette::Active },
    25412547        { PseudoClass_Disabled, QPalette::Disabled },
    25422548        { PseudoClass_Enabled, QPalette::Inactive }
     
    31713177                    QRect r(gr.topLeft(),
    31723178                            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));
    31753181                    subRule1.drawRule(p, r);
    31763182                }
     
    31853191                }
    31863192
    3187                 handleSubRule.drawRule(p, grooveSubRule.boxRect(hr, Margin));
     3193                handleSubRule.drawRule(p, handleSubRule.boxRect(hr, Margin));
    31883194            }
    31893195
     
    34593465    case CE_RadioButton:
    34603466    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;
    34653478    case CE_RadioButtonLabel:
    34663479    case CE_CheckBoxLabel:
     
    40824095        QRenderRule subRule = renderRule(w, opt, pe1);
    40834096        if (subRule.bg != 0 || subRule.hasDrawable()) {
    4084             //We test subRule.bg dirrectly because hasBackground() would return false for background:none.
     4097            //We test subRule.bg directly because hasBackground() would return false for background:none.
    40854098            //But we still don't want the default drawning in that case (example for QScrollBar::add-page) (task 198926)
    40864099            subRule.drawRule(p, opt->rect);
     
    42704283        }
    42714284    break;
     4285
     4286    case PE_FrameMenu:
     4287        if (rule.hasDrawable()) {
     4288            // Drawn by PE_PanelMenu
     4289            return;
     4290        }
     4291        break;
    42724292
    42734293    case PE_PanelMenuBar:
  • trunk/src/gui/styles/qstylesheetstyle_default.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qstylesheetstyle_p.h

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowscestyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowscestyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowscestyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowsmobilestyle.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    8080extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp
    8181#endif // Q_WS_WINCE
     82
     83#include "qstylehelper_p.h"
    8284
    8385QT_BEGIN_NAMESPACE
  • trunk/src/gui/styles/qwindowsmobilestyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowsmobilestyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowsstyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4242#include "qwindowsstyle.h"
    4343#include "qwindowsstyle_p.h"
    44 #include <private/qstylehelper_p.h>
    4544
    4645#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
    4746
    48 #include "qlibrary.h"
     47#include <private/qsystemlibrary_p.h>
    4948#include "qapplication.h"
    5049#include "qbitmap.h"
     
    7170#include <qmath.h>
    7271
    73 
    7472#ifdef Q_WS_X11
    7573#include "qfileinfo.h"
     
    7775#include <private/qt_x11_p.h>
    7876#endif
     77
     78#include <private/qstylehelper_p.h>
    7979
    8080QT_BEGIN_NAMESPACE
     
    127127    if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
    128128        && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
    129         QLibrary shellLib(QLatin1String("shell32"));
     129        QSystemLibrary shellLib(QLatin1String("shell32"));
    130130        pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo");
    131131    }
    132132#endif
     133    startTime.start();
    133134}
    134135
     
    506507#ifndef Q_OS_WINCE
    507508            NONCLIENTMETRICS ncm;
    508             ncm.cbSize = sizeof(NONCLIENTMETRICS);
     509            ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
    509510            if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0))
    510511                ret = qMax(ncm.iScrollHeight, ncm.iScrollWidth);
     
    930931{
    931932#ifdef Q_OS_WINCE
    932     HMODULE hmod = LoadLibrary(L"ceshell.dll");
     933    HMODULE hmod = LoadLibrary(L"ceshell");
    933934#else
    934     HMODULE hmod = LoadLibrary(L"shell32.dll");
     935    HMODULE hmod = QSystemLibrary::load(L"shell32");
    935936#endif
    936937    if( hmod ) {
     
    13971398            int size = qMin(r.height(), r.width());
    13981399            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);
    14011403            if (!QPixmapCache::find(pixmapName, pixmap)) {
    14021404                int border = size/5;
    14031405                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);
    14061408                QPainter imagePainter(&image);
    14071409
     
    19201922            }
    19211923
    1922             int xm = QWindowsStylePrivate::windowsItemFrame + checkcol + QWindowsStylePrivate::windowsItemHMargin;
     1924            int xm = int(QWindowsStylePrivate::windowsItemFrame) + checkcol + int(QWindowsStylePrivate::windowsItemHMargin);
    19231925            int xpos = menuitem->rect.x() + xm;
    19241926            QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin,
     
    24042406    case CE_ProgressBarContents:
    24052407        if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
    2406 
    24072408            QRect rect = pb->rect;
     2409            if (!rect.isValid())
     2410                return;
     2411
    24082412            bool vertical = false;
    24092413            bool inverted = false;
     
    31143118                                &copy.palette.brush(QPalette::Button));
    31153119                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                {
    31173123                    QStyleOptionSpinBox lightCopy = copy;
    31183124                    lightCopy.rect.adjust(1, 1, 1, 1);
     
    31473153                                &copy.palette.brush(QPalette::Button));
    31483154                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                {
    31503158                    QStyleOptionSpinBox lightCopy = copy;
    31513159                    lightCopy.rect.adjust(1, 1, 1, 1);
     
    32283236            int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column
    32293237            w += checkcol;
    3230             w += QWindowsStylePrivate::windowsRightBorder + 10;
     3238            w += int(QWindowsStylePrivate::windowsRightBorder) + 10;
    32313239            sz.setWidth(w);
    32323240        }
  • trunk/src/gui/styles/qwindowsstyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowsstyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5959#ifndef QT_NO_STYLE_WINDOWS
    6060#include <qlist.h>
    61 #include <qdatetime.h>
    6261#include <qhash.h>
     62#include <qelapsedtimer.h>
    6363
    6464QT_BEGIN_NAMESPACE
     
    8181    int animationFps;
    8282    int animateTimer;
    83     QTime startTime;
     83    QElapsedTimer startTime;
    8484    int animateStep;   
    8585    QColor inactiveCaptionText;
  • trunk/src/gui/styles/qwindowsvistastyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4343#include "qwindowsvistastyle_p.h"
    4444#include <private/qstylehelper_p.h>
     45#include <private/qsystemlibrary_p.h>
    4546
    4647#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
     
    19271928
    19281929    QSize sz(size);
    1929 
    1930     QSize newSize = QWindowsXPStyle::sizeFromContents(type, option, size, widget);
    19311930    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 button
    1950             }
    1951         }
    1952         return sz;
    19531931    case CT_MenuItem:
    19541932        sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget);
     
    19911969        break;
    19921970    }
    1993     return newSize;
     1971    return QWindowsXPStyle::sizeFromContents(type, option, size, widget);
    19941972}
    19951973
     
    25982576    if (!tried) {
    25992577        tried = true;
    2600         QLibrary themeLib(QLatin1String("uxtheme"));
     2578        QSystemLibrary themeLib(QLatin1String("uxtheme"));
    26012579        pSetWindowTheme         = (PtrSetWindowTheme        )themeLib.resolve("SetWindowTheme");
    26022580        pIsThemePartDefined     = (PtrIsThemePartDefined    )themeLib.resolve("IsThemePartDefined");
  • trunk/src/gui/styles/qwindowsvistastyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowsvistastyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    8787#include <qtableview.h>
    8888#include <qbasictimer.h>
     89#include <qdatetime.h>
    8990#include <qcommandlinkbutton.h>
    9091
  • trunk/src/gui/styles/qwindowsxpstyle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4949#include <private/qstylehelper_p.h>
    5050#include <private/qwidget_p.h>
    51 #include <qlibrary.h>
     51#include <private/qsystemlibrary_p.h>
    5252#include <qpainter.h>
    5353#include <qpaintengine.h>
     
    303303        limboWidget->createWinId();
    304304        limboWidget->setObjectName(QLatin1String("xp_limbo_widget"));
    305         // We dont need this internal widget to appear in QApplication::topLevelWidgets()
     305        // We don't need this internal widget to appear in QApplication::topLevelWidgets()
    306306        if (QWidgetPrivate::allWidgets)
    307307            QWidgetPrivate::allWidgets->remove(limboWidget);
     
    345345    if (!tried) {
    346346        tried = true;
    347         QLibrary themeLib(QLatin1String("uxtheme"));
     347        QSystemLibrary themeLib(QLatin1String("uxtheme"));
    348348        pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
    349349        if (pIsAppThemed) {
     
    21552155                p->setBrush(Qt::NoBrush);
    21562156                if (checked)
    2157                     p->drawRect(vIconRect.adjusted(-1, -2, 1, 1));
     2157                    p->drawRect(vIconRect.adjusted(-1, -1, 0, 0));
    21582158                p->drawPixmap(vIconRect.topLeft(), pixmap);
    21592159
     
    36793679                                borderSize.cyBottomHeight + borderSize.cyTopHeight - 2);
    36803680                }
    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
    36823684            }
    36833685        }
  • trunk/src/gui/styles/qwindowsxpstyle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/qwindowsxpstyle_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/gui/styles/styles.pri

    r769 r846  
    4747        HEADERS += \
    4848                styles/qmacstyle_mac.h \
    49                 styles/qmacstylepixmaps_mac_p.h
     49                styles/qmacstylepixmaps_mac_p.h \
     50                styles/qmacstyle_mac_p.h
    5051        OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm
    5152
     
    171172    symbian {
    172173        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        }
    174180    } else {
    175181        SOURCES += styles/qs60style_simulated.cpp
     
    177183    }
    178184} else {
     185    symbian {
     186        HEADERS += styles/qs60style.h
     187        SOURCES += styles/qs60style_stub.cpp
     188    }
    179189    DEFINES += QT_NO_STYLE_S60
    180190}
Note: See TracChangeset for help on using the changeset viewer.