summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qcleanlooksstyle.h2
-rw-r--r--src/gui/styles/qcommonstyle.cpp4
-rw-r--r--src/gui/styles/qcommonstyle.h2
-rw-r--r--src/gui/styles/qgtkstyle.h2
-rw-r--r--src/gui/styles/qmotifstyle.h2
-rw-r--r--src/gui/styles/qplastiquestyle.h2
-rw-r--r--src/gui/styles/qproxystyle.h2
-rw-r--r--src/gui/styles/qs60style.cpp22
-rw-r--r--src/gui/styles/qs60style.h2
-rw-r--r--src/gui/styles/qs60style_p.h2
-rw-r--r--src/gui/styles/qs60style_s60.cpp53
-rw-r--r--src/gui/styles/qstyle.h2
-rw-r--r--src/gui/styles/qstylesheetstyle_p.h2
-rw-r--r--src/gui/styles/qwindowsmobilestyle.h2
-rw-r--r--src/gui/styles/qwindowsstyle.h2
-rw-r--r--src/gui/styles/qwindowsvistastyle.h2
-rw-r--r--src/gui/styles/qwindowsxpstyle.h2
17 files changed, 62 insertions, 45 deletions
diff --git a/src/gui/styles/qcleanlooksstyle.h b/src/gui/styles/qcleanlooksstyle.h
index ebfb707..834f238 100644
--- a/src/gui/styles/qcleanlooksstyle.h
+++ b/src/gui/styles/qcleanlooksstyle.h
@@ -56,7 +56,7 @@ class QCleanlooksStylePrivate;
class Q_GUI_EXPORT QCleanlooksStyle : public QWindowsStyle
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QCleanlooksStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QCleanlooksStyle)
public:
QCleanlooksStyle();
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 7b8b75e..ba23499 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -3176,8 +3176,10 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
if (!d->isViewItemCached(*vopt)) {
d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false);
- if (d->cachedOption)
+ if (d->cachedOption) {
delete d->cachedOption;
+ d->cachedOption = 0;
+ }
d->cachedOption = new QStyleOptionViewItemV4(*vopt);
}
if (sr == SE_ViewItemCheckIndicator)
diff --git a/src/gui/styles/qcommonstyle.h b/src/gui/styles/qcommonstyle.h
index ce54a96..1f64fb3 100644
--- a/src/gui/styles/qcommonstyle.h
+++ b/src/gui/styles/qcommonstyle.h
@@ -98,7 +98,7 @@ protected:
QCommonStyle(QCommonStylePrivate &dd);
private:
- Q_DECLARE_PRIVATE(QCommonStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QCommonStyle)
Q_DISABLE_COPY(QCommonStyle)
};
diff --git a/src/gui/styles/qgtkstyle.h b/src/gui/styles/qgtkstyle.h
index e12f175..3feeafa 100644
--- a/src/gui/styles/qgtkstyle.h
+++ b/src/gui/styles/qgtkstyle.h
@@ -60,7 +60,7 @@ class QGtkStylePrivate;
class Q_GUI_EXPORT QGtkStyle : public QCleanlooksStyle
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QGtkStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QGtkStyle)
public:
QGtkStyle();
diff --git a/src/gui/styles/qmotifstyle.h b/src/gui/styles/qmotifstyle.h
index e848eb4..356f420 100644
--- a/src/gui/styles/qmotifstyle.h
+++ b/src/gui/styles/qmotifstyle.h
@@ -113,7 +113,7 @@ protected:
bool eventFilter(QObject *o, QEvent *e);
private:
- Q_DECLARE_PRIVATE(QMotifStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QMotifStyle)
Q_DISABLE_COPY(QMotifStyle)
bool highlightCols;
diff --git a/src/gui/styles/qplastiquestyle.h b/src/gui/styles/qplastiquestyle.h
index ac3da41..74560fc 100644
--- a/src/gui/styles/qplastiquestyle.h
+++ b/src/gui/styles/qplastiquestyle.h
@@ -56,7 +56,7 @@ class QPlastiqueStylePrivate;
class Q_GUI_EXPORT QPlastiqueStyle : public QWindowsStyle
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QPlastiqueStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QPlastiqueStyle)
public:
QPlastiqueStyle();
~QPlastiqueStyle();
diff --git a/src/gui/styles/qproxystyle.h b/src/gui/styles/qproxystyle.h
index c9edaff..33f252a 100644
--- a/src/gui/styles/qproxystyle.h
+++ b/src/gui/styles/qproxystyle.h
@@ -102,7 +102,7 @@ protected Q_SLOTS:
Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const;
private:
Q_DISABLE_COPY(QProxyStyle)
- Q_DECLARE_PRIVATE(QProxyStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QProxyStyle)
};
#endif // QT_NO_STYLE_PROXY
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index b083f4b..888a6ed 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -88,16 +88,16 @@ static const QByteArray propertyKeyCurrentlayout = "currentlayout";
const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
// *** generated layout data ***
-{240,320,1,14,true,QLatin1String("QVGA Landscape Mirrored")},
-{240,320,1,14,false,QLatin1String("QVGA Landscape")},
-{320,240,1,14,true,QLatin1String("QVGA Portrait Mirrored")},
-{320,240,1,14,false,QLatin1String("QVGA Portrait")},
-{360,640,1,14,true,QLatin1String("NHD Landscape Mirrored")},
-{360,640,1,14,false,QLatin1String("NHD Landscape")},
-{640,360,1,14,true,QLatin1String("NHD Portrait Mirrored")},
-{640,360,1,14,false,QLatin1String("NHD Portrait")},
-{352,800,1,12,true,QLatin1String("E90 Landscape Mirrored")},
-{352,800,1,12,false,QLatin1String("E90 Landscape")}
+{240,320,1,14,true,"QVGA Landscape Mirrored"},
+{240,320,1,14,false,"QVGA Landscape"},
+{320,240,1,14,true,"QVGA Portrait Mirrored"},
+{320,240,1,14,false,"QVGA Portrait"},
+{360,640,1,14,true,"NHD Landscape Mirrored"},
+{360,640,1,14,false,"NHD Landscape"},
+{640,360,1,14,true,"NHD Portrait Mirrored"},
+{640,360,1,14,false,"NHD Portrait"},
+{352,800,1,12,true,"E90 Landscape Mirrored"},
+{352,800,1,12,false,"E90 Landscape"}
// *** End of generated data ***
};
const int QS60StylePrivate::m_numberOfLayouts =
@@ -319,7 +319,7 @@ QVariant QS60StylePrivate::styleProperty(const char *name) const
static QStringList layouts;
if (layouts.isEmpty())
for (int i = 0; i < m_numberOfLayouts; i++)
- layouts.append(m_layoutHeaders[i].layoutName);
+ layouts.append(QLatin1String(m_layoutHeaders[i].layoutName));
return layouts;
}
return QVariant();
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
index d8e9a40..38d8e48 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -57,7 +57,7 @@ class QS60StylePrivate;
class Q_GUI_EXPORT QS60Style : public QCommonStyle
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QS60Style)
+ Q_DECLARE_SCOPED_PRIVATE(QS60Style)
public:
QS60Style();
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 7240978..2eb40de 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -75,7 +75,7 @@ typedef struct {
int major_version;
int minor_version;
bool mirroring; // TODO: (nice to have) Use Qt::LayoutDirection
- QString layoutName;
+ const char* layoutName;
} layoutHeader;
#ifdef Q_OS_SYMBIAN
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 63346da..8e9918e 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -106,10 +106,10 @@ public:
static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
private:
- static QPixmap createSkinnedGraphicsL(QS60StyleEnums::SkinParts part,
+ static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part,
const QSize &size, QS60StylePrivate::SkinElementFlags flags);
- static QPixmap createSkinnedGraphicsL(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
- static QPixmap colorSkinnedGraphicsL(const QS60StyleEnums::SkinParts &stylepart,
+ static QPixmap createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+ static QPixmap colorSkinnedGraphicsLX(const QS60StyleEnums::SkinParts &stylepart,
const QSize &size, QS60StylePrivate::SkinElementFlags flags);
static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID &centerId);
static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect);
@@ -336,10 +336,10 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics(
QS60StylePrivate::SkinElementFlags flags)
{
QPixmap themedImage;
- TRAPD( error, {
- const QPixmap skinnedImage = createSkinnedGraphicsL(stylepart, size, flags);
+ TRAPD( error, QT_TRYCATCH_LEAVING({
+ const QPixmap skinnedImage = createSkinnedGraphicsLX(stylepart, size, flags);
themedImage = skinnedImage;
- });
+ }));
if (error)
return themedImage = QPixmap();
return themedImage;
@@ -349,10 +349,10 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics(
QS60StylePrivate::SkinFrameElements frame, const QSize &size, QS60StylePrivate::SkinElementFlags flags)
{
QPixmap themedImage;
- TRAPD( error, {
- const QPixmap skinnedImage = createSkinnedGraphicsL(frame, size, flags);
+ TRAPD( error, QT_TRYCATCH_LEAVING({
+ const QPixmap skinnedImage = createSkinnedGraphicsLX(frame, size, flags);
themedImage = skinnedImage;
- });
+ }));
if (error)
return themedImage = QPixmap();
return themedImage;
@@ -363,7 +363,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics(
const QSize &size, QS60StylePrivate::SkinElementFlags flags)
{
QPixmap colorGraphics;
- TRAPD(error, colorGraphics = colorSkinnedGraphicsL(stylepart, size, flags));
+ TRAPD(error, QT_TRYCATCH_LEAVING(colorGraphics = colorSkinnedGraphicsLX(stylepart, size, flags)));
return error ? QPixmap() : colorGraphics;
}
@@ -521,10 +521,11 @@ void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &style
}
}
-QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsL(
+QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
const QS60StyleEnums::SkinParts &stylepart,
const QSize &size, QS60StylePrivate::SkinElementFlags flags)
{
+ // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
const int stylepartIndex = (int)stylepart;
const TAknsItemID skinId = m_partMap[stylepartIndex].skinID;
@@ -563,6 +564,13 @@ QColor QS60StyleModeSpecifics::colorValue(const TAknsItemID &colorGroup, int col
return QColor(skinnedColor.Red(),skinnedColor.Green(),skinnedColor.Blue());
}
+struct QAutoFbsBitmapHeapLock
+{
+ QAutoFbsBitmapHeapLock(CFbsBitmap* aBmp) : mBmp(aBmp) { mBmp->LockHeap(); }
+ ~QAutoFbsBitmapHeapLock() { mBmp->UnlockHeap(); }
+ CFbsBitmap* mBmp;
+};
+
QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format)
{
Q_ASSERT(icon);
@@ -589,13 +597,13 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask
if (mask) { //checkAndUnCompressBitmap might set mask to NULL
const TSize maskSize = icon->SizeInPixels();
const int maskBytesPerLine = CFbsBitmap::ScanLineLength(maskSize.iWidth, mask->DisplayMode());
- mask->LockHeap();
+ // heap lock object required because QImage ctor might throw
+ QAutoFbsBitmapHeapLock maskHeapLock(mask);
const uchar *const maskBytes = (uchar *)mask->DataAddress();
// Since no other bitmap should be locked, we can just "borrow" the mask data for setAlphaChannel
const QImage maskImage(maskBytes, maskSize.iWidth, maskSize.iHeight, maskBytesPerLine, QImage::Format_Indexed8);
if (!maskImage.isNull())
iconImage.setAlphaChannel(maskImage);
- mask->UnlockHeap();
}
}
@@ -631,10 +639,11 @@ QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
return QPoint(globalPos.iX, globalPos.iY);
}
-QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(
+QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
QS60StyleEnums::SkinParts part,
const QSize &size, QS60StylePrivate::SkinElementFlags flags)
{
+ // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
if (!size.isValid())
return QPixmap();
@@ -712,9 +721,10 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(
return result;
}
-QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFrameElements frameElement,
+QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement,
const QSize &size, QS60StylePrivate::SkinElementFlags flags)
{
+ // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
if (!size.isValid())
return QPixmap();
@@ -892,7 +902,10 @@ void QS60StyleModeSpecifics::checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitm
void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap)
{
- if (aOriginalBitmap->IsCompressedInRAM()) {
+ const TSize iconSize = aOriginalBitmap->SizeInPixels();
+ const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, aOriginalBitmap->DisplayMode());
+ const int iconBytesCount = iconBytesPerLine * iconSize.iHeight;
+ if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->DataSize() < iconBytesCount) {
const TSize iconSize(aOriginalBitmap->SizeInPixels().iWidth,
aOriginalBitmap->SizeInPixels().iHeight);
CFbsBitmap* uncompressedBitmap = new (ELeave) CFbsBitmap();
@@ -941,7 +954,7 @@ QFont QS60StylePrivate::s60Font_specific(
}
QFont result;
- TRAPD( error, {
+ TRAPD( error, QT_TRYCATCH_LEAVING({
const CAknLayoutFont* aknFont =
AknFontAccess::CreateLayoutFontFromSpecificationL(*dev, spec);
@@ -950,7 +963,7 @@ QFont QS60StylePrivate::s60Font_specific(
result.setPointSize(pointSize); // Correct the font size returned by CreateLayoutFontFromSpecificationL()
delete aknFont;
- });
+ }));
if (error) result = QFont();
return result;
}
@@ -1178,7 +1191,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap
User::Leave(KErrArgument);
// Note! aSrcBitmap->IsCompressedInRAM() is always ETrue, since this method is called only if that applies!
- ASSERT(aSrcBitmap->IsCompressedInRAM());
+ // Extra note! this function is also being used when bitmaps appear to be compressed (because DataSize is too small)
+ // even when they pretend they are not. Assert removed.
+// ASSERT(aSrcBitmap->IsCompressedInRAM());
TDisplayMode displayMode = aSrcBitmap->DisplayMode();
diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h
index d79c39c..61a4ed5 100644
--- a/src/gui/styles/qstyle.h
+++ b/src/gui/styles/qstyle.h
@@ -68,7 +68,7 @@ class QStylePrivate;
class Q_GUI_EXPORT QStyle : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QStyle)
protected:
QStyle(QStylePrivate &dd);
diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h
index 9b7b79d..399e449 100644
--- a/src/gui/styles/qstylesheetstyle_p.h
+++ b/src/gui/styles/qstylesheetstyle_p.h
@@ -182,7 +182,7 @@ public:
private:
Q_DISABLE_COPY(QStyleSheetStyle)
- Q_DECLARE_PRIVATE(QStyleSheetStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QStyleSheetStyle)
};
diff --git a/src/gui/styles/qwindowsmobilestyle.h b/src/gui/styles/qwindowsmobilestyle.h
index ab32e8e..9892dec 100644
--- a/src/gui/styles/qwindowsmobilestyle.h
+++ b/src/gui/styles/qwindowsmobilestyle.h
@@ -104,7 +104,7 @@ protected:
QWindowsMobileStyle(QWindowsMobileStylePrivate &dd);
private:
- Q_DECLARE_PRIVATE(QWindowsMobileStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QWindowsMobileStyle)
};
#endif // QT_NO_STYLE_WINDOWSMOBILE
diff --git a/src/gui/styles/qwindowsstyle.h b/src/gui/styles/qwindowsstyle.h
index c169a84..45260e8 100644
--- a/src/gui/styles/qwindowsstyle.h
+++ b/src/gui/styles/qwindowsstyle.h
@@ -98,7 +98,7 @@ protected:
private:
Q_DISABLE_COPY(QWindowsStyle)
- Q_DECLARE_PRIVATE(QWindowsStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QWindowsStyle)
void *reserved;
};
diff --git a/src/gui/styles/qwindowsvistastyle.h b/src/gui/styles/qwindowsvistastyle.h
index 97b1e74..60cd7a5 100644
--- a/src/gui/styles/qwindowsvistastyle.h
+++ b/src/gui/styles/qwindowsvistastyle.h
@@ -96,7 +96,7 @@ protected Q_SLOTS:
private:
Q_DISABLE_COPY(QWindowsVistaStyle)
- Q_DECLARE_PRIVATE(QWindowsVistaStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QWindowsVistaStyle)
friend class QStyleFactory;
};
#endif //QT_NO_STYLE_WINDOWSVISTA
diff --git a/src/gui/styles/qwindowsxpstyle.h b/src/gui/styles/qwindowsxpstyle.h
index ab26f56..21e24ff 100644
--- a/src/gui/styles/qwindowsxpstyle.h
+++ b/src/gui/styles/qwindowsxpstyle.h
@@ -93,7 +93,7 @@ protected Q_SLOTS:
private:
Q_DISABLE_COPY(QWindowsXPStyle)
- Q_DECLARE_PRIVATE(QWindowsXPStyle)
+ Q_DECLARE_SCOPED_PRIVATE(QWindowsXPStyle)
friend class QStyleFactory;
void *reserved;
};