diff options
author | Armin Berres <armin.berres@basyskom.de> | 2010-11-17 11:48:20 +0100 |
---|---|---|
committer | Armin Berres <armin.berres@basyskom.de> | 2010-11-17 16:43:41 +0100 |
commit | 2f0a9380a51496e002ed3079ec414bc012a02426 (patch) | |
tree | c74a9153700080b9b6fe58b30907a0b7df6afff2 | |
parent | 808adb0bccf7725e7a55826d8e97db29f77d530c (diff) |
Changes: remove boolean operations with the M::Orientation enum
RevBy: Kuisma Salonen
-rw-r--r-- | src/corelib/style/mstylesheetattribute.cpp | 14 | ||||
-rw-r--r-- | src/corelib/style/mstylesheetattribute.h | 6 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/corelib/style/mstylesheetattribute.cpp b/src/corelib/style/mstylesheetattribute.cpp index 6a1a104a..b8d7a833 100644 --- a/src/corelib/style/mstylesheetattribute.cpp +++ b/src/corelib/style/mstylesheetattribute.cpp @@ -584,7 +584,7 @@ bool MStyleSheetAttribute::writeAttribute(const QString &filename, bool conversionOK = false; // most types are the same in landscape and portrait - M::Orientation cacheOrientation = M::Orientation(M::Landscape | M::Portrait); + CacheOrientationFlags cacheOrientation = CacheOrientationFlags(PortraitFlag | LandscapeFlag); const char *attributeType = property.typeName(); if (attributeType == types[BOOL_TYPE]) { @@ -651,7 +651,7 @@ bool MStyleSheetAttribute::writeAttribute(const QString &filename, int width = attributeToInt(list[1], &conversionOK, WidthAttribute, orientation); int height = attributeToInt(list[2], &conversionOK, HeightAttribute, orientation); const QPixmap *pixmap = MTheme::pixmap(list[0], QSize(width, height)); - cacheOrientation = orientation; + cacheOrientation = (orientation == M::Portrait) ? PortraitFlag : LandscapeFlag; return fillProperty(property, style, cacheOrientation, qVariantFromValue(pixmap)); } //no parameters @@ -727,7 +727,7 @@ bool MStyleSheetAttribute::writeAttribute(const QString &filename, QList<QByteArray> list = value.split(' '); list.removeAll(""); if (list.size() == 2) { - cacheOrientation = orientation; + cacheOrientation = (orientation == M::Portrait) ? PortraitFlag : LandscapeFlag; if (attributeType == types[SIZE_TYPE]) { int width = attributeToInt(list[0], &conversionOK, WidthAttribute, orientation); int height = attributeToInt(list[1], &conversionOK, HeightAttribute, orientation); @@ -745,7 +745,7 @@ bool MStyleSheetAttribute::writeAttribute(const QString &filename, QList<QByteArray> list = value.split(' '); list.removeAll(""); if (list.size() == 2) { - cacheOrientation = orientation; + cacheOrientation = (orientation == M::Portrait) ? PortraitFlag : LandscapeFlag; if (attributeType == types[POINT_TYPE]) { int x = attributeToInt(list[0], &conversionOK, WidthAttribute, orientation); int y = attributeToInt(list[1], &conversionOK, HeightAttribute, orientation); @@ -832,15 +832,15 @@ bool MStyleSheetAttribute::writeAttribute(const QString &filename, return false; } -bool MStyleSheetAttribute::fillProperty(const QMetaProperty &property, MStyle *style, M::Orientation cacheOrientation, const QVariant &variant, bool cache) +bool MStyleSheetAttribute::fillProperty(const QMetaProperty &property, MStyle *style, CacheOrientationFlags cacheOrientation, const QVariant &variant, bool cache) { if (cache && variant.isValid()) { // most variants will be cahced in landscape and portrait. // this should not really increase memory usage as QVariants are implicitly shared - if (cacheOrientation & M::Portrait) { + if (cacheOrientation & PortraitFlag) { variantCache[M::Portrait][value][property.typeName()] = variant; } - if (cacheOrientation & M::Landscape) { + if (cacheOrientation & LandscapeFlag) { variantCache[M::Landscape][value][property.typeName()] = variant; } } diff --git a/src/corelib/style/mstylesheetattribute.h b/src/corelib/style/mstylesheetattribute.h index 374a1690..d4954062 100644 --- a/src/corelib/style/mstylesheetattribute.h +++ b/src/corelib/style/mstylesheetattribute.h @@ -72,7 +72,11 @@ private: // Fills a property with a variant and caches the variant if possible. // Pointer types cannot be cached as the ownership is transfered to the property. // Caching must be disabled for them. - bool fillProperty(const QMetaProperty &property, MStyle *style, M::Orientation cacheOrientation, + enum CacheOrientationFlags { + PortraitFlag = 1, + LandscapeFlag = 2 + }; + bool fillProperty(const QMetaProperty &property, MStyle *style, CacheOrientationFlags cacheOrientation, const QVariant &variant, bool cache = true); QByteArray name; |