qhbstyle/qhbstyle.cpp
changeset 11 06b8e2af4411
parent 4 90517678cc4f
child 14 6fbed849b4f4
equal deleted inserted replaced
8:71781823f776 11:06b8e2af4411
    26 #include <qdebug.h>
    26 #include <qdebug.h>
    27 
    27 
    28 //Qt widgets
    28 //Qt widgets
    29 #include <QtGui/qgroupbox.h>
    29 #include <QtGui/qgroupbox.h>
    30 #include <QtGui/qheaderview.h>
    30 #include <QtGui/qheaderview.h>
    31 #include <QtGui/qlistwidget.h>
       
    32 #include <QtGui/qlistview.h>
    31 #include <QtGui/qlistview.h>
    33 #include <QtGui/qpushbutton.h>
    32 #include <QtGui/qpushbutton.h>
    34 #include <QtGui/qscrollbar.h>
    33 #include <QtGui/qscrollbar.h>
    35 #include <QtGui/qtabbar.h>
    34 #include <QtGui/qtabbar.h>
    36 #include <QtGui/qtableview.h>
    35 #include <QtGui/qtableview.h>
    37 #include <QtGui/qtablewidget.h>
       
    38 #include <QtGui/qtreeview.h>
    36 #include <QtGui/qtreeview.h>
    39 #include <QtGui/qtreewidget.h>
       
    40 #include <QtGui/qtextedit.h>
    37 #include <QtGui/qtextedit.h>
    41 #include <QtGui/qtoolbar.h>
    38 #include <QtGui/qtoolbar.h>
    42 #include <QtGui/qtoolbutton.h>
    39 #include <QtGui/qtoolbutton.h>
    43 #include <QtGui/qradiobutton.h>
    40 #include <QtGui/qradiobutton.h>
    44 #include <QtGui/qcheckbox.h>
    41 #include <QtGui/qcheckbox.h>
    64 #include "qhbstyle_p.h"
    61 #include "qhbstyle_p.h"
    65 #include "qhbstyleanimation.h"
    62 #include "qhbstyleanimation.h"
    66 
    63 
    67 QT_BEGIN_NAMESPACE
    64 QT_BEGIN_NAMESPACE
    68 
    65 
    69 QHbStylePrivate::QHbStylePrivate()
    66 QHbStylePrivate::QHbStylePrivate() : m_styleManager(0),
       
    67     m_frameDrawer(new HbFrameDrawer),
       
    68     m_animationGroup(new QParallelAnimationGroup)
    70 {
    69 {
    71     m_frameDrawer = 0;
       
    72     m_styleManager = 0;
       
    73 
       
    74     m_animationGroup = q_check_ptr(new QParallelAnimationGroup());
       
    75 }
    70 }
    76 
    71 
    77 QHbStylePrivate::~QHbStylePrivate()
    72 QHbStylePrivate::~QHbStylePrivate()
    78 {
    73 {
    79     delete m_frameDrawer;
       
    80     delete m_animationGroup;
       
    81 }
    74 }
    82 
    75 
    83 HbStyle* QHbStylePrivate::styleManager()
    76 HbStyle* QHbStylePrivate::styleManager()
    84 {
    77 {
    85     return m_styleManager;
    78     return m_styleManager;
    91     m_styleManager = style;
    84     m_styleManager = style;
    92 }
    85 }
    93 
    86 
    94 QParallelAnimationGroup* QHbStylePrivate::animationGroup()
    87 QParallelAnimationGroup* QHbStylePrivate::animationGroup()
    95 {
    88 {
    96     return m_animationGroup;
    89     return m_animationGroup.data();
    97 }
    90 }
    98 
    91 
    99 /*!
    92 /*!
   100   \internal
    93   \internal
   101  */
    94  */
   156             ItemStates state = SS_Active;
   149             ItemStates state = SS_Active;
   157             if (vopt->state & State_HasFocus)
   150             if (vopt->state & State_HasFocus)
   158                 state |= SS_Focused;
   151                 state |= SS_Focused;
   159             if (vopt->state & State_Sunken || vopt->state & State_Raised)
   152             if (vopt->state & State_Sunken || vopt->state & State_Raised)
   160                 state |= SS_Pressed;
   153                 state |= SS_Pressed;
   161 #ifndef QT_NO_TREEVIEW
   154 
   162                 if (qobject_cast<const QTreeWidget*>(widget)) {
   155 #ifndef QT_NO_TABLEVIEW
   163                     if (option->state & State_Children) {
   156                 if (qobject_cast<const QTableView *>(widget)) {
   164                         m_private->drawMultiPartItem(SM_ListParent, painter, vopt->rect, state);
   157                     m_private->drawMultiPartItem(SM_TableItem, painter, vopt->rect, state);
   165                         break;
   158                     break;
   166                     }
       
   167                 }
   159                 }
   168 #endif
   160 #endif
   169             if (vopt->features & QStyleOptionViewItemV2::Alternate)
   161             if (vopt->features & QStyleOptionViewItemV2::Alternate)
   170                 state |= SS_Alternate; //@todo: how?
   162                 state |= SS_Alternate; //@todo: how?
   171             m_private->drawMultiPartItem(SM_ItemViewItem, painter, vopt->rect, state);
   163             m_private->drawMultiPartItem(SM_ItemViewItem, painter, vopt->rect, state);
   217             break;
   209             break;
   218         }
   210         }
   219 #ifndef QT_NO_LINEEDIT
   211 #ifndef QT_NO_LINEEDIT
   220         case PE_PanelLineEdit: {
   212         case PE_PanelLineEdit: {
   221 #ifndef QT_NO_COMBOBOX
   213 #ifndef QT_NO_COMBOBOX
   222             if (widget && qobject_cast<const QComboBox *>(widget->parentWidget()))
   214             if ( (widget && qobject_cast<const QComboBox *>(widget->parentWidget()) ) && (!widget->hasFocus()))
   223                 break;
   215                 break;
   224 #endif
   216 #endif
   225 #ifndef QT_NO_SPINBOX
   217 #ifndef QT_NO_SPINBOX
   226             if (widget && qobject_cast<const QSpinBox *>(widget->parentWidget()))
   218             if (widget && qobject_cast<const QSpinBox *>(widget->parentWidget()))
   227                 break;
   219                 break;
   278         }
   270         }
   279         case PE_FrameFocusRect: {
   271         case PE_FrameFocusRect: {
   280             if (const QStyleOptionFocusRect *highlight = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
   272             if (const QStyleOptionFocusRect *highlight = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
   281                 if (false
   273                 if (false
   282 #ifndef QT_NO_LISTVIEW
   274 #ifndef QT_NO_LISTVIEW
   283                         || qobject_cast<const QListWidget *>(widget)
   275                         || qobject_cast<const QListView *>(widget)
   284 #endif
   276 #endif
   285 #ifndef QT_NO_TABLEVIEW
   277 #ifndef QT_NO_TABLEVIEW
   286                         || qobject_cast<const QTableWidget *>(widget)
   278                         || qobject_cast<const QTableView *>(widget)
   287 #endif
   279 #endif
   288 #ifndef QT_NO_TREEVIEW
   280 #ifndef QT_NO_TREEVIEW
   289                         || qobject_cast<const QTreeWidget *>(widget)
   281                         || qobject_cast<const QTreeView *>(widget)
   290 #endif
   282 #endif
   291                     )
   283                     )
   292                     m_private->drawMultiPartItem(SM_ItemViewHighlight, painter, highlight->rect);
   284                     if (option->state & State_HasFocus)
       
   285                         m_private->drawMultiPartItem(SM_ItemViewItem, painter, highlight->rect, SS_Focused);
   293             }
   286             }
   294             break;
   287             break;
   295         }
   288         }
   296         case PE_FrameMenu: {
   289         case PE_FrameMenu: {
   297             break;
   290             break;
   371                 }
   364                 }
   372             }
   365             }
   373             break;
   366             break;
   374         }
   367         }
   375         case CE_ItemViewItem: {
   368         case CE_ItemViewItem: {
       
   369         //@todo: headerviews and listviews should show selection tick at the beginning of the row (in place of checkbox rect)
       
   370         //@todo: headerview should select also parent when child is selected
       
   371         //@todo: headerview should draw highlight rect
   376             if (const QStyleOptionViewItemV4 *itemOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
   372             if (const QStyleOptionViewItemV4 *itemOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
   377                 const QRect checkRect = subElementRect(SE_ItemViewItemCheckIndicator, itemOption, widget);
   373                 const QRect checkRect = subElementRect(SE_ItemViewItemCheckIndicator, itemOption, widget);
   378                 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, itemOption, widget);
   374                 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, itemOption, widget);
   379                 QRect textRect = subElementRect(SE_ItemViewItemText, itemOption, widget);
   375                 QRect textRect = subElementRect(SE_ItemViewItemText, itemOption, widget);
   380 
   376 
   381                 //background for list items (other itemviews use PE_PanelItemViewRow drawing)
   377                 //background for list items (other itemviews use PE_PanelItemViewRow drawing)
   382                 if (qobject_cast<const QListWidget *>(widget))
   378                 if (qobject_cast<const QListView *>(widget))
   383                     proxy()->drawPrimitive(PE_PanelItemViewItem, itemOption, painter, widget);
   379                     proxy()->drawPrimitive(PE_PanelItemViewItem, itemOption, painter, widget);
   384 
   380 
   385                 //checkbox
   381                 //checkbox
   386                 if (itemOption->features & QStyleOptionViewItemV2::HasCheckIndicator && checkRect.isValid()) {
   382                 if (itemOption->features & QStyleOptionViewItemV2::HasCheckIndicator && checkRect.isValid()) {
   387                     QStyleOptionViewItemV4 checkOption;
   383                     QStyleOptionViewItemV4 checkOption;
   391                 }
   387                 }
   392 
   388 
   393                 //selection indication
   389                 //selection indication
   394                 if (itemOption->state & State_Selected) {
   390                 if (itemOption->state & State_Selected) {
   395                     const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
   391                     const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
   396                     if (itemView->selectionMode() != QAbstractItemView::SingleSelection) {
   392                     if (itemView->selectionMode() != QAbstractItemView::NoSelection) {
   397                         QStyleOptionViewItemV4 selectOption;
   393                         QStyleOptionViewItemV4 selectOption;
   398                         selectOption.QStyleOption::operator=(*itemOption);
   394                         selectOption.QStyleOption::operator=(*itemOption);
   399                         int iconSize = 0;
   395                         int iconSize = 0;
   400                         if (m_private->hbParameter(QLatin1String("hb-param-graphic-size-secondary"), iconSize)) {
   396                         if (m_private->hbParameter(QLatin1String("hb-param-graphic-size-secondary"), iconSize)) {
   401                             QRect selectRect = QRect(0, 0, iconSize, iconSize);
   397                             QRect selectRect = QRect(0, 0, iconSize, iconSize);
   879     switch (control) {
   875     switch (control) {
   880 #ifndef QT_NO_COMBOBOX
   876 #ifndef QT_NO_COMBOBOX
   881         case CC_ComboBox: {
   877         case CC_ComboBox: {
   882             if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
   878             if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
   883                 const QRect cmbxFrame = cmb->rect;
   879                 const QRect cmbxFrame = cmb->rect;
   884                 ItemStates state = SS_Active;
   880 
       
   881                 const bool isDisabled = !(cmb->state & State_Enabled);
       
   882                 ItemStates state = (isDisabled) ? SS_Disabled : SS_Active;
       
   883 
       
   884                 if (cmb->state & State_Active &&
       
   885                     cmb->state & State_Enabled &&
       
   886                     !cmb->state & State_HasFocus &&
       
   887                     !cmb->state & State_MouseOver &&
       
   888                     !cmb->state & State_Selected) {
       
   889                     state |= SS_Active;
       
   890                 }
       
   891                 if (cmb->state & State_Active &&
       
   892                     cmb->state & State_Enabled &&
       
   893                     cmb->state & State_On &&
       
   894                     !cmb->state & State_HasFocus &&
       
   895                     !cmb->state & State_MouseOver &&
       
   896                     !cmb->state & State_Selected) {
       
   897                     state |= SS_Active;
       
   898                 }
       
   899                 else if (cmb->state & State_Active &&
       
   900                          cmb->state & State_Enabled &&
       
   901                          cmb->state & State_HasFocus &&
       
   902                          cmb->state & State_MouseOver &&
       
   903                          cmb->state & State_Selected) {
       
   904                     state |= SS_Pressed;
       
   905                 }
       
   906                 else if (cmb->state & State_Active &&
       
   907                          cmb->state & State_Enabled &&
       
   908                          cmb->state & State_HasFocus &&
       
   909                          cmb->state & State_MouseOver) {
       
   910                     state |= SS_Pressed;
       
   911                 }
       
   912                /* else if (cmb->state & State_Active &&
       
   913                          cmb->state & State_Enabled &&
       
   914                          cmb->state & State_Sunken) {
       
   915                     state |= SS_Pressed;
       
   916                 }*/
   885 
   917 
   886                 // Button frame
   918                 // Button frame
   887                 QStyleOptionFrame  buttonOption;
   919                 QStyleOptionFrame  buttonOption;
   888                 buttonOption.QStyleOption::operator=(*cmb);
   920                 buttonOption.QStyleOption::operator=(*cmb);
   889                 const int buttonMaxHeight = cmbxFrame.height();
   921                 const int buttonMaxHeight = cmbxFrame.height();
   890                 const int buttonMaxWidth = buttonMaxHeight; //button is rect
   922                 const int buttonMaxWidth = buttonMaxHeight; //button is rect
   891                 const int topLeftPoint = (cmb->direction == Qt::LeftToRight) ? (cmbxFrame.width() - buttonMaxWidth) : 0;
   923                 const int topLeftPoint = (cmb->direction == Qt::LeftToRight) ? (cmbxFrame.width() - buttonMaxWidth) : 0;
   892 
   924 
   893                 const QRect buttonRect(topLeftPoint, cmbxFrame.top(), buttonMaxHeight, buttonMaxWidth);
   925                 const QRect buttonRect(topLeftPoint, cmbxFrame.top(), buttonMaxHeight, buttonMaxWidth);
   894                 buttonOption.rect = buttonRect;
   926                 if (cmb->direction == Qt::RightToLeft){
   895                 buttonOption.state = cmb->state;
   927 
   896                 ItemStates buttonState = (buttonOption.state & State_Sunken) ? ItemStates(SS_Pressed  | SS_Active) : ItemStates(SS_Active);
   928                     state |= SS_Mirrored;
   897                 if (cmb->direction == Qt::RightToLeft)
   929                 }
   898                     buttonState |= SS_Mirrored;
       
   899                 if (buttonOption.state & State_HasFocus) {
       
   900                     buttonState |= SS_Selected;
       
   901                     state |= SS_Selected; //set frame status to follow button status for highlight
       
   902                 }
       
   903 
       
   904                 m_private->drawItem(SP_BoxButton, painter, buttonRect.adjusted(0, 1, 0, -1), buttonState); //@todo: remove magic
       
   905 
   930 
   906                 if (cmb->subControls & SC_ComboBoxFrame) {
   931                 if (cmb->subControls & SC_ComboBoxFrame) {
   907                     const bool isDisabled = !(cmb->state & State_Enabled);
   932 
   908                     const bool isPressed = (cmb->state & State_Sunken);
       
   909                     const bool isEditable = cmb->editable;
       
   910 
       
   911                     if (isDisabled)
       
   912                         state = SS_Disabled;
       
   913                     else if (isPressed)
       
   914                         state |= SS_Pressed;
       
   915                     if (isEditable)
       
   916                         state |= SS_Edited;
       
   917                     QRect frameRect = QRect(cmb->rect);
   933                     QRect frameRect = QRect(cmb->rect);
   918                     int frameWidth = pixelMetric(PM_DefaultFrameWidth);
   934                     int frameWidth = pixelMetric(PM_DefaultFrameWidth);
   919                     int maxRight = cmb->rect.height() - 2 * frameWidth;
   935                     int maxRight = cmb->rect.height() - 2 * frameWidth;
   920                     frameRect.adjust(0, 0, -maxRight, 0);
   936                     frameRect.adjust(0, 0, -maxRight, 0);
   921                     int adjustX = 0;
   937 
   922                     if (option->direction == Qt::RightToLeft) {
       
   923                         adjustX = buttonOption.rect.topRight().x();
       
   924                         state |= SS_Mirrored;
       
   925                     }
       
   926                     const QRect frame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget);
   938                     const QRect frame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget);
   927                     // @todo: if SC_ComboBoxFrame needs adjusting, move that code to subControlRect
   939                     //Draw the frame
   928                     m_private->drawMultiPartItem(SM_BoxFrame, painter, frame.adjusted(adjustX, 1, -4 + adjustX, -1), state);
   940                     m_private->drawMultiPartItem(SM_BoxFrame, painter, frame, state);
   929                 }
   941                 }
       
   942                 //Draw the dropdown button
       
   943                 m_private->drawItem(SP_BoxButton, painter, buttonRect, state); //@todo: remove magic
   930             }
   944             }
   931             break;
   945             break;
   932         }
   946         }
   933 #endif //QT_NO_COMBOBOX
   947 #endif //QT_NO_COMBOBOX
   934 #ifndef QT_NO_SLIDER
   948 #ifndef QT_NO_SLIDER
  1006                         if (nextInterval < v)
  1020                         if (nextInterval < v)
  1007                             break;
  1021                             break;
  1008                         v = nextInterval;
  1022                         v = nextInterval;
  1009                     }
  1023                     }
  1010                 }
  1024                 }
  1011                  QRect filledRect;
  1025 
  1012                  if ( horizontal ){
  1026                 QRect filledRect;
  1013                     const int sliderPosition = sliderHandle.center().x();
  1027                 QRect filledRectMask;
  1014                     const int sliderWidth = sliderHandle.width()/2;
  1028                 if ( horizontal ){
  1015                     if (slider && (slider->layoutDirection() == Qt::LeftToRight) ^ slider->invertedAppearance()){
  1029                     if (slider && (slider->layoutDirection() == Qt::LeftToRight) ^ slider->invertedAppearance()){
  1016                         filledRect = QRect(sliderGroove.x(), sliderGroove.y(), sliderPosition+sliderWidth, sliderGroove.height());
  1030                         filledRect = QRect( sliderGroove.x(),
  1017                      } else {
  1031                                             sliderGroove.y(),
  1018                         filledRect = QRect(sliderGroove.x()+sliderPosition-sliderWidth, sliderGroove.y(), sliderGroove.width()-sliderPosition+sliderWidth, sliderGroove.height());
  1032                                             qMax(sliderGroove.width()-sliderHandle.right(), sliderHandle.right()),
  1019                      }
  1033                                             sliderGroove.height());
  1020                  } else {
  1034 
  1021                     const int sliderPosition = sliderHandle.center().y();
  1035                         int x = qMin(sliderHandle.left(), sliderGroove.x() + sliderGroove.width()-sliderHandle.right());
  1022                     const int sliderHeight = sliderHandle.height()/2;
  1036                         filledRectMask = QRect(x,
  1023                      if (slider && (slider->layoutDirection() == Qt::LeftToRight) ^ slider->invertedAppearance()){
  1037                                                sliderGroove.y(),
  1024                         filledRect = QRect(sliderGroove.x(), sliderGroove.y()+sliderPosition-sliderHeight, sliderGroove.width(), sliderGroove.height()-sliderPosition+sliderHeight);
  1038                                                sliderGroove.width()-x,
  1025                      } else {
  1039                                                sliderGroove.height());
  1026                         filledRect = QRect(sliderGroove.x(), sliderGroove.y(), sliderGroove.width(), sliderPosition+sliderHeight);
  1040                     } else {
  1027                      }
  1041                         filledRect = QRect( qMin(sliderGroove.width()-sliderHandle.left(),sliderHandle.left()),
  1028                   }
  1042                                             sliderGroove.y(),
  1029 
  1043                                             qMax(sliderGroove.width()-sliderHandle.left(), sliderHandle.left()),
  1030                 //Groove
  1044                                             sliderGroove.height());
  1031                 m_private->drawMultiPartItem(SM_SliderGroove, painter, sliderGroove, grooveState);
  1045 
  1032 
  1046                         filledRectMask = QRect( sliderGroove.x(),
  1033                 //Progress
  1047                                                 sliderGroove.y(),
  1034                 m_private->drawMultiPartItem(SM_SliderProgress, painter, filledRect, grooveState | SS_Filled);
  1048                                                 qMax(sliderGroove.width()-sliderHandle.right(), sliderHandle.right()),
  1035 
  1049                                                 sliderGroove.height());
  1036                  //handle
  1050 
       
  1051                     }
       
  1052                 } else {
       
  1053                     if (slider && (slider->layoutDirection() == Qt::LeftToRight) ^ slider->invertedAppearance()){
       
  1054                         filledRect = QRect(sliderGroove.x(),
       
  1055                                            qMin(sliderGroove.height()-sliderHandle.top(), sliderHandle.top()),
       
  1056                                            sliderGroove.width(),
       
  1057                                            qMax(sliderGroove.height()-sliderHandle.top(), sliderHandle.top()));
       
  1058 
       
  1059                         filledRectMask = QRect(sliderGroove.x(),
       
  1060                                                sliderGroove.y(),
       
  1061                                                sliderGroove.width(),
       
  1062                                                qMax(sliderGroove.height()-sliderHandle.bottom(), sliderHandle.bottom()));
       
  1063                     } else {
       
  1064                         filledRect = QRect(sliderGroove.x(),
       
  1065                                            sliderGroove.y(),
       
  1066                                            sliderGroove.width(),
       
  1067                                            qMax(sliderGroove.height()-sliderHandle.bottom(),sliderHandle.bottom()));
       
  1068 
       
  1069                         int y = qMin(sliderHandle.top(), sliderGroove.y() + sliderGroove.height()-sliderHandle.bottom());
       
  1070                         filledRectMask = QRect( sliderGroove.x(),
       
  1071                                                 y,
       
  1072                                                 sliderGroove.width(),
       
  1073                                                 sliderGroove.height()-y );
       
  1074                     }
       
  1075                 }
       
  1076 
       
  1077                 if (filledRect.width() <  filledRectMask.width() || filledRect.height() <  filledRectMask.height()){
       
  1078                     // Progress + groove
       
  1079                     m_private->drawMultiPartItem(SM_SliderGroove, painter, filledRect, grooveState );
       
  1080                     m_private->drawMultiPartItem(SM_SliderProgress, painter, filledRect, grooveState | SS_Filled);
       
  1081 
       
  1082                     // Groove
       
  1083                     m_private->drawMultiPartItem(SM_SliderGroove, painter, filledRectMask, grooveState);
       
  1084                 } else {
       
  1085                     // Groove
       
  1086                     m_private->drawMultiPartItem(SM_SliderGroove, painter, filledRectMask, grooveState);
       
  1087 
       
  1088                     // Progess + groove
       
  1089                     m_private->drawMultiPartItem(SM_SliderGroove, painter, filledRect, grooveState );
       
  1090                     m_private->drawMultiPartItem(SM_SliderProgress, painter, filledRect, grooveState | SS_Filled);
       
  1091                 }
       
  1092 
       
  1093                 //handle
  1037                 m_private->drawItem(SP_SliderHandle, painter, sliderHandle, handleState);
  1094                 m_private->drawItem(SP_SliderHandle, painter, sliderHandle, handleState);
  1038             }
  1095             }
  1039             break;
  1096             break;
  1040         }
  1097         }
  1041 #endif //QT_NO_SLIDER
  1098 #endif //QT_NO_SLIDER
  1192                 const QRect spinboxFrame = subControlRect(control, optionSpinbox, SC_SpinBoxFrame, widget);
  1249                 const QRect spinboxFrame = subControlRect(control, optionSpinbox, SC_SpinBoxFrame, widget);
  1193                 const QRect spinboxButtonUpRect = subControlRect(control, optionSpinbox, SC_SpinBoxUp, widget);
  1250                 const QRect spinboxButtonUpRect = subControlRect(control, optionSpinbox, SC_SpinBoxUp, widget);
  1194                 const QRect spinboxButtonDownRect = subControlRect(control, optionSpinbox, SC_SpinBoxDown, widget);
  1251                 const QRect spinboxButtonDownRect = subControlRect(control, optionSpinbox, SC_SpinBoxDown, widget);
  1195                 const QRect spinboxEditorRect = subControlRect(control, optionSpinbox, SC_SpinBoxEditField, widget);
  1252                 const QRect spinboxEditorRect = subControlRect(control, optionSpinbox, SC_SpinBoxEditField, widget);
  1196 
  1253 
  1197                 QStyleOptionSpinBox copy = *optionSpinbox;
       
  1198 
       
  1199                 //Frame & background
  1254                 //Frame & background
  1200                 const bool isDisabled = !(optionSpinbox->state & State_Enabled);
  1255                 const bool isDisabled = !(optionSpinbox->state & State_Enabled);
  1201                 ItemStates state = (isDisabled) ? SS_Disabled : SS_Active;
  1256                 ItemStates state = (isDisabled) ? SS_Disabled : SS_Active;
  1202                 if (optionSpinbox->state & State_HasFocus)
  1257                 if (optionSpinbox->state & State_HasFocus)
  1203                     state |= SS_Selected;
  1258                     state |= SS_Selected;
  1204                 m_private->drawMultiPartItem(SM_BoxFrame, painter, spinboxEditorRect, state);
  1259                 //Draw the rounded border of edit field frame under button, half spin button width
  1205 
  1260                 //Label drawn to spinboxEditorRect
       
  1261                 m_private->drawMultiPartItem(SM_BoxFrame, painter, spinboxEditorRect.adjusted((-0.5*spinboxButtonDownRect.width()),0,0,0), state);
       
  1262 
       
  1263 
       
  1264                 QStyle::State buttonState;
  1206                 //Buttons
  1265                 //Buttons
  1207                 if (optionSpinbox->subControls & SC_SpinBoxUp) {
  1266                 if (optionSpinbox->subControls & SC_SpinBoxUp) {
  1208                     copy.subControls = SC_SpinBoxUp;
       
  1209                     if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepUpEnabled))
  1267                     if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepUpEnabled))
  1210                         copy.state &= ~State_Enabled;
  1268                         buttonState &= ~State_Enabled;
  1211                     if (optionSpinbox->activeSubControls == SC_SpinBoxUp && (optionSpinbox->state & State_Sunken)) {
  1269                     if (optionSpinbox->activeSubControls == SC_SpinBoxUp && (optionSpinbox->state & State_Sunken)) {
  1212                         copy.state |= State_On;
  1270                         buttonState |= State_On;
  1213                         copy.state |= State_Sunken;
  1271                         buttonState |= State_Sunken;
  1214                     } else {
  1272                     } else {
  1215                         copy.state |= State_Raised;
  1273                         buttonState |= State_Raised;
  1216                         copy.state &= ~State_Sunken;
  1274                         buttonState &= ~State_Sunken;
  1217                     }
  1275                     }
  1218                     const bool isPressed = (copy.state & State_Sunken);
  1276                     const bool isPressed = (buttonState & State_Sunken);
  1219                     ItemStates upButtonState = (isPressed) ? ItemStates(SS_Pressed  | SS_Active) : ItemStates(SS_Active);
  1277                     ItemStates upButtonState = (isPressed) ? ItemStates(SS_Pressed  | SS_Active) : ItemStates(SS_Active);
  1220                     if (optionSpinbox->direction == Qt::RightToLeft)
  1278                     if (optionSpinbox->direction == Qt::RightToLeft)
  1221                         upButtonState = upButtonState | SS_Flipped;
  1279                         upButtonState = upButtonState | SS_Flipped;
  1222                     else
  1280                     else
  1223                         upButtonState = upButtonState | SS_Flipped | SS_Mirrored;
  1281                         upButtonState = upButtonState | SS_Flipped | SS_Mirrored;
  1224                     if (optionSpinbox->state & State_HasFocus)
  1282                     if (optionSpinbox->state & State_HasFocus)
  1225                         upButtonState |= SS_Selected;
  1283                         upButtonState |= SS_Selected;
  1226                     if (!(copy.state & State_Enabled))
  1284                     if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepUpEnabled))
  1227                         upButtonState |= SS_Disabled;
  1285                         upButtonState |= SS_Disabled;
  1228                     m_private->drawItem(SP_BoxButton, painter, spinboxButtonUpRect, upButtonState);
  1286                     m_private->drawItem(SP_BoxButton, painter, spinboxButtonUpRect, upButtonState);
  1229                 }
  1287                 }
  1230 
  1288 
  1231                 if (optionSpinbox->subControls & SC_SpinBoxDown) {
  1289                 if (optionSpinbox->subControls & SC_SpinBoxDown) {
  1232                     copy.subControls = SC_SpinBoxDown;
       
  1233                     if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepDownEnabled))
  1290                     if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepDownEnabled))
  1234                         copy.state &= ~State_Enabled;
  1291                         buttonState &= ~State_Enabled;
  1235                     if (optionSpinbox->activeSubControls == SC_SpinBoxDown && (optionSpinbox->state & State_Sunken)) {
  1292                     if (optionSpinbox->activeSubControls == SC_SpinBoxDown && (optionSpinbox->state & State_Sunken)) {
  1236                         copy.state |= State_On;
  1293                         buttonState |= State_On;
  1237                         copy.state |= State_Sunken;
  1294                         buttonState |= State_Sunken;
  1238                     } else {
  1295                     } else {
  1239                         copy.state |= State_Raised;
  1296                         buttonState |= State_Raised;
  1240                         copy.state &= ~State_Sunken;
  1297                         buttonState &= ~State_Sunken;
  1241                     }
  1298                     }
  1242                     const bool isPressed = (copy.state & State_Sunken);
  1299                     const bool isPressed = (buttonState & State_Sunken);
  1243                     ItemStates downButtonState = (isPressed) ? ItemStates(SS_Pressed  | SS_Active) : ItemStates(SS_Active);
  1300                     ItemStates downButtonState = (isPressed) ? ItemStates(SS_Pressed  | SS_Active) : ItemStates(SS_Active);
  1244                     if (optionSpinbox->direction == Qt::RightToLeft)
  1301                     if (optionSpinbox->direction == Qt::RightToLeft)
  1245                         downButtonState = downButtonState;
  1302                         downButtonState = downButtonState;
  1246                     else
  1303                     else
  1247                         downButtonState = downButtonState | SS_Mirrored;
  1304                         downButtonState = downButtonState | SS_Mirrored;
  1248                     if (optionSpinbox->state & State_HasFocus)
  1305                     if (optionSpinbox->state & State_HasFocus)
  1249                         downButtonState |= SS_Selected;
  1306                         downButtonState |= SS_Selected;
  1250                     if (!(copy.state & State_Enabled))
  1307                     if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepDownEnabled))
  1251                         downButtonState |= SS_Disabled;
  1308                         downButtonState |= SS_Disabled;
  1252                     m_private->drawItem(SP_BoxButton, painter, spinboxButtonDownRect, downButtonState);
  1309                     m_private->drawItem(SP_BoxButton, painter, spinboxButtonDownRect, downButtonState);
  1253                 }
  1310                 }
  1254             }
  1311             }
  1255             break;
  1312             break;
  1299 QRect QHbStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
  1356 QRect QHbStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
  1300 {
  1357 {
  1301     const QRect baseSize = QCommonStyle::subElementRect(element, option, widget);
  1358     const QRect baseSize = QCommonStyle::subElementRect(element, option, widget);
  1302     QRect elementSize = baseSize;
  1359     QRect elementSize = baseSize;
  1303     switch (element) {
  1360     switch (element) {
       
  1361         case SE_LineEditContents: {
       
  1362             qreal metric = 0;
       
  1363             m_private->styleManager()->parameter(QLatin1String("hb-param-margin-gene-middle-horizontal"), metric);
       
  1364             const int metricValue = metric + 0.5;
       
  1365             elementSize = visualRect(
       
  1366                 option->direction, option->rect, option->rect.adjusted(metricValue, 0, 0, 0));
       
  1367             }
       
  1368             break;
  1304         case SE_ItemViewItemText: {
  1369         case SE_ItemViewItemText: {
  1305             if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
  1370             if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
  1306                 elementSize = menuItem->rect;
  1371                 elementSize = menuItem->rect;
  1307                 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget);
  1372                 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget);
  1308                 const QRect checkBoxRect = subElementRect(SE_ViewItemCheckIndicator, option, widget);
  1373                 const QRect checkBoxRect = subElementRect(SE_ViewItemCheckIndicator, option, widget);
  1314                 totalXMod += indicatorSpacing;
  1379                 totalXMod += indicatorSpacing;
  1315                 elementSize.translate(totalXMod, 0);
  1380                 elementSize.translate(totalXMod, 0);
  1316                 elementSize.setWidth(menuItem->rect.width() - widthMod);
  1381                 elementSize.setWidth(menuItem->rect.width() - widthMod);
  1317             } else if (const QStyleOptionViewItemV4 *itemView = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
  1382             } else if (const QStyleOptionViewItemV4 *itemView = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
  1318                 elementSize = itemView->rect;
  1383                 elementSize = itemView->rect;
  1319                 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget);
  1384                 if (itemView->decorationPosition == QStyleOptionViewItem::Left ||
  1320                 const QRect checkBoxRect = subElementRect(SE_ViewItemCheckIndicator, option, widget);
  1385                     itemView->decorationPosition == QStyleOptionViewItem::Right) {
  1321                 const int indicatorSpacing = proxy()->pixelMetric(PM_LayoutHorizontalSpacing, option, widget);
  1386                     const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget);
  1322                 int totalXMod = qMax(0, qMax((checkBoxRect.isValid() ? checkBoxRect.topRight().x() : 0),
  1387                     const QRect checkBoxRect = subElementRect(SE_ViewItemCheckIndicator, option, widget);
  1323                                      (iconRect.isValid() ? iconRect.topRight().x() : 0)));
  1388                     const int indicatorSpacing = proxy()->pixelMetric(PM_LayoutHorizontalSpacing, option, widget);
  1324                 const int widthMod = checkBoxRect.width() + iconRect.width() + indicatorSpacing;
  1389                     int totalXMod = qMax(0, qMax((checkBoxRect.isValid() ? checkBoxRect.topRight().x() : 0),
  1325                 totalXMod = (itemView->direction == Qt::LeftToRight) ? qMax(0, totalXMod - elementSize.topLeft().x()): 0;
  1390                                          (iconRect.isValid() ? iconRect.topRight().x() : 0)));
  1326                 totalXMod += indicatorSpacing;
  1391                     const int widthMod = checkBoxRect.width() + iconRect.width() + indicatorSpacing;
  1327                 elementSize.translate(totalXMod, 0);
  1392                     totalXMod = (itemView->direction == Qt::LeftToRight) ? qMax(0, totalXMod - elementSize.topLeft().x()): 0;
  1328                 elementSize.setWidth(itemView->rect.width() - widthMod);
  1393                     totalXMod += indicatorSpacing;
  1329                 elementSize = visualRect(itemView->direction, itemView->rect, elementSize);
  1394                     elementSize.translate(totalXMod, 0);
       
  1395                     elementSize.setWidth(itemView->rect.width() - widthMod);
       
  1396                     elementSize = visualRect(itemView->direction, itemView->rect, elementSize);
       
  1397                 } else {
       
  1398                     const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget);
       
  1399                     const bool decoratorOnTop = (itemView->decorationPosition == QStyleOptionViewItem::Top);
       
  1400                     if (decoratorOnTop)
       
  1401                         elementSize.translate(0, iconRect.height());
       
  1402                     else
       
  1403                         elementSize.translate(0, -iconRect.height());
       
  1404                 }
  1330             }
  1405             }
  1331             break;
  1406             break;
  1332         }
  1407         }
  1333         case SE_ViewItemCheckIndicator: {
  1408         case SE_ViewItemCheckIndicator: {
  1334             if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
  1409             if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
  1421                    }
  1496                    }
  1422                     case SC_ComboBoxFrame: {
  1497                     case SC_ComboBoxFrame: {
  1423                         QRect frameRect = QRect(cmb->rect);
  1498                         QRect frameRect = QRect(cmb->rect);
  1424                         int frameWidth = pixelMetric(PM_DefaultFrameWidth, cmb, widget);
  1499                         int frameWidth = pixelMetric(PM_DefaultFrameWidth, cmb, widget);
  1425                         int maxRight = cmb->rect.height() - 2 * frameWidth;
  1500                         int maxRight = cmb->rect.height() - 2 * frameWidth;
  1426                         frameRect.adjust(0, 0, -maxRight, 0);
  1501                         if(cmb->direction == Qt::RightToLeft) {
       
  1502                             frameRect.adjust(+ 0.25 * buttonWidth, 0, -0.25 * buttonWidth, 0);
       
  1503                         }else{
       
  1504                             frameRect.adjust(0, 0, -maxRight-4, 0);
       
  1505                         }
  1427                         elementSize = frameRect;
  1506                         elementSize = frameRect;
  1428                         break;
  1507                         break;
  1429                     }
  1508                     }
  1430                     case SC_ComboBoxEditField: {
  1509                     case SC_ComboBoxEditField: {
  1431                         const int withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width();
  1510                         int withFrameX = 0;
       
  1511                         int offSet = 0;
       
  1512                         if(cmb->direction == Qt::RightToLeft) {
       
  1513                             withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness;
       
  1514                             offSet = buttonWidth;
       
  1515                         }
       
  1516                         else{
       
  1517                             withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width();
       
  1518                         }
  1432                         elementSize = QRect(
  1519                         elementSize = QRect(
  1433                             frameThickness,
  1520                             frameThickness + offSet,
  1434                             frameThickness - 2,
  1521                             frameThickness - 2,
  1435                             withFrameX - frameThickness,
  1522                             withFrameX - frameThickness - offSet,
  1436                             cmb->rect.height() - 2 * frameThickness );
  1523                             cmb->rect.height() - 2 * frameThickness );
  1437                         break;
  1524                         break;
  1438                     }
  1525                     }
  1439                     case SC_ComboBoxListBoxPopup: {
  1526                     case SC_ComboBoxListBoxPopup: {
  1440                         QRect mover = cmb->rect;
  1527                         QRect mover = cmb->rect;
  1646 #endif //QT_NO_SLIDER
  1733 #endif //QT_NO_SLIDER
  1647 #ifndef QT_NO_SPINBOX
  1734 #ifndef QT_NO_SPINBOX
  1648         case CC_SpinBox: {
  1735         case CC_SpinBox: {
  1649             if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
  1736             if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
  1650                 const int buttonIconSize = pixelMetric(PM_ButtonIconSize);
  1737                 const int buttonIconSize = pixelMetric(PM_ButtonIconSize);
  1651                 const int buttonWidth = qMax(spinbox->rect.height(), buttonIconSize);
  1738                 // Spinbox buttons should be no larger than one fourth of total width.
       
  1739                 const int maxSize = qMax(spinbox->rect.width() / 4, buttonIconSize + 4); //@magic
       
  1740                 QSize buttonSize;
       
  1741                 buttonSize.setHeight(qMin(maxSize, qMax(8, spinbox->rect.height())));
       
  1742                 buttonSize.setWidth(buttonSize.height()); //make buttons square
       
  1743 
  1652                 switch (sc) {
  1744                 switch (sc) {
  1653                     case SC_SpinBoxFrame:
  1745                     case SC_SpinBoxFrame:
  1654                          elementSize = option->rect.adjusted(0, 0, -buttonWidth + 5, 0);
  1746                          elementSize = option->rect.adjusted(0, 0, -buttonSize.width() + 5, 0); //@magic
  1655                          break;
  1747                          break;
  1656                     case SC_SpinBoxDown: {
  1748                     case SC_SpinBoxDown: {
  1657                         if (option->direction == Qt::RightToLeft)
  1749                         if (option->direction == Qt::RightToLeft)
  1658                             elementSize = QRect(option->rect.right() - buttonWidth, option->rect.y(),buttonWidth, option->rect.height());
  1750                             elementSize = QRect(option->rect.right() - buttonSize.width(), option->rect.y(), buttonSize.width(), option->rect.height());
  1659                         else
  1751                         else
  1660                             elementSize = QRect( option->rect.x(), option->rect.y(), buttonWidth,option->rect.height());
  1752                             elementSize = QRect(option->rect.x(), option->rect.y(), buttonSize.width(), option->rect.height());
  1661                     }
  1753                     }
  1662                     break;
  1754                     break;
  1663                     case SC_SpinBoxUp: {
  1755                     case SC_SpinBoxUp: {
  1664                         if (option->direction == Qt::RightToLeft)
  1756                         if (option->direction == Qt::RightToLeft)
  1665                             elementSize = QRect( option->rect.x(), option->rect.y(), buttonWidth,option->rect.height());
  1757                             elementSize = QRect(option->rect.x(), option->rect.y(), buttonSize.width(), option->rect.height());
  1666                         else
  1758                         else
  1667                             elementSize = QRect(option->rect.right() - buttonWidth,option->rect.y(),buttonWidth,option->rect.height());
  1759                             elementSize = QRect(option->rect.right() - buttonSize.width(), option->rect.y(), buttonSize.width(), option->rect.height());
  1668                     }
  1760                     }
  1669                     break;
  1761                     break;
  1670                     case SC_SpinBoxEditField:
  1762                     case SC_SpinBoxEditField:
  1671                         elementSize = option->rect.adjusted(buttonWidth, 0, -buttonWidth, 0);
  1763                         elementSize = option->rect.adjusted(buttonSize.width(), 0, -buttonSize.width(), 0);
  1672                         break;
  1764                         break;
  1673                     default:
  1765                     default:
  1674                         break;
  1766                         break;
  1675                  }
  1767                  }
  1676              }
  1768              }
  2193     return QCommonStyle::standardPixmap(standardPixmap, option, widget);
  2285     return QCommonStyle::standardPixmap(standardPixmap, option, widget);
  2194 }
  2286 }
  2195 
  2287 
  2196 void QHbStyle::polish(QWidget *widget)
  2288 void QHbStyle::polish(QWidget *widget)
  2197 {
  2289 {
       
  2290     QCommonStyle::polish(widget);
       
  2291 
  2198     if (!widget)
  2292     if (!widget)
  2199         return;
  2293         return;
  2200 
  2294 
  2201     if (false
  2295     if (false
  2202 #ifndef QT_NO_SCROLLBAR
  2296 #ifndef QT_NO_SCROLLBAR
  2209     if (m_private->isDialog(widget)) {
  2303     if (m_private->isDialog(widget)) {
  2210         widget->setAttribute(Qt::WA_StyledBackground);
  2304         widget->setAttribute(Qt::WA_StyledBackground);
  2211     }
  2305     }
  2212 
  2306 
  2213     m_private->polishFont(widget);
  2307     m_private->polishFont(widget);
  2214 
  2308     m_private->polishPalette(widget);
  2215     QCommonStyle::polish(widget);
       
  2216 
  2309 
  2217 #ifndef QT_NO_PROGRESSBAR
  2310 #ifndef QT_NO_PROGRESSBAR
  2218     if (qobject_cast<QProgressBar *>(widget))
  2311     if (qobject_cast<QProgressBar *>(widget))
  2219         widget->installEventFilter(this);
  2312         widget->installEventFilter(this);
  2220 #endif
  2313 #endif
  2226 }
  2319 }
  2227 
  2320 
  2228 void QHbStyle::polish(QPalette &palette)
  2321 void QHbStyle::polish(QPalette &palette)
  2229 {
  2322 {
  2230     QCommonStyle::polish(palette);
  2323     QCommonStyle::polish(palette);
  2231 
       
  2232     palette.setBrush(QPalette::Disabled, QPalette::WindowText, QColor(QRgb(0xff808080)));
       
  2233     palette.setBrush(QPalette::Disabled, QPalette::Button, QColor(QRgb(0xffdddfe4)));
       
  2234     palette.setBrush(QPalette::Disabled, QPalette::Light, QColor(QRgb(0xffffffff)));
       
  2235     palette.setBrush(QPalette::Disabled, QPalette::Midlight, QColor(QRgb(0xffffffff)));
       
  2236     palette.setBrush(QPalette::Disabled, QPalette::Dark, QColor(QRgb(0xff555555)));
       
  2237     palette.setBrush(QPalette::Disabled, QPalette::Mid, QColor(QRgb(0xffc7c7c7)));
       
  2238     palette.setBrush(QPalette::Disabled, QPalette::Text, QColor(QRgb(0xffc7c7c7)));
       
  2239     palette.setBrush(QPalette::Disabled, QPalette::BrightText, QColor(QRgb(0xffffffff)));
       
  2240     palette.setBrush(QPalette::Disabled, QPalette::ButtonText, QColor(QRgb(0xff808080)));
       
  2241     palette.setBrush(QPalette::Disabled, QPalette::Base, QColor(QRgb(0xffefefef)));
       
  2242     palette.setBrush(QPalette::Disabled, QPalette::AlternateBase, palette.color(QPalette::Disabled, QPalette::Base).darker(110));
       
  2243     palette.setBrush(QPalette::Disabled, QPalette::Window, QColor(QRgb(0xffefefef)));
       
  2244     palette.setBrush(QPalette::Disabled, QPalette::Shadow, QColor(QRgb(0xff000000)));
       
  2245     palette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(QRgb(0xff567594)));
       
  2246     palette.setBrush(QPalette::Disabled, QPalette::HighlightedText, QColor(QRgb(0xffffffff)));
       
  2247     palette.setBrush(QPalette::Disabled, QPalette::Link, QColor(QRgb(0xff0000ee)));
       
  2248     palette.setBrush(QPalette::Disabled, QPalette::LinkVisited, QColor(QRgb(0xff52188b)));
       
  2249     palette.setBrush(QPalette::Disabled, QPalette::ToolTipBase, QColor(QRgb(0xff0000ee)));
       
  2250     palette.setBrush(QPalette::Disabled, QPalette::ToolTipText, QColor(QRgb(0xff52188b)));
       
  2251 
       
  2252     palette.setBrush(QPalette::Active, QPalette::WindowText, QColor(QRgb(0xff000000)));
       
  2253     palette.setBrush(QPalette::Active, QPalette::Button, QColor(QRgb(0xffdddfe4)));
       
  2254     palette.setBrush(QPalette::Active, QPalette::Light, QColor(QRgb(0xffffffff)));
       
  2255     palette.setBrush(QPalette::Active, QPalette::Midlight, QColor(QRgb(0xffffffff)));
       
  2256     palette.setBrush(QPalette::Active, QPalette::Dark, QColor(QRgb(0xff555555)));
       
  2257     palette.setBrush(QPalette::Active, QPalette::Mid, QColor(QRgb(0xffc7c7c7)));
       
  2258     palette.setBrush(QPalette::Active, QPalette::Text, QColor(QRgb(0xff000000)));
       
  2259     palette.setBrush(QPalette::Active, QPalette::BrightText, QColor(QRgb(0xffffffff)));
       
  2260     palette.setBrush(QPalette::Active, QPalette::ButtonText, QColor(QRgb(0xff000000)));
       
  2261     palette.setBrush(QPalette::Active, QPalette::Base, QColor(QRgb(0xE4E4E4)));
       
  2262     palette.setBrush(QPalette::Active, QPalette::AlternateBase, palette.color(QPalette::Active, QPalette::Base).darker(110));
       
  2263     palette.setBrush(QPalette::Active, QPalette::Window, QColor(QRgb(0xffefefef)));
       
  2264     palette.setBrush(QPalette::Active, QPalette::Shadow, QColor(QRgb(0xff000000)));
       
  2265     palette.setBrush(QPalette::Active, QPalette::Highlight, QColor(QRgb(0xffE4E4E4)));
       
  2266     palette.setBrush(QPalette::Active, QPalette::HighlightedText, QColor(QRgb(0xff000000)));
       
  2267     palette.setBrush(QPalette::Active, QPalette::Link, QColor(QRgb(0xff0000ee)));
       
  2268     palette.setBrush(QPalette::Active, QPalette::LinkVisited, QColor(QRgb(0xff52188b)));
       
  2269     palette.setBrush(QPalette::Active, QPalette::ToolTipBase, QColor(QRgb(0xff0000ee)));
       
  2270     palette.setBrush(QPalette::Active, QPalette::ToolTipText, QColor(QRgb(0xff52188b)));
       
  2271 
       
  2272     palette.setBrush(QPalette::Inactive, QPalette::WindowText, QColor(QRgb(0xff000000)));
       
  2273     palette.setBrush(QPalette::Inactive, QPalette::Button, QColor(QRgb(0xffdddfe4)));
       
  2274     palette.setBrush(QPalette::Inactive, QPalette::Light, QColor(QRgb(0xffffffff)));
       
  2275     palette.setBrush(QPalette::Inactive, QPalette::Midlight, QColor(QRgb(0xffffffff)));
       
  2276     palette.setBrush(QPalette::Inactive, QPalette::Dark, QColor(QRgb(0xff555555)));
       
  2277     palette.setBrush(QPalette::Inactive, QPalette::Mid, QColor(QRgb(0xffc7c7c7)));
       
  2278     palette.setBrush(QPalette::Inactive, QPalette::Text, QColor(QRgb(0xff000000)));
       
  2279     palette.setBrush(QPalette::Inactive, QPalette::BrightText, QColor(QRgb(0xffffffff)));
       
  2280     palette.setBrush(QPalette::Inactive, QPalette::ButtonText, QColor(QRgb(0xff000000)));
       
  2281     palette.setBrush(QPalette::Inactive, QPalette::Base, QColor(QRgb(0xffffffff)));
       
  2282     palette.setBrush(QPalette::Inactive, QPalette::AlternateBase, palette.color(QPalette::Inactive, QPalette::Base).darker(110));
       
  2283     palette.setBrush(QPalette::Inactive, QPalette::Window, QColor(QRgb(0xffefefef)));
       
  2284     palette.setBrush(QPalette::Inactive, QPalette::Shadow, QColor(QRgb(0xff000000)));
       
  2285     palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(QRgb(0xff678db2)));
       
  2286     palette.setBrush(QPalette::Inactive, QPalette::HighlightedText, QColor(QRgb(0xffffffff)));
       
  2287     palette.setBrush(QPalette::Inactive, QPalette::Link, QColor(QRgb(0xff0000ee)));
       
  2288     palette.setBrush(QPalette::Inactive, QPalette::LinkVisited, QColor(QRgb(0xff52188b)));
       
  2289     palette.setBrush(QPalette::Inactive, QPalette::ToolTipBase, QColor(QRgb(0xff0000ee)));
       
  2290     palette.setBrush(QPalette::Inactive, QPalette::ToolTipText, QColor(QRgb(0xff52188b)));
       
  2291 }
  2324 }
  2292 
  2325 
  2293 void QHbStyle::unpolish(QWidget *widget)
  2326 void QHbStyle::unpolish(QWidget *widget)
  2294 {
  2327 {
  2295     if (!widget)
  2328     if (!widget)
  2389         }
  2422         }
  2390         case SP_TrashIcon: {
  2423         case SP_TrashIcon: {
  2391             break;
  2424             break;
  2392         }
  2425         }
  2393         case SP_ComputerIcon: {
  2426         case SP_ComputerIcon: {
  2394             iconName = QLatin1String("qtg_mono_mobile");
  2427             iconName = QLatin1String("qtg_small_mobile");
  2395             break;
  2428             break;
  2396         }
  2429         }
  2397         case SP_DriveFDIcon: {
  2430         case SP_DriveFDIcon:
  2398             break;
  2431         case SP_DriveHDIcon:
  2399         }
  2432         case SP_DriveCDIcon:
  2400         case SP_DriveHDIcon: {
       
  2401             break;
       
  2402         }
       
  2403         case SP_DriveCDIcon: {
       
  2404             break;
       
  2405         }
       
  2406         case SP_DriveDVDIcon: {
  2433         case SP_DriveDVDIcon: {
       
  2434             iconName = QLatin1String("qtg_large_mmc");
  2407             break;
  2435             break;
  2408         }
  2436         }
  2409         case SP_DriveNetIcon: {
  2437         case SP_DriveNetIcon: {
  2410             break;
  2438             break;
  2411         }
  2439         }
  2417         }
  2445         }
  2418         case SP_DirLinkIcon: {
  2446         case SP_DirLinkIcon: {
  2419             break;
  2447             break;
  2420         }
  2448         }
  2421         case SP_FileIcon: {
  2449         case SP_FileIcon: {
       
  2450             iconName = QLatin1String("qtg_large_notes");
  2422             break;
  2451             break;
  2423         }
  2452         }
  2424         case SP_FileLinkIcon: {
  2453         case SP_FileLinkIcon: {
  2425             break;
  2454             break;
  2426         }
  2455         }
  2427         case SP_ToolBarHorizontalExtensionButton: {
  2456         case SP_ToolBarHorizontalExtensionButton: {
       
  2457             iconName = QLatin1String("qtg_mono_more");
  2428             break;
  2458             break;
  2429         }
  2459         }
  2430         case SP_ToolBarVerticalExtensionButton: {
  2460         case SP_ToolBarVerticalExtensionButton: {
       
  2461             iconName = QLatin1String("qtg_mono_more");
  2431             break;
  2462             break;
  2432         }
  2463         }
  2433         case SP_FileDialogStart: {
  2464         case SP_FileDialogStart: {
  2434             break;
  2465             break;
  2435         }
  2466         }
  2444         }
  2475         }
  2445         case SP_FileDialogDetailedView: {
  2476         case SP_FileDialogDetailedView: {
  2446             break;
  2477             break;
  2447         }
  2478         }
  2448         case SP_FileDialogInfoView: {
  2479         case SP_FileDialogInfoView: {
       
  2480             iconName = QLatin1String("qtg_large_info");
  2449             break;
  2481             break;
  2450         }
  2482         }
  2451         case SP_FileDialogContentsView: {
  2483         case SP_FileDialogContentsView: {
  2452             break;
  2484             break;
  2453         }
  2485         }
  2459         }
  2491         }
  2460         case SP_DirIcon: {
  2492         case SP_DirIcon: {
  2461             break;
  2493             break;
  2462         }
  2494         }
  2463         case SP_DialogOkButton: {
  2495         case SP_DialogOkButton: {
       
  2496             iconName = QLatin1String("qtg_large_ok");
  2464             break;
  2497             break;
  2465         }
  2498         }
  2466         case SP_DialogCancelButton: {
  2499         case SP_DialogCancelButton: {
  2467             break;
  2500             break;
  2468         }
  2501         }
  2469         case SP_DialogHelpButton: {
  2502         case SP_DialogHelpButton: {
       
  2503             iconName = QLatin1String("qtg_large_help");
  2470             break;
  2504             break;
  2471         }
  2505         }
  2472         case SP_DialogOpenButton: {
  2506         case SP_DialogOpenButton: {
  2473             break;
  2507             break;
  2474         }
  2508         }
  2477         }
  2511         }
  2478         case SP_DialogCloseButton: {
  2512         case SP_DialogCloseButton: {
  2479             break;
  2513             break;
  2480         }
  2514         }
  2481         case SP_DialogApplyButton: {
  2515         case SP_DialogApplyButton: {
       
  2516             iconName = QLatin1String("qtg_large_ok");
  2482             break;
  2517             break;
  2483         }
  2518         }
  2484         case SP_DialogResetButton: {
  2519         case SP_DialogResetButton: {
  2485             break;
  2520             break;
  2486         }
  2521         }
  2487         case SP_DialogDiscardButton: {
  2522         case SP_DialogDiscardButton: {
       
  2523             iconName = QLatin1String("qtg_small_fail");
  2488             break;
  2524             break;
  2489         }
  2525         }
  2490         case SP_DialogYesButton: {
  2526         case SP_DialogYesButton: {
  2491             break;
  2527             break;
  2492         }
  2528         }
  2562         }
  2598         }
  2563     }
  2599     }
  2564 
  2600 
  2565     QIcon icon;
  2601     QIcon icon;
  2566     if (!iconName.isNull()) {
  2602     if (!iconName.isNull()) {
  2567         HbIcon* hbicon = q_check_ptr(new HbIcon(iconName));
  2603         HbIcon* hbicon = new HbIcon(iconName);
  2568         hbicon->setSize(iconRect.size());
  2604         hbicon->setSize(iconRect.size());
  2569         icon =  QIcon(hbicon->qicon());
  2605         icon =  QIcon(hbicon->qicon());
  2570         delete hbicon;
  2606         delete hbicon;
  2571     } else {
  2607     } else {
  2572         icon = QCommonStyle::standardIconImplementation(standardIcon, option, widget);
  2608         icon = QCommonStyle::standardIconImplementation(standardIcon, option, widget);
  2643                                  break;
  2679                                  break;
  2644                              }
  2680                              }
  2645                          }
  2681                          }
  2646                      }
  2682                      }
  2647                      if (!alreadyAnimated) {
  2683                      if (!alreadyAnimated) {
  2648                          QHbStyleAnimation* target = q_check_ptr(new QHbStyleAnimation(const_cast<QProgressBar*>(bar)));
  2684                          QHbStyleAnimation* target = new QHbStyleAnimation(const_cast<QProgressBar*>(bar));
  2649                          target->createAnimationIcon(CE_ProgressBarContents, bar->orientation());
  2685                          target->createAnimationIcon(CE_ProgressBarContents, bar->orientation());
  2650                          QPropertyAnimation* animation = q_check_ptr(new QPropertyAnimation(target, "point"));
  2686                          QPropertyAnimation* animation = new QPropertyAnimation(target, "point");
  2651                          animation->setLoopCount(-1); //run until stopped
  2687                          animation->setLoopCount(-1); //run until stopped
  2652                          const int chunk = pixelMetric(PM_ProgressBarChunkWidth, option, widget)-1;
  2688                          const int chunk = pixelMetric(PM_ProgressBarChunkWidth, option, widget)-1;
  2653                          if (bar->orientation()== Qt::Horizontal) {
  2689                          if (bar->orientation()== Qt::Horizontal) {
  2654                              if ((option->direction == Qt::LeftToRight) ^ const_cast<QProgressBar*>(bar)->invertedAppearance()) {
  2690                              if ((option->direction == Qt::LeftToRight) ^ const_cast<QProgressBar*>(bar)->invertedAppearance()) {
  2655                                  animation->setStartValue(bar->rect().topLeft());
  2691                                  animation->setStartValue(bar->rect().topLeft());
  2767             else
  2803             else
  2768                 iconName = QLatin1String("qtg_graf_devider_v_thin");
  2804                 iconName = QLatin1String("qtg_graf_devider_v_thin");
  2769             break;
  2805             break;
  2770         }
  2806         }
  2771         case SP_TreeViewExpanded: {
  2807         case SP_TreeViewExpanded: {
  2772             iconName = QLatin1String("qtg_small_hl_opened");
  2808             iconName = QLatin1String("qtg_small_expand");
  2773             break;
  2809             break;
  2774         }
  2810         }
  2775         case SP_TreeViewCollapsed: {
  2811         case SP_TreeViewCollapsed: {
  2776             iconName = QLatin1String("qtg_small_hl_closed");
  2812             iconName = QLatin1String("qtg_small_collapse");
  2777             break;
  2813             break;
  2778         }
  2814         }
  2779         case SP_SubMenuIndicator:
  2815         case SP_SubMenuIndicator:
  2780         default: {
  2816         default: {
  2781             return false;
  2817             return false;
  2782         }
  2818         }
  2783     }
  2819     }
  2784     if (!iconName.isNull() && !rect.isEmpty()) {
  2820     if (!iconName.isNull() && !rect.isEmpty()) {
  2785         HbIcon *icon = q_check_ptr(new HbIcon(iconName));
  2821         HbIcon *icon = new HbIcon(iconName);
  2786         icon->setSize(rect.size());
  2822         icon->setSize(rect.size());
  2787         if (color.spec() != QColor::Invalid)
  2823         if (color.spec() != QColor::Invalid)
  2788             icon->setColor(color);
  2824             icon->setColor(color);
  2789         if (state & SS_Mirrored)
  2825         if (state & SS_Mirrored)
  2790             icon->setMirroringMode(HbIcon::Forced);
  2826             icon->setMirroringMode(HbIcon::Forced);
  2807 
  2843 
  2808 bool QHbStylePrivate::drawMultiPartItem(MultiPartItem multiPart, QPainter *painter, const QRect &rect, ItemStates state)
  2844 bool QHbStylePrivate::drawMultiPartItem(MultiPartItem multiPart, QPainter *painter, const QRect &rect, ItemStates state)
  2809 {
  2845 {
  2810     //Q_Q(QHbStyle);
  2846     //Q_Q(QHbStyle);
  2811 
  2847 
  2812     if (!m_frameDrawer)
  2848     if (m_frameDrawer.isNull())
  2813         m_frameDrawer = q_check_ptr(new HbFrameDrawer());
  2849         m_frameDrawer.reset(new HbFrameDrawer());
  2814 
  2850 
  2815     HbFrameDrawer::FrameType frameType = HbFrameDrawer::Undefined;
  2851     HbFrameDrawer::FrameType frameType = HbFrameDrawer::Undefined;
  2816     QString frameName;
  2852     QString frameName;
  2817     qreal border = 0.0;
  2853     qreal border = 0.0;
  2818     HbIcon::MirroringMode mirrorMode = HbIcon::Default;
  2854     HbIcon::MirroringMode mirrorMode = HbIcon::Default;
  2856         case SM_GroupBoxTitle: {
  2892         case SM_GroupBoxTitle: {
  2857             frameName = QLatin1String("qtg_fr_groupbox");
  2893             frameName = QLatin1String("qtg_fr_groupbox");
  2858             frameType = HbFrameDrawer::NinePieces;
  2894             frameType = HbFrameDrawer::NinePieces;
  2859             break;
  2895             break;
  2860         }
  2896         }
  2861         case SM_ItemViewHighlight: {
       
  2862             frameName = QLatin1String("qtg_fr_list_highlight");
       
  2863             frameType = HbFrameDrawer::NinePieces;
       
  2864             break;
       
  2865         }
       
  2866         case SM_ItemViewItem: {
  2897         case SM_ItemViewItem: {
  2867             if (state & SS_Pressed)
  2898             if (state & SS_Pressed)
  2868                 frameName = QLatin1String("qtg_fr_list_pressed");
  2899                 frameName = QLatin1String("qtg_fr_list_pressed");
  2869             else if (state & SS_Focused)
  2900             else if (state & SS_Focused)
  2870                 frameName = QLatin1String("qtg_fr_list_highlight");
  2901                 frameName = QLatin1String("qtg_fr_list_highlight");
  2871             else
       
  2872                 frameName = QLatin1String("qtg_fr_list_normal");
       
  2873             frameType = HbFrameDrawer::NinePieces;
  2902             frameType = HbFrameDrawer::NinePieces;
  2874             styleManager()->parameter(QLatin1String("hb-param-background-list-main"), border);
  2903             styleManager()->parameter(QLatin1String("hb-param-background-list-main"), border);
  2875             break;
  2904             break;
  2876         }
  2905         }
       
  2906         case SM_TextEdit: //@todo: fallthrough for now, since no specific graphic for editors in releases
  2877         case SM_LineEdit: {
  2907         case SM_LineEdit: {
  2878             styleManager()->parameter(QLatin1String("hb-param-background-editor"), border);
  2908             styleManager()->parameter(QLatin1String("hb-param-background-editor"), border);
  2879             if (state & SS_Selected)
  2909             if (state & SS_Selected)
  2880                 frameName = QLatin1String("qtg_fr_editor_highlight");
  2910                 frameName = QLatin1String("qtg_fr_lineedit_highlight");
  2881             else
  2911             else
  2882                 frameName = QLatin1String("qtg_fr_editor_normal");
  2912                 frameName = QLatin1String("qtg_fr_lineedit_normal");
  2883             frameType = HbFrameDrawer::NinePieces;
  2913             frameType = HbFrameDrawer::NinePieces;
  2884             break;
  2914             break;
  2885         }
  2915         }
  2886         case SM_ListParent: {
  2916         case SM_ListParent: {
  2887             if (state & SS_Pressed)
  2917             if (state & SS_Pressed)
  2916                 frameName = QLatin1String("qtg_fr_popup_list_normal");
  2946                 frameName = QLatin1String("qtg_fr_popup_list_normal");
  2917             frameType = HbFrameDrawer::NinePieces;
  2947             frameType = HbFrameDrawer::NinePieces;
  2918             break;
  2948             break;
  2919         }
  2949         }
  2920         case SM_Panel: {
  2950         case SM_Panel: {
  2921             frameName = QLatin1String("qtg_fr_settingform");
  2951             frameName = QLatin1String("qtg_fr_groupbox_normal");
  2922             frameType = HbFrameDrawer::NinePieces;
  2952             frameType = HbFrameDrawer::NinePieces;
  2923             styleManager()->parameter(QLatin1String("hb-param-background-list-main"), border);
  2953             styleManager()->parameter(QLatin1String("hb-param-background-list-main"), border);
  2924             break;
  2954             break;
  2925         }
  2955         }
  2926         case SM_ProgressBarGroove: {
  2956         case SM_ProgressBarGroove: {
  2943                 frameName = QLatin1String("qtg_fr_progbar_v_filled");
  2973                 frameName = QLatin1String("qtg_fr_progbar_v_filled");
  2944                 frameType = HbFrameDrawer::ThreePiecesVertical;
  2974                 frameType = HbFrameDrawer::ThreePiecesVertical;
  2945             }
  2975             }
  2946             break;
  2976             break;
  2947         }
  2977         }
       
  2978         //@todo: enable separate graphic for texteditor. Graphic was not included in the wk12 release.
       
  2979         /*case SM_TextEdit: {
       
  2980             styleManager()->parameter(QLatin1String("hb-param-background-editor"), border);
       
  2981             if (state & SS_Selected)
       
  2982                 frameName = QLatin1String("qtg_fr_textedit_highlight");
       
  2983             else
       
  2984                 frameName = QLatin1String("qtg_fr_textedit_normal");
       
  2985             frameType = HbFrameDrawer::NinePieces;
       
  2986             break;
       
  2987         }*/
  2948         case SM_ToolButton: {
  2988         case SM_ToolButton: {
  2949             frameType = HbFrameDrawer::ThreePiecesHorizontal;
  2989             frameType = HbFrameDrawer::ThreePiecesHorizontal;
  2950             frameGraphicsHeader = QLatin1String("qtg_fr_tb_h_");
  2990             frameGraphicsHeader = QLatin1String("qtg_fr_tb_h_");
  2951 
  2991 
  2952             framePartList << QLatin1String("_cl") << QLatin1String("_c") << QLatin1String("_cr");
  2992             framePartList << QLatin1String("_cl") << QLatin1String("_c") << QLatin1String("_cr");
  3036                 } else {
  3076                 } else {
  3037                     frameName = QLatin1String("qtg_fr_slider_v_filled");
  3077                     frameName = QLatin1String("qtg_fr_slider_v_filled");
  3038                     frameType = HbFrameDrawer::ThreePiecesVertical;
  3078                     frameType = HbFrameDrawer::ThreePiecesVertical;
  3039                 }
  3079                 }
  3040             }
  3080             }
       
  3081             break;
       
  3082         }
       
  3083         case SM_TableItem: {
       
  3084             if (state & SS_Pressed)
       
  3085                 frameName = QLatin1String("qtg_fr_grid_pressed");
       
  3086             else if (state & SS_Focused)
       
  3087                 frameName = QLatin1String("qtg_fr_grid_highlight");
       
  3088             frameType = HbFrameDrawer::NinePieces;
       
  3089             styleManager()->parameter(QLatin1String("hb-param-background-list-main"), border);
  3041             break;
  3090             break;
  3042         }
  3091         }
  3043         case SM_TabShape: {
  3092         case SM_TabShape: {
  3044             if (state & SS_Horizontal) {
  3093             if (state & SS_Horizontal) {
  3045                 frameType = HbFrameDrawer::ThreePiecesHorizontal;
  3094                 frameType = HbFrameDrawer::ThreePiecesHorizontal;
  3071                 frameGraphicsFooter = QLatin1String("pressed");
  3120                 frameGraphicsFooter = QLatin1String("pressed");
  3072             else if (state & SS_Selected)
  3121             else if (state & SS_Selected)
  3073                 frameGraphicsFooter = QLatin1String("highlight");
  3122                 frameGraphicsFooter = QLatin1String("highlight");
  3074             else
  3123             else
  3075                 frameGraphicsFooter = QLatin1String("normal");
  3124                 frameGraphicsFooter = QLatin1String("normal");
  3076             break;
       
  3077         }
       
  3078         case SM_TextEdit: { //@todo: combine this and  case SM_LineEdit to "case SM_TextEditor"?
       
  3079             styleManager()->parameter(QLatin1String("hb-param-background-editor"), border);
       
  3080             frameName = QLatin1String("qtg_fr_editor");
       
  3081             frameType = HbFrameDrawer::NinePieces;
       
  3082             break;
  3125             break;
  3083         }
  3126         }
  3084         case SM_ToolBarButton: {
  3127         case SM_ToolBarButton: {
  3085             if (state & SS_Horizontal) {
  3128             if (state & SS_Horizontal) {
  3086                 frameType = HbFrameDrawer::ThreePiecesHorizontal;
  3129                 frameType = HbFrameDrawer::ThreePiecesHorizontal;
  3108                     frameName = QLatin1String("qtg_fr_tb_v_normal");
  3151                     frameName = QLatin1String("qtg_fr_tb_v_normal");
  3109             }
  3152             }
  3110             styleManager()->parameter(QLatin1String("hb-param-background-button"), border);
  3153             styleManager()->parameter(QLatin1String("hb-param-background-button"), border);
  3111             break;
  3154             break;
  3112         }
  3155         }
       
  3156         case SM_ToolBarExtension:{
       
  3157 //            fillRect = true;
       
  3158 //            styleManager()->parameter(QLatin1String("hb-param-background-editor"), border);
       
  3159             frameName = QLatin1String("qtg_fr_tb_ext");
       
  3160             frameType = HbFrameDrawer::NinePieces;
       
  3161             }
       
  3162             break;
  3113         case SM_ToolTip: {
  3163         case SM_ToolTip: {
  3114             fillRect = true;
  3164             fillRect = true;
  3115             frameType = HbFrameDrawer::NinePieces;
  3165             frameType = HbFrameDrawer::NinePieces;
  3116             frameName = QLatin1String("qtg_fr_popup_preview");
  3166             frameName = QLatin1String("qtg_fr_popup_preview");
  3117             break;
  3167             break;
  3118         }
  3168         }
  3119         case SM_HeaderItem:
  3169         case SM_HeaderItem:
  3120         case SM_TableItem:
       
  3121         case SM_ThemeBackground:
  3170         case SM_ThemeBackground:
  3122         case SM_ToolBar:
  3171         case SM_ToolBar:
  3123         default: {
  3172         default: {
  3124             break;
  3173             break;
  3125         }
  3174         }
  3275         ) {
  3324         ) {
  3276         fontRole = HbFontSpec::Secondary;
  3325         fontRole = HbFontSpec::Secondary;
  3277         valueFound = styleManager()->parameter(QLatin1String("hb-param-text-height-tiny"), fontSize);
  3326         valueFound = styleManager()->parameter(QLatin1String("hb-param-text-height-tiny"), fontSize);
  3278     }
  3327     }
  3279 
  3328 
  3280     HbFontSpec *fontSpec = q_check_ptr(new HbFontSpec(fontRole));
  3329     HbFontSpec *fontSpec = new HbFontSpec(fontRole);
  3281     if (valueFound) {
  3330     if (valueFound) {
  3282         fontSpec->setTextHeight(fontSize);
  3331         fontSpec->setTextHeight(fontSize);
  3283         QFont widgetFont = fontSpec->font();
  3332         QFont widgetFont = fontSpec->font();
  3284         widgetFont.setPixelSize(fontSpec->font().pixelSize());
  3333         widgetFont.setPixelSize(fontSpec->font().pixelSize());
  3285         widget->setFont(widgetFont);
  3334         widget->setFont(widgetFont);
  3286     }
  3335     }
  3287     delete fontSpec;
  3336     delete fontSpec;
  3288 }
  3337 }
  3289 
  3338 
       
  3339 void QHbStylePrivate::polishPalette(QWidget *widget)
       
  3340 {
       
  3341     QPalette widgetPalette = widget->palette();
       
  3342     if (false
       
  3343 #ifndef QT_NO_TEXTEDIT
       
  3344         || qobject_cast<QTextEdit *>(widget)
       
  3345 #endif
       
  3346     ) {
       
  3347         widgetPalette.setColor(QPalette::Active, QPalette::Highlight, HbColorScheme::color("qtc_lineedit_marker_normal"));
       
  3348         widgetPalette.setColor(QPalette::Active, QPalette::HighlightedText, HbColorScheme::color("qtc_lineedit_selected"));
       
  3349         widgetPalette.setColor(QPalette::Active, QPalette::Text, HbColorScheme::color("qtc_lineedit_normal"));
       
  3350         //QTextEdits have specific graphic in QHbStyle for background
       
  3351         widgetPalette.setColor(QPalette::Active, QPalette::Base, Qt::transparent);
       
  3352     } else if (false
       
  3353 #ifndef QT_NO_LINEEDIT
       
  3354         || qobject_cast<QLineEdit *>(widget)
       
  3355 #endif
       
  3356         ) {
       
  3357         widgetPalette.setColor(QPalette::Active, QPalette::Highlight, HbColorScheme::color("qtc_lineedit_marker_normal"));
       
  3358         widgetPalette.setColor(QPalette::Active, QPalette::HighlightedText, HbColorScheme::color("qtc_lineedit_selected"));
       
  3359         widgetPalette.setColor(QPalette::Active, QPalette::Text, HbColorScheme::color("qtc_lineedit_normal"));
       
  3360     }
       
  3361     widget->setPalette(widgetPalette);
       
  3362 }
       
  3363 
  3290 QT_END_NAMESPACE
  3364 QT_END_NAMESPACE