summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qstylehelper.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-15 06:09:15 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-15 06:09:15 (GMT)
commit0a6d0d1d9aba54890908ec0ec02e066c060360c3 (patch)
tree1e484868f13b5453bbb7d171220317e7d6126d2a /src/gui/styles/qstylehelper.cpp
parent6100e83f3cbf40199da3078c1954a4dc1f77cb8f (diff)
parentb0f4dab4c825650c3a7a72b87508bf6f3e5ffd50 (diff)
downloadQt-0a6d0d1d9aba54890908ec0ec02e066c060360c3.zip
Qt-0a6d0d1d9aba54890908ec0ec02e066c060360c3.tar.gz
Qt-0a6d0d1d9aba54890908ec0ec02e066c060360c3.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Revert "More improvements to pixmap cache key generation" More improvements to pixmap cache key generation More 4.7 stuff. Fix for autotest failure in qwidget::saveRestoreGeometry() Optimized pixmapcache key generation for icons and styles doc: Another upgrade of the top page and overviews. Mac: restoreGeometry() [Regression] Build failure on Mac Carbon doc: Added some \briefs to how-to docs. Some 4.7 changes. Updated changelog. Cherry pick fix for MOBILITY-932 from Qt Mobility. Cherry pick fix for MOBILITY-962 from Qt Mobility. Cherry pick fix for MOBILITY-828 from Qt Mobility. Bearer management changes from Qt Mobility. Cherry pick fix for MOBILITY-828 from Qt Mobility. Added snippet labels to QML Dial example. Fixed documentation typo.
Diffstat (limited to 'src/gui/styles/qstylehelper.cpp')
-rw-r--r--src/gui/styles/qstylehelper.cpp74
1 files changed, 21 insertions, 53 deletions
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index 296c51c..22f2014 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -58,67 +58,35 @@
QT_BEGIN_NAMESPACE
-// internal helper. Converts an integer value to an unique string token
-template <typename T>
-struct HexString
-{
- inline HexString(const T t)
- : val(t)
- {}
-
- inline void write(QChar *&dest) const
- {
- const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
- const char *c = reinterpret_cast<const char *>(&val);
- for (uint i = 0; i < sizeof(T); ++i) {
- *dest++ = hexChars[*c & 0xf];
- *dest++ = hexChars[(*c & 0xf0) >> 4];
- ++c;
- }
- }
-
- const T val;
-};
-
-// specialization to enable fast concatenating of our string tokens to a string
-template <typename T>
-struct QConcatenable<HexString<T> >
-{
- typedef HexString<T> type;
- enum { ExactSize = true };
- static int size(const HexString<T> &str) { return sizeof(str.val) * 2; }
- static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
-};
-
namespace QStyleHelper {
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
{
const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
-
- QString tmp = key
- % QLatin1Char('-')
- % HexString<uint>(option->state)
- % QLatin1Char('-')
- % HexString<uint>(option->direction)
- % QLatin1Char('-')
- % HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
- % QLatin1Char('-')
- % HexString<quint64>(option->palette.cacheKey())
- % QLatin1Char('-')
- % HexString<uint>(size.width())
- % QLatin1Char('x')
- % HexString<uint>(size.height());
+ int digits = sizeof(qint64)/sizeof(QChar);
+ quint64 state = option->state,
+ direction = option->direction,
+ subcontrols = (complexOption ? uint(complexOption->activeSubControls) : 0u),
+ palettekey = option->palette.cacheKey(),
+ width = size.width(),
+ height = size.height();
+
+ QString tmp = key % QString::fromRawData((QChar*)&state, digits)
+ % QString::fromRawData((QChar*)&direction, digits)
+ % QString::fromRawData((QChar*)&subcontrols, digits)
+ % QString::fromRawData((QChar*)&palettekey, digits)
+ % QString::fromRawData((QChar*)&width, digits)
+ % QString::fromRawData((QChar*)&height, digits);
#ifndef QT_NO_SPINBOX
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- tmp = tmp
- % QLatin1Char('-')
- % HexString<uint>(spinBox->buttonSymbols)
- % QLatin1Char('-')
- % HexString<uint>(spinBox->stepEnabled)
- % QLatin1Char('-')
- % QLatin1Char(spinBox->frame ? '1' : '0');
+ quint64 buttonsymbols = spinBox->buttonSymbols,
+ stepEnabled = spinBox->stepEnabled,
+ frame = spinBox->frame;
+
+ tmp = tmp % QString::fromRawData((QChar*)&buttonsymbols, digits)
+ % QString::fromRawData((QChar*)&stepEnabled, digits)
+ % QString::fromRawData((QChar*)&frame, digits);
}
#endif // QT_NO_SPINBOX
return tmp;