diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-06-04 09:17:39 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-06-04 09:17:39 (GMT) |
commit | c244010c866cf1a80f1de7382a3b78e2eb0cb56b (patch) | |
tree | 25bf327848d50fcd9f890731da71cc57ea8009ce /src/gui/styles | |
parent | 1c9663c0eb592cb40dc6e51965d065a3c16e31c1 (diff) | |
download | Qt-c244010c866cf1a80f1de7382a3b78e2eb0cb56b.zip Qt-c244010c866cf1a80f1de7382a3b78e2eb0cb56b.tar.gz Qt-c244010c866cf1a80f1de7382a3b78e2eb0cb56b.tar.bz2 |
S60Style: Cleanup code before Tower release.
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 413 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 49 |
2 files changed, 229 insertions, 233 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index c8582eb..7db0992 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -145,7 +145,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme static const int frameElementsCount = int(sizeof(QS60StylePrivate::m_frameElementsData)/sizeof(QS60StylePrivate::m_frameElementsData[0])); -const int KNotFound = -1; +const int KNotFound = -909; QS60StylePrivate::~QS60StylePrivate() { @@ -290,8 +290,6 @@ short QS60StylePrivate::pixelMetric(int metric) { Q_ASSERT(metric < MAX_PIXELMETRICS); const short returnValue = m_pmPointer[metric]; - if (returnValue==-909) - return -1; return returnValue; } @@ -306,7 +304,6 @@ void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) QApplication::setLayoutDirection(m_layoutHeaders[layoutIndex].mirroring ? Qt::RightToLeft : Qt::LeftToRight); clearCaches(); refreshUI(); - return; } } @@ -559,11 +556,11 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start, QRect endRect; if (orientation == Qt::Horizontal) { - startRect.setWidth(qMin(rect.width() / 2 - 1, startRect.width())); + startRect.setWidth(qMin(rect.width() >>1 - 1, startRect.width())); endRect = startRect.translated(rect.width() - startRect.width(), 0); middleRect.adjust(startRect.width(), 0, -startRect.width(), 0); } else { - startRect.setHeight(qMin(rect.height() / 2 - 1, startRect.height())); + startRect.setHeight(qMin(rect.height() >>1 - 1, startRect.height())); endRect = startRect.translated(0, rect.height() - startRect.height()); middleRect.adjust(0, startRect.height(), 0, -startRect.height()); } @@ -691,20 +688,21 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker()); palette->setColor(QPalette::Highlight, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); + // set background image as a texture brush + palette->setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); // set these as transparent so that styled full screen theme background is visible palette->setColor(QPalette::AlternateBase, Qt::transparent); - palette->setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); - palette->setColor(QPalette::Base, Qt::transparent); + palette->setBrush(QPalette::Base, Qt::transparent); // set button and tooltipbase based on pixel colors const QColor buttonColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); palette->setColor(QPalette::Button, buttonColor ); + const QColor toolTipColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); + palette->setColor(QPalette::ToolTipBase, toolTipColor ); palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter()); palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker()); palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125)); palette->setColor(QPalette::Mid, palette->color(QPalette::Button).darker(150)); palette->setColor(QPalette::Shadow, Qt::black); - QColor toolTipColor = this->colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip); - palette->setColor(QPalette::ToolTipBase, toolTipColor ); setThemePaletteHash(palette); QS60StylePrivate::storeThemePalette(palette); @@ -728,6 +726,8 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const //store the original palette QPalette widgetPalette = *palette; + const QColor mainAreaTextColor = + QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0); widgetPalette.setColor(QPalette::All, QPalette::WindowText, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); @@ -735,20 +735,16 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const // return to original palette after each widget widgetPalette = *palette; - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor); + widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor); const QStyleOption opt; widgetPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt)); QApplication::setPalette(widgetPalette, "QPushButton"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor); + widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor); QApplication::setPalette(widgetPalette, "QToolButton"); widgetPalette = *palette; @@ -777,11 +773,10 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const QApplication::setPalette(widgetPalette, "QLineEdit"); widgetPalette = *palette; - const QColor color(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); - widgetPalette.setColor(QPalette::WindowText, color); + widgetPalette.setColor(QPalette::WindowText, mainAreaTextColor); widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); - widgetPalette.setColor(QPalette::Dark, color.darker()); - widgetPalette.setColor(QPalette::Light, color.lighter()); + widgetPalette.setColor(QPalette::Dark, mainAreaTextColor.darker()); + widgetPalette.setColor(QPalette::Light, mainAreaTextColor.lighter()); QApplication::setPalette(widgetPalette, "QDial"); widgetPalette = *palette; @@ -890,7 +885,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom horizontal ? QS60StylePrivate::SE_ScrollBarGrooveHorizontal : QS60StylePrivate::SE_ScrollBarGrooveVertical; QS60StylePrivate::drawSkinElement(grooveElement, painter, grooveRect, flags); - QStyle::SubControls subControls = optionSlider->subControls; + const QStyle::SubControls subControls = optionSlider->subControls; // select correct slider (horizontal/vertical/pressed) const bool sliderPressed = ((optionSlider->state & QStyle::State_Sunken) && (subControls & SC_ScrollBarSlider)); @@ -942,7 +937,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { const QRect cmbxEditField = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget); const QRect cmbxFrame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget); - const bool direction = cmb->direction == Qt::LeftToRight; // Button frame @@ -960,8 +954,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_FrameLineEdit; QS60StylePrivate::drawSkinElement(skinElement, painter, cmbxEditField, flags); + // Draw the combobox arrow if (sub & SC_ComboBoxArrow) { - // Draw the little arrow + // Make rect slightly smaller buttonOption.rect.adjust(1, 1, -1, -1); painter->save(); painter->setPen(option->palette.buttonText().color()); @@ -1102,14 +1097,13 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (spinBox->subControls & SC_SpinBoxUp) { copy.subControls = SC_SpinBoxUp; - QPalette pal2 = spinBox->palette; + QPalette spinBoxPal = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); + spinBoxPal.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; + copy.palette = spinBoxPal; } - copy.palette = pal2; - if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) { copy.state |= State_On; copy.state |= State_Sunken; @@ -1117,8 +1111,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom copy.state |= State_Raised; copy.state &= ~State_Sunken; } - pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus - : PE_IndicatorSpinUp); + pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ? + PE_IndicatorSpinPlus : + PE_IndicatorSpinUp; copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget); drawPrimitive(PE_PanelButtonBevel, ©, painter, widget); @@ -1129,12 +1124,12 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (spinBox->subControls & SC_SpinBoxDown) { copy.subControls = SC_SpinBoxDown; copy.state = spinBox->state; - QPalette pal2 = spinBox->palette; + QPalette spinBoxPal = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); + spinBoxPal.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; + copy.palette = spinBoxPal; } - copy.palette = pal2; if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) { copy.state |= State_On; @@ -1143,8 +1138,9 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom copy.state |= State_Raised; copy.state &= ~State_Sunken; } - pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus - : PE_IndicatorSpinDown); + pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ? + PE_IndicatorSpinMinus : + PE_IndicatorSpinDown; copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget); drawPrimitive(PE_PanelButtonBevel, ©, painter, widget); @@ -1352,13 +1348,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, // draw themed background for table unless background brush has been defined. if (vopt->backgroundBrush == Qt::NoBrush) { - // draw the background const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option); const QTableView *table = qobject_cast<const QTableView *>(widget); if (table && tableOption) { const QModelIndex index = tableOption->index; //todo: Draw cell background only once - for the first cell. - QStyleOptionViewItemV4 voptAdj2 = voptAdj2; + QStyleOptionViewItemV4 voptAdj2 = voptAdj; const QModelIndex indexFirst = table->model()->index(0,0); const QModelIndex indexLast = table->model()->index( table->model()->rowCount()-1,table->model()->columnCount()-1); @@ -1384,7 +1379,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, listView && (listView->selectionMode() == QAbstractItemView::SingleSelection || listView->selectionMode() == QAbstractItemView::NoSelection); - QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); + const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); if (voptAdj.state & QStyle::State_Selected && !singleSelection) { QStyleOptionViewItemV4 option(voptAdj); option.rect = selectionRect; @@ -1421,9 +1416,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option); if (isSelected) { if (qobject_cast<const QTableView *>(widget) && tableOption) - voptAdj.palette.setColor(QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); + voptAdj.palette.setColor( + QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); else - voptAdj.palette.setColor(QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); + voptAdj.palette.setColor( + QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); } painter->setPen(voptAdj.palette.text().color()); d->viewItemDrawText(painter, &voptAdj, textRect); @@ -1521,7 +1518,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } painter->save(); QFont f = painter->font(); - f.setPointSizeF(f.pointSizeF() * 0.72); + f.setPointSizeF(f.pointSizeF() * KTabFontMul); painter->setFont(f); if (option->state & QStyle::State_Selected){ @@ -1529,27 +1526,27 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 3, option)); } - bool verticalTabs = optionTab.shape == QTabBar::RoundedEast + const bool verticalTabs = optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::RoundedWest || optionTab.shape == QTabBar::TriangularEast || optionTab.shape == QTabBar::TriangularWest; - bool selected = optionTab.state & State_Selected; + const bool selected = optionTab.state & State_Selected; if (verticalTabs) { painter->save(); - int newX, newY, newRot; + int newX, newY, newRotation; if (optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::TriangularEast) { newX = tr.width(); newY = tr.y(); - newRot = 90; + newRotation = 90; } else { newX = 0; newY = tr.y() + tr.height(); - newRot = -90; + newRotation = -90; } tr.setRect(0, 0, tr.height(), tr.width()); QTransform m; m.translate(newX, newY); - m.rotate(newRot); + m.rotate(newRotation); painter->setTransform(m, true); } tr.adjust(0, 0, pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget), @@ -1571,9 +1568,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QPixmap tabIcon = optionTab.icon.pixmap(iconSize, (optionTab.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); if (tab->text.isEmpty()) - painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1), tr.center().y() - (tabIcon.height() >>1), tabIcon); + painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1), + tr.center().y() - (tabIcon.height() >>1), + tabIcon); else - painter->drawPixmap(tr.left() + tabOverlap, tr.center().y() - (tabIcon.height() >>1), tabIcon); + painter->drawPixmap(tr.left() + tabOverlap, + tr.center().y() - (tabIcon.height() >>1), + tabIcon); tr.setLeft(tr.left() + iconSize.width() + 4); } @@ -1583,13 +1584,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (optionTab.state & State_HasFocus) { const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); - const int x1 = optionTab.rect.left(); - const int x2 = optionTab.rect.right() - 1; + const int leftBorder = optionTab.rect.left(); + const int rightBorder = optionTab.rect.right() - 1; QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*tab); - fropt.rect.setRect(x1 + 1 + OFFSET, optionTab.rect.y() + OFFSET, - x2 - x1 - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); + fropt.rect.setRect(leftBorder + 1 + OFFSET, optionTab.rect.y() + OFFSET, + rightBorder - leftBorder - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } @@ -1639,25 +1640,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif // QT_NO_PROGRESSBAR -#ifndef QT_NO_MENUBAR -#endif //QT_NO_MENUBAR #ifndef QT_NO_MENU case CE_MenuItem: if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { QStyleOptionMenuItem optionMenuItem = *menuItem; - const bool enabled = optionMenuItem.state & State_Enabled; - const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; - - uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip - | Qt::TextSingleLine | Qt::AlignVCenter; - if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) - text_flags |= Qt::TextHideMnemonic; - - QRect iconRect = - subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); - QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); + bool drawSubMenuIndicator = false; - switch(menuItem->menuItemType) { case QStyleOptionMenuItem::Scroller: case QStyleOptionMenuItem::Separator: @@ -1668,20 +1656,29 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, default: break; } + const bool enabled = optionMenuItem.state & State_Enabled; + const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; + + uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip + | Qt::TextSingleLine | Qt::AlignVCenter; + if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) + text_flags |= Qt::TextHideMnemonic; + + QRect iconRect = + subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); + QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); if ((option->state & State_Selected) && (option->state & State_Enabled)) QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); //todo: move the vertical spacing stuff into subElementRect const int vSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing); - QStyleOptionMenuItem optionCheckBox; if (checkable){ - QRect checkBoxRect = optionMenuItem.rect; - checkBoxRect.setWidth(pixelMetric(PM_IndicatorWidth)); - checkBoxRect.setHeight(pixelMetric(PM_IndicatorHeight)); + QStyleOptionMenuItem optionCheckBox; optionCheckBox.QStyleOption::operator=(*menuItem); - optionCheckBox.rect = checkBoxRect; - const int moveByX = checkBoxRect.width()+vSpacing; + optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); + optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); + const int moveByX = optionCheckBox.rect.width()+vSpacing; if (optionMenuItem.direction == Qt::LeftToRight) { textRect.translate(moveByX,0); iconRect.translate(moveByX, 0); @@ -1732,20 +1729,18 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, optionMenuItem.palette.color(QPalette::Disabled, QPalette::Text))); painter->save(); painter->setOpacity(0.5); - QCommonStyle::drawItemText(painter, textRect, text_flags, + } + QCommonStyle::drawItemText(painter, textRect, text_flags, optionMenuItem.palette, enabled, optionMenuItem.text, QPalette::Text); + if (!enabled) painter->restore(); - } else { - QCommonStyle::drawItemText(painter, textRect, text_flags, - optionMenuItem.palette, enabled, - optionMenuItem.text, QPalette::Text); - } } break; + case CE_MenuEmptyArea: + break; #endif //QT_NO_MENU - case CE_MenuEmptyArea: #ifndef QT_NO_MENUBAR case CE_MenuBarEmptyArea: break; @@ -1775,19 +1770,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_HeaderEmptyArea: { QS60StylePrivate::SkinElementFlags adjFlags = flags; - QRect mtyRect = option->rect; + QRect emptyAreaRect = option->rect; if (option->state & QStyle::State_Horizontal) { - mtyRect.adjust(-2,-2,2,-2); + emptyAreaRect.adjust(-2,-2,2,-2); } else { if ( option->direction == Qt::LeftToRight ) { - mtyRect.adjust(-2,-2,0,2); + emptyAreaRect.adjust(-2,-2,0,2); adjFlags |= QS60StylePrivate::SF_PointWest; } else { - mtyRect.adjust(2,2,0,-2); + emptyAreaRect.adjust(2,2,0,-2); adjFlags |= QS60StylePrivate::SF_PointEast; } } - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, mtyRect, adjFlags); + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, emptyAreaRect, adjFlags); } break; case CE_Header: @@ -1807,7 +1802,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } } QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, mtyRect, adjFlags); - QCommonStyle::drawControl(element, header, painter, widget); + + QRegion clipRegion = painter->clipRegion(); + painter->setClipRect(option->rect); + drawControl(CE_HeaderSection, header, painter, widget); + QStyleOptionHeader subopt = *header; + subopt.rect = subElementRect(SE_HeaderLabel, header, widget); + if (subopt.rect.isValid()) + drawControl(CE_HeaderLabel, &subopt, painter, widget); + if (header->sortIndicator != QStyleOptionHeader::None) { + subopt.rect = subElementRect(SE_HeaderArrow, option, widget); + drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget); + } + painter->setClipRegion(clipRegion); } break; #ifndef QT_NO_TOOLBAR @@ -1815,6 +1822,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) { const QToolBar *tbWidget = qobject_cast<const QToolBar *>(widget); + //toolbar within a toolbar, skip if (!tbWidget || (widget && qobject_cast<QToolBar *>(widget->parentWidget()))) break; @@ -1890,6 +1898,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } break; case PE_IndicatorViewItemCheck: +#ifndef QT_NO_ITEMVIEWS if (const QListView *listItem = (qobject_cast<const QListView *>(widget))) { if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { const bool checkBoxVisible = vopt->features & QStyleOptionViewItemV2::HasCheckIndicator; @@ -1910,9 +1919,9 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } } } +#endif //QT_NO_ITEMVIEWS break; - case PE_IndicatorRadioButton: - { + case PE_IndicatorRadioButton: { QRect buttonRect = option->rect; //there is empty (a. 33%) space in svg graphics for radiobutton const qreal reduceWidth = (qreal)buttonRect.width()/3.0; @@ -1935,8 +1944,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_PanelButtonCommand: case PE_PanelButtonTool: case PE_PanelButtonBevel: - case PE_FrameButtonBevel: - { + case PE_FrameButtonBevel: { const bool isPressed = option->state & QStyle::State_Sunken; const QS60StylePrivate::SkinElements skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; @@ -1947,8 +1955,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_IndicatorArrowDown: case PE_IndicatorArrowLeft: case PE_IndicatorArrowRight: - case PE_IndicatorArrowUp: - { + case PE_IndicatorArrowUp: { QS60StyleEnums::SkinParts skinPart; if (element==PE_IndicatorArrowDown) skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowDown; @@ -2003,6 +2010,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; #endif //QT_NO_SPINBOX case PE_FrameFocusRect: +// Calendar widget and combox both do not use styled itemDelegate +#if not defined (QT_NO_CALENDARWIDGET) && not defined (QT_NO_COMBOBOX) if (!(widget && qobject_cast<const QCalendarWidget *>(widget->parent())) || qobject_cast<const QComboBoxListView *>(widget)) { // no focus selection for touch @@ -2031,13 +2040,19 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti painter->restore(); } } +#endif //!QT_NO_CALENDARWIDGET && !QT_NO_COMBOBOX break; case PE_Widget: - if (QS60StylePrivate::drawsOwnThemeBackground(widget) || - qobject_cast<const QComboBoxListView *>(widget) || - qobject_cast<const QMenu *> (widget)) { - QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu; - QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); + if (QS60StylePrivate::drawsOwnThemeBackground(widget) +#ifndef QT_NO_COMBOBOX + || qobject_cast<const QComboBoxListView *>(widget) +#endif //QT_NO_COMBOBOX +#ifndef QT_NO_MENU + || qobject_cast<const QMenu *> (widget) +#endif //QT_NO_MENU + ) { + QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu; + QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); } break; case PE_FrameWindow: @@ -2103,8 +2118,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; //disable frame in menu case PE_IndicatorBranch: - { #if defined(Q_WS_S60) + // 3.1 AVKON UI does not have tree view component, use common style for drawing there if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1) { #else if (true) { @@ -2146,7 +2161,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags); } } - } break; // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases @@ -2179,9 +2193,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } } -/*! - \reimp -*/ +/*! \reimp */ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { int metricValue = QS60StylePrivate::pixelMetric(metric); @@ -2197,6 +2209,7 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const } return metricValue; } + /*! \reimp */ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const @@ -2219,22 +2232,19 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, } return sz; } + /*! \reimp */ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *hret) const { int retValue = -1; switch (sh) { - case SH_Table_GridLineColor: { - QColor lineColor = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0); - retValue = lineColor.rgb(); - } - break; - case SH_GroupBox_TextLabelColor: { - QColor groupBoxTxtColor = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0); - retValue = groupBoxTxtColor.rgb(); - } - break; + case SH_Table_GridLineColor: + retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0).rgb(); + break; + case SH_GroupBox_TextLabelColor: + retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0).rgb(); + break; case SH_ScrollBar_ScrollWhenPointerLeavesControl: retValue = true; break; @@ -2260,10 +2270,7 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w return retValue; } - -/*! - \reimp -*/ +/*! \reimp */ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget) const { QRect ret; @@ -2298,35 +2305,33 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple scrollbarOption->upsideDown); switch (scontrol) { - case SC_ScrollBarSubLine: // top/left button - case SC_ScrollBarAddLine: // bottom/right button - break; - case SC_ScrollBarSubPage: // between top/left button and slider - if (isHorizontal) - ret.setRect(0, 0, sliderstart, scrollBarRect.height()); - else - ret.setRect(0, 0, scrollBarRect.width(), sliderstart); - break; - case SC_ScrollBarAddPage: // between bottom/right button and slider - { + case SC_ScrollBarSubPage: // between top/left button and slider + if (isHorizontal) + ret.setRect(0, 0, sliderstart, scrollBarRect.height()); + else + ret.setRect(0, 0, scrollBarRect.width(), sliderstart); + break; + case SC_ScrollBarAddPage: { // between bottom/right button and slider const int addPageLength = sliderstart + sliderlen; if (isHorizontal) ret = scrollBarRect.adjusted(addPageLength, 0, 0, 0); else ret = scrollBarRect.adjusted(0, addPageLength, 0, 0); - } - break; - case SC_ScrollBarGroove: - ret = scrollBarRect; - break; - case SC_ScrollBarSlider: - if (scrollbarOption->orientation == Qt::Horizontal) - ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); - else - ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); - break; - default: - break; + } + break; + case SC_ScrollBarGroove: + ret = scrollBarRect; + break; + case SC_ScrollBarSlider: + if (scrollbarOption->orientation == Qt::Horizontal) + ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); + else + ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); + break; + case SC_ScrollBarSubLine: // top/left button + case SC_ScrollBarAddLine: // bottom/right button + default: + break; } ret = visualRect(scrollbarOption->direction, scrollBarRect, ret); } @@ -2344,37 +2349,37 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple const int y = frameThickness + spinbox->rect.y(); const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2*buttonSize.width(); - + switch (scontrol) { - case SC_SpinBoxUp: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - return QRect(); - ret = QRect(x, y, buttonWidth, buttonSize.height()); - break; - case SC_SpinBoxDown: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - return QRect(); - ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height()); - break; - case SC_SpinBoxEditField: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - ret = QRect( - frameThickness, - frameThickness, - spinbox->rect.width() - 2*frameThickness, - spinbox->rect.height() - 2*frameThickness); - else - ret = QRect( - frameThickness, - frameThickness, - x - frameThickness, - spinbox->rect.height() - 2*frameThickness); - break; - case SC_SpinBoxFrame: - ret = spinbox->rect; - break; - default: - break; + case SC_SpinBoxUp: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + return QRect(); + ret = QRect(x, y, buttonWidth, buttonSize.height()); + break; + case SC_SpinBoxDown: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + return QRect(); + ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height()); + break; + case SC_SpinBoxEditField: + if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) + ret = QRect( + frameThickness, + frameThickness, + spinbox->rect.width() - 2*frameThickness, + spinbox->rect.height() - 2*frameThickness); + else + ret = QRect( + frameThickness, + frameThickness, + x - frameThickness, + spinbox->rect.height() - 2*frameThickness); + break; + case SC_SpinBoxFrame: + ret = spinbox->rect; + break; + default: + break; } ret = visualRect(spinbox->direction, spinbox->rect, ret); } @@ -2388,7 +2393,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple // lets use spinbox frame here as well, as no combobox specific value available. const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0; const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize); - int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth; + const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth; const int ypos = cmb->rect.y(); QSize buttonSize; @@ -2417,26 +2422,26 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { ret = QCommonStyle::subControlRect(control, option, scontrol, widget); switch (scontrol) { - case SC_GroupBoxCheckBox: //fallthrough - case SC_GroupBoxLabel: { - //slightly indent text and boxes, so that dialog border does not mess with them. - const int horizontalSpacing = - QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); - ret.adjust(2,horizontalSpacing-3,0,0); - } - break; - case SC_GroupBoxFrame: { - const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget); - const int tbHeight = textBox.height(); - ret.translate(0, -ret.y()); - // include title to within the groupBox frame - ret.setHeight(ret.height()+tbHeight); - if (widget && ret.bottom() > widget->rect().bottom()) - ret.setBottom(widget->rect().bottom()); - } - break; - default: - break; + case SC_GroupBoxCheckBox: //fallthrough + case SC_GroupBoxLabel: { + //slightly indent text and boxes, so that dialog border does not mess with them. + const int horizontalSpacing = + QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + ret.adjust(2,horizontalSpacing-3,0,0); + } + break; + case SC_GroupBoxFrame: { + const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget); + const int tbHeight = textBox.height(); + ret.translate(0, -ret.y()); + // include title to within the groupBox frame + ret.setHeight(ret.height()+tbHeight); + if (widget && ret.bottom() > widget->rect().bottom()) + ret.setBottom(widget->rect().bottom()); + } + break; + default: + break; } } break; @@ -2454,7 +2459,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // in S60 the input text box doesn't start from line Edit's TL, but // a bit indented. QRect lineEditRect = opt->rect; - int adjustment = opt->rect.height()>>2; + const int adjustment = opt->rect.height()>>2; lineEditRect.adjust(adjustment,0,0,0); ret = lineEditRect; } @@ -2526,7 +2531,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } } else if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; - int indicatorWidth = checkable ? + const int indicatorWidth = checkable ? pixelMetric(PM_ListViewIconSize, opt, widget) : pixelMetric(PM_SmallIconSize, opt, widget); ret = menuItem->rect; @@ -2546,11 +2551,10 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // Make room for submenu indicator if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu){ // submenu indicator is very small, so lets halve the rect - indicatorWidth = indicatorWidth >> 1; if (menuItem->direction == Qt::LeftToRight) - ret.adjust(0,0,-indicatorWidth,0); + ret.adjust(0,0,-(indicatorWidth >> 1),0); else - ret.adjust(indicatorWidth,0,0,0); + ret.adjust((indicatorWidth >> 1),0,0,0); } } } @@ -2579,7 +2583,9 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con // Move rect and make it slightly smaller, so that // a) highlight border does not cross the rect // b) in s60 list checkbox is smaller than normal checkbox - ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset, indicatorWidth-3, indicatorHeight-3); + //todo; magic three + ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset, + indicatorWidth-3, indicatorHeight-3); } else { ret.setRect(opt->rect.right() - indicatorWidth - spacing, opt->rect.top() + heightOffset, indicatorWidth, indicatorHeight); @@ -2654,9 +2660,8 @@ void QS60Style::unpolish(QWidget *widget) #ifndef QT_NO_SCROLLBAR || qobject_cast<QScrollBar *>(widget) #endif - ) { + ) widget->setAttribute(Qt::WA_OpaquePaintEvent); - } if (QS60StylePrivate::drawsOwnThemeBackground(widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); @@ -2674,9 +2679,8 @@ void QS60Style::unpolish(QWidget *widget) widget->setAttribute(Qt::WA_StyledBackground, false); } - if (widget) { + if (widget) widget->setPalette(QPalette()); - } QCommonStyle::unpolish(widget); } @@ -2690,7 +2694,6 @@ void QS60Style::polish(QApplication *application) void QS60Style::unpolish(QApplication *application) { - Q_UNUSED(application) Q_D(QS60Style); const QPalette newPalette = QApplication::style()->standardPalette(); application->setPalette(newPalette); @@ -2717,7 +2720,9 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, QS60StyleEnums::SkinParts part; QS60StylePrivate::SkinElementFlags adjustedFlags; if (option) - adjustedFlags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; + adjustedFlags = (option->state & State_Enabled) ? + QS60StylePrivate::SF_StateEnabled : + QS60StylePrivate::SF_StateDisabled; switch(standardIcon) { case QStyle::SP_MessageBoxWarning: diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 55e80b9..dbb98c5 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -77,8 +77,10 @@ enum TSupportRelease { ES60_3_1 = 0x0001, ES60_3_2 = 0x0002, ES60_5_0 = 0x0004, + ES60_5_1 = 0x0008, + ES60_5_2 = 0x0010, // Add all new releases here - ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 + ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 }; typedef struct { @@ -89,17 +91,6 @@ typedef struct { int newMinorSkinId; } partMapEntry; -enum TFallbackMbmFile { - EAvkonMbm = 0, - ELastMbm -}; - -typedef struct { - const QS60StyleEnums::SkinParts partID; - TFallbackMbmFile fallbackFileID; //to avoid putting large char strings to table, lets only have a mapping value - int fallbackGraphicID; -} fallbackMapEntry; - class QS60StyleModeSpecifics { public: @@ -644,7 +635,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( Q_ASSERT(drawType != ENoDraw); const bool rotatedBy90or270 = (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest)); - TSize targetSize = + const TSize targetSize = rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size); MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); @@ -719,7 +710,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFra const bool rotatedBy90or270 = (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest)); - TSize targetSize = + const TSize targetSize = rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size); MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); @@ -901,7 +892,7 @@ void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBit QFont QS60StylePrivate::s60Font_specific( QS60StyleEnums::FontCategories fontCategory, int pointSize) { - enum TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; + TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; switch (fontCategory) { case QS60StyleEnums::FC_Primary: aknFontCategory = EAknFontCategoryPrimary; @@ -1176,8 +1167,8 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap if (displayMode != aTrgBitmap->DisplayMode()) User::Leave(KErrArgument); - TSize trgSize = aTrgBitmap->SizeInPixels(); - TSize srcSize = aSrcBitmap->SizeInPixels(); + const TSize trgSize = aTrgBitmap->SizeInPixels(); + const TSize srcSize = aSrcBitmap->SizeInPixels(); // calculate the valid drawing area TRect drawRect = aTrgRect; @@ -1213,14 +1204,14 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap const TInt drawWidth = drawRect.Width(); const TInt drawHeight = drawRect.Height(); - TRect offsetRect(aTrgRect.iTl, drawRect.iTl); + const TRect offsetRect(aTrgRect.iTl, drawRect.iTl); const TInt yPosOffset = ySkip * offsetRect.Height(); const TInt xPosOffset = xSkip * offsetRect.Width(); if ((displayMode == EGray256) || (displayMode == EColor256)) { - TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode); - TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode); TUint8* trgAddress8 = reinterpret_cast<TUint8*> (trgAddress); @@ -1230,7 +1221,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress8 += trgScanLen8 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint8* srcAddress8 = reinterpret_cast<TUint8*> (srcAddress) + const TUint8* srcAddress8 = reinterpret_cast<const TUint8*> (srcAddress) + (srcScanLen8 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1244,9 +1235,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress8 += trgScanLen8 - drawWidth; } } else if (displayMode == EColor4K || displayMode == EColor64K) { - TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode) >>1; - TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode) >>1; TUint16* trgAddress16 = reinterpret_cast<TUint16*> (trgAddress); @@ -1256,7 +1247,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress16 += trgScanLen16 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint16* srcAddress16 = reinterpret_cast<TUint16*> (srcAddress) + const TUint16* srcAddress16 = reinterpret_cast<const TUint16*> (srcAddress) + (srcScanLen16 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1270,9 +1261,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress16 += trgScanLen16 - drawWidth; } } else if (displayMode == EColor16MU || displayMode == EColor16MA) { - TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth, + const TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth, displayMode) >>2; - TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth, + const TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth, displayMode) >>2; TUint32* trgAddress32 = reinterpret_cast<TUint32*> (trgAddress); @@ -1282,7 +1273,7 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap trgAddress32 += trgScanLen32 * drawRect.iTl.iY + drawRect.iTl.iX; for (TInt y = 0; y < drawHeight; y++) { - TUint32* srcAddress32 = reinterpret_cast<TUint32*> (srcAddress) + const TUint32* srcAddress32 = reinterpret_cast<const TUint32*> (srcAddress) + (srcScanLen32 * (yPos >> 8)); TInt xPos = xPosOffset; @@ -1302,8 +1293,8 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap QSize QS60StylePrivate::screenSize() { - TSize mySize = QS60Data::screenDevice()->SizeInPixels(); - return QSize(mySize.iWidth, mySize.iHeight); + const TSize screenSize = QS60Data::screenDevice()->SizeInPixels(); + return QSize(screenSize.iWidth, screenSize.iHeight); } void QS60StyleModeSpecifics::colorGroupAndIndex( |