changeset 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 92be7d54716e
children d0a103f25091 e67ce7c21758
files tools/duic/d/dwriteinitialization.cpp
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/tools/duic/d/dwriteinitialization.cpp	Sat Aug 28 03:15:31 2010 +0200
+++ b/tools/duic/d/dwriteinitialization.cpp	Wed Oct 20 09:45:59 2010 +0200
@@ -172,7 +172,7 @@
 
     inline void openIfndef(QTextStream &str, const QString &symbol)  { str << endl << QLatin1String("version(") << symbol << QLatin1String(") {} else {") << endl;  }
     inline void closeIfdef(QTextStream &str, const QString &symbol) { str << QLatin1String("} // ") << symbol << endl << endl; }
-    
+
     const char *accessibilityDefineC = "QT_NO_ACCESSIBILITY";
     const char *toolTipDefineC = "QT_NO_TOOLTIP";
     const char *whatsThisDefineC = "QT_NO_WHATSTHIS";
@@ -1193,7 +1193,7 @@
         case DomProperty::Palette: {
             const DomPalette *pal = p->elementPalette();
             const QString paletteName = m_driver->unique(QLatin1String("palette"));
-            m_output << m_option.indent << "QPalette " << paletteName << ";\n";
+            m_output << m_option.indent << "auto " << paletteName << " = new QPalette;\n";
 
             writeColorGroup(pal->elementActive(), QLatin1String("QPalette.Active"), paletteName);
             writeColorGroup(pal->elementInactive(), QLatin1String("QPalette.Inactive"), paletteName);
@@ -1353,7 +1353,7 @@
         case DomProperty::Unknown:
             break;
         }
-        
+
         propertyValue = propertyValue.replace("::", "."); // qtd
 
         if (propertyValue.size()) {
@@ -1535,12 +1535,12 @@
 QString WriteInitialization::domColor2QString(const DomColor *c)
 {
     if (c->hasAttributeAlpha())
-        return QString::fromLatin1("QColor(%1, %2, %3, %4)")
+        return QString::fromLatin1("new QColor(%1, %2, %3, %4)")
             .arg(c->elementRed())
             .arg(c->elementGreen())
             .arg(c->elementBlue())
             .arg(c->attributeAlpha());
-    return QString::fromLatin1("QColor(%1, %2, %3)")
+    return QString::fromLatin1("new QColor(%1, %2, %3)")
         .arg(c->elementRed())
         .arg(c->elementGreen())
         .arg(c->elementBlue());
@@ -1651,17 +1651,17 @@
                 << stop->attributePosition() << ", "
                 << domColor2QString(color) << ");\n";
         }
-        m_output << m_option.indent << "QBrush " << brushName << '('
+        m_output << m_option.indent << "auto " << brushName << "= new QBrush("
             << gradientName << ");\n";
     } else if (style == QLatin1String("TexturePattern")) {
         const DomProperty *property = brush->elementTexture();
         const QString iconValue = iconCall(property);
 
-        m_output << m_option.indent << "QBrush " << brushName << " = QBrush("
+        m_output << m_option.indent << "auto " << brushName << " = new QBrush("
             << iconValue << ");\n";
     } else {
         const DomColor *color = brush->elementColor();
-        m_output << m_option.indent << "QBrush " << brushName << '('
+        m_output << m_option.indent << "auto " << brushName << " = new QBrush("
             << domColor2QString(color) << ");\n";
 
         m_output << m_option.indent << brushName << ".setStyle("