diff options
author | Sami Merila <sami.merila@nokia.com> | 2010-03-22 12:59:25 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2010-03-22 12:59:25 (GMT) |
commit | 669c8042fa78c539cdefec87c85bce91e561871d (patch) | |
tree | 5c5efb279a4205b0304dd50d98296dee10005bc0 /src/gui/styles | |
parent | 6da8cec6042823da5622d048bb66ca7c40aed9b3 (diff) | |
download | Qt-669c8042fa78c539cdefec87c85bce91e561871d.zip Qt-669c8042fa78c539cdefec87c85bce91e561871d.tar.gz Qt-669c8042fa78c539cdefec87c85bce91e561871d.tar.bz2 |
Custom pixel metric values cannot be inquired from outside the class
This is due that
a) custom values are internal and not exposed
b) values use different format - they are indexes for internal data[]
table and not according to QStyle documentation for pixel metrics.
Task-number: QTBUG-9247
Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 7 | ||||
-rw-r--r-- | src/gui/styles/qs60style.h | 9 | ||||
-rw-r--r-- | src/gui/styles/qs60style_p.h | 3 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 750e19f..ed2074a 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -307,6 +307,13 @@ void QS60StylePrivate::drawSkinPart(QS60StyleEnums::SkinParts part, short QS60StylePrivate::pixelMetric(int metric) { + //If it is a custom value, need to strip away the base to map to internal + //pixel metric value table + if (metric & QStyle::PM_CustomBase) { + metric -= QStyle::PM_CustomBase; + metric += MAX_NON_CUSTOM_PIXELMETRICS - 1; + } + Q_ASSERT(metric < MAX_PIXELMETRICS); const short returnValue = m_pmPointer[metric]; return returnValue; diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index 82cc21c..af17843 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -52,6 +52,15 @@ QT_MODULE(Gui) #if !defined(QT_NO_STYLE_S60) +//Public custom pixel metrics values. +//These can be used to fetch custom pixel metric value from outside QS60Style. +enum { + PM_FrameCornerWidth = QStyle::PM_CustomBase + 1, + PM_FrameCornerHeight, + PM_BoldLineWidth, + PM_ThinLineWidth + }; + class QS60StylePrivate; class Q_GUI_EXPORT QS60Style : public QCommonStyle diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 16d82e7..84f50ea 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -61,12 +61,15 @@ QT_BEGIN_NAMESPACE const int MAX_NON_CUSTOM_PIXELMETRICS = 92; const int CUSTOMVALUESCOUNT = 4; + +//internal custom pixel metrics values, these map to entry in data[] table enum { PM_Custom_FrameCornerWidth = MAX_NON_CUSTOM_PIXELMETRICS, PM_Custom_FrameCornerHeight, PM_Custom_BoldLineWidth, PM_Custom_ThinLineWidth }; + const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT; typedef struct { |