Mercurial > projects > qtd
comparison tools/duic/d/dwriteinitialization.cpp @ 395:d757b8b1ca75
Fixed generation of palettes from Qt Designer files.
author | David Nadlinger <code@klickverbot.at> |
---|---|
date | Wed, 20 Oct 2010 09:45:59 +0200 |
parents | 4d17d96480db |
children |
comparison
equal
deleted
inserted
replaced
394:92be7d54716e | 395:d757b8b1ca75 |
---|---|
170 return true; | 170 return true; |
171 } | 171 } |
172 | 172 |
173 inline void openIfndef(QTextStream &str, const QString &symbol) { str << endl << QLatin1String("version(") << symbol << QLatin1String(") {} else {") << endl; } | 173 inline void openIfndef(QTextStream &str, const QString &symbol) { str << endl << QLatin1String("version(") << symbol << QLatin1String(") {} else {") << endl; } |
174 inline void closeIfdef(QTextStream &str, const QString &symbol) { str << QLatin1String("} // ") << symbol << endl << endl; } | 174 inline void closeIfdef(QTextStream &str, const QString &symbol) { str << QLatin1String("} // ") << symbol << endl << endl; } |
175 | 175 |
176 const char *accessibilityDefineC = "QT_NO_ACCESSIBILITY"; | 176 const char *accessibilityDefineC = "QT_NO_ACCESSIBILITY"; |
177 const char *toolTipDefineC = "QT_NO_TOOLTIP"; | 177 const char *toolTipDefineC = "QT_NO_TOOLTIP"; |
178 const char *whatsThisDefineC = "QT_NO_WHATSTHIS"; | 178 const char *whatsThisDefineC = "QT_NO_WHATSTHIS"; |
179 const char *statusTipDefineC = "QT_NO_STATUSTIP"; | 179 const char *statusTipDefineC = "QT_NO_STATUSTIP"; |
180 const char *shortcutDefineC = "QT_NO_SHORTCUT"; | 180 const char *shortcutDefineC = "QT_NO_SHORTCUT"; |
1191 propertyValue = pixCall(p); | 1191 propertyValue = pixCall(p); |
1192 break; | 1192 break; |
1193 case DomProperty::Palette: { | 1193 case DomProperty::Palette: { |
1194 const DomPalette *pal = p->elementPalette(); | 1194 const DomPalette *pal = p->elementPalette(); |
1195 const QString paletteName = m_driver->unique(QLatin1String("palette")); | 1195 const QString paletteName = m_driver->unique(QLatin1String("palette")); |
1196 m_output << m_option.indent << "QPalette " << paletteName << ";\n"; | 1196 m_output << m_option.indent << "auto " << paletteName << " = new QPalette;\n"; |
1197 | 1197 |
1198 writeColorGroup(pal->elementActive(), QLatin1String("QPalette.Active"), paletteName); | 1198 writeColorGroup(pal->elementActive(), QLatin1String("QPalette.Active"), paletteName); |
1199 writeColorGroup(pal->elementInactive(), QLatin1String("QPalette.Inactive"), paletteName); | 1199 writeColorGroup(pal->elementInactive(), QLatin1String("QPalette.Inactive"), paletteName); |
1200 writeColorGroup(pal->elementDisabled(), QLatin1String("QPalette.Disabled"), paletteName); | 1200 writeColorGroup(pal->elementDisabled(), QLatin1String("QPalette.Disabled"), paletteName); |
1201 | 1201 |
1351 propertyValue = writeBrushInitialization(p->elementBrush()); | 1351 propertyValue = writeBrushInitialization(p->elementBrush()); |
1352 break; | 1352 break; |
1353 case DomProperty::Unknown: | 1353 case DomProperty::Unknown: |
1354 break; | 1354 break; |
1355 } | 1355 } |
1356 | 1356 |
1357 propertyValue = propertyValue.replace("::", "."); // qtd | 1357 propertyValue = propertyValue.replace("::", "."); // qtd |
1358 | 1358 |
1359 if (propertyValue.size()) { | 1359 if (propertyValue.size()) { |
1360 const char* defineC = 0; | 1360 const char* defineC = 0; |
1361 if (propertyName == QLatin1String("toolTip")) | 1361 if (propertyName == QLatin1String("toolTip")) |
1533 } | 1533 } |
1534 | 1534 |
1535 QString WriteInitialization::domColor2QString(const DomColor *c) | 1535 QString WriteInitialization::domColor2QString(const DomColor *c) |
1536 { | 1536 { |
1537 if (c->hasAttributeAlpha()) | 1537 if (c->hasAttributeAlpha()) |
1538 return QString::fromLatin1("QColor(%1, %2, %3, %4)") | 1538 return QString::fromLatin1("new QColor(%1, %2, %3, %4)") |
1539 .arg(c->elementRed()) | 1539 .arg(c->elementRed()) |
1540 .arg(c->elementGreen()) | 1540 .arg(c->elementGreen()) |
1541 .arg(c->elementBlue()) | 1541 .arg(c->elementBlue()) |
1542 .arg(c->attributeAlpha()); | 1542 .arg(c->attributeAlpha()); |
1543 return QString::fromLatin1("QColor(%1, %2, %3)") | 1543 return QString::fromLatin1("new QColor(%1, %2, %3)") |
1544 .arg(c->elementRed()) | 1544 .arg(c->elementRed()) |
1545 .arg(c->elementGreen()) | 1545 .arg(c->elementGreen()) |
1546 .arg(c->elementBlue()); | 1546 .arg(c->elementBlue()); |
1547 } | 1547 } |
1548 | 1548 |
1649 const DomColor *color = stop->elementColor(); | 1649 const DomColor *color = stop->elementColor(); |
1650 m_output << m_option.indent << gradientName << ".setColorAt(" | 1650 m_output << m_option.indent << gradientName << ".setColorAt(" |
1651 << stop->attributePosition() << ", " | 1651 << stop->attributePosition() << ", " |
1652 << domColor2QString(color) << ");\n"; | 1652 << domColor2QString(color) << ");\n"; |
1653 } | 1653 } |
1654 m_output << m_option.indent << "QBrush " << brushName << '(' | 1654 m_output << m_option.indent << "auto " << brushName << "= new QBrush(" |
1655 << gradientName << ");\n"; | 1655 << gradientName << ");\n"; |
1656 } else if (style == QLatin1String("TexturePattern")) { | 1656 } else if (style == QLatin1String("TexturePattern")) { |
1657 const DomProperty *property = brush->elementTexture(); | 1657 const DomProperty *property = brush->elementTexture(); |
1658 const QString iconValue = iconCall(property); | 1658 const QString iconValue = iconCall(property); |
1659 | 1659 |
1660 m_output << m_option.indent << "QBrush " << brushName << " = QBrush(" | 1660 m_output << m_option.indent << "auto " << brushName << " = new QBrush(" |
1661 << iconValue << ");\n"; | 1661 << iconValue << ");\n"; |
1662 } else { | 1662 } else { |
1663 const DomColor *color = brush->elementColor(); | 1663 const DomColor *color = brush->elementColor(); |
1664 m_output << m_option.indent << "QBrush " << brushName << '(' | 1664 m_output << m_option.indent << "auto " << brushName << " = new QBrush(" |
1665 << domColor2QString(color) << ");\n"; | 1665 << domColor2QString(color) << ");\n"; |
1666 | 1666 |
1667 m_output << m_option.indent << brushName << ".setStyle(" | 1667 m_output << m_option.indent << brushName << ".setStyle(" |
1668 << "Qt." << style << ");\n"; | 1668 << "Qt." << style << ");\n"; |
1669 } | 1669 } |