summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qs60style.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r--src/gui/styles/qs60style.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index f8cf885..5026d5c 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -350,14 +350,24 @@ QFont QS60StylePrivate::s60Font(
return result;
}
-//todo: you could pass a reason to clear cache here, so that we could
-// deduce whether or not the specific cache needs to be cleared
-void QS60StylePrivate::clearCaches()
+void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason)
{
- m_colorCache.clear();
- m_mappedFontsCache.clear();
- QPixmapCache::clear();
- m_backgroundValid = false;
+ switch(reason){
+ case CC_LayoutChange:
+ // when layout changes, the colors remain in cache
+ m_mappedFontsCache.clear(); //todo: can font change, when layout changes?
+ m_backgroundValid = false;
+ QPixmapCache::clear();
+ break;
+ case CC_ThemeChange: //todo: can font change when theme changes?
+ case CC_UndefinedChange:
+ default:
+ m_colorCache.clear();
+ m_mappedFontsCache.clear();
+ QPixmapCache::clear();
+ m_backgroundValid = false;
+ break;
+ }
}
// Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use
@@ -381,7 +391,6 @@ QColor QS60StylePrivate::colorFromFrameGraphics(QS60StylePrivate::SkinFrameEleme
const int pixels = frameImage.numBytes()/sizeof(QRgb);
const int bytesPerLine = frameImage.bytesPerLine();
Q_ASSERT(bytesPerLine);
- const int rows = frameImage.numBytes()/(sizeof(QRgb)*bytesPerLine);
int estimatedRed = 0;
int estimatedGreen = 0;
@@ -761,8 +770,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled;
SubControls sub = option->subControls;
- Q_D(const QS60Style);
-
switch (control) {
#ifndef QT_NO_SCROLLBAR
case CC_ScrollBar:
@@ -2413,7 +2420,6 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
//slightly indent text and boxes, so that dialog border does not mess with them.
const int horizontalSpacing =
QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
- const int bottomMargin = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutBottomMargin);
ret.adjust(2,horizontalSpacing-3,0,0);
break;
case SC_GroupBoxFrame: {
@@ -2518,13 +2524,10 @@ 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;
- const bool subMenu = menuItem->menuItemType == QStyleOptionMenuItem::SubMenu;
int indicatorWidth = checkable ?
pixelMetric(PM_ListViewIconSize, opt, widget) :
pixelMetric(PM_SmallIconSize, opt, widget);
ret = menuItem->rect;
- const int verticalSpacing =
- QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing);
if (element == SE_ItemViewItemDecoration) {
if (menuItem->direction == Qt::RightToLeft)