summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qcssparser.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-05-11 10:35:53 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-05-11 10:35:53 (GMT)
commita2ccdc36d0e80f7274ed0551c819bedcddc2f4cc (patch)
tree55a19156916f0668770edcec8a479609963d1779 /src/gui/text/qcssparser.cpp
parent540092f4cc35238c258bb6422912d3eb18b26f33 (diff)
parent5299240db14579960358edeebfc72fcef905af13 (diff)
downloadQt-a2ccdc36d0e80f7274ed0551c819bedcddc2f4cc.zip
Qt-a2ccdc36d0e80f7274ed0551c819bedcddc2f4cc.tar.gz
Qt-a2ccdc36d0e80f7274ed0551c819bedcddc2f4cc.tar.bz2
Merge branch '4.5'
Diffstat (limited to 'src/gui/text/qcssparser.cpp')
-rw-r--r--src/gui/text/qcssparser.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index db1e781..8214e54 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -278,19 +278,15 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "xx-large", Value_XXLarge }
};
+//Map id to strings as they appears in the 'values' array above
+static const int indexOfId[NumKnownValues] = { 0, 40, 47, 41, 48, 53, 34, 26, 68, 69, 25, 42, 5, 62, 46,
+ 29, 57, 58, 27, 50, 60, 6, 10, 38, 55, 19, 13, 17, 18, 20, 21, 49, 24, 45, 65, 36, 3, 2, 39, 61, 16,
+ 11, 56, 14, 32, 63, 54, 64, 33, 67, 8, 28, 37, 12, 35, 59, 7, 9, 4, 66, 52, 22, 23, 30, 31, 1, 15, 0,
+ 51, 44, 43 };
+
QString Value::toString() const
{
- static int indexOfId[NumKnownValues - 1];
- static bool hasCachedIndexes = false;
-
if (type == KnownIdentifier) {
- if (!hasCachedIndexes) {
- for (int i = 0; i < NumKnownValues - 1; ++i)
- indexOfId[values[i].id] = i;
-
- hasCachedIndexes = true;
- }
-
return QLatin1String(values[indexOfId[variant.toInt()]].name);
} else {
return variant.toString();