Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/tools/uic/cpp/cppwriteinitialization.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the tools applications of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    392392}
    393393
     394
     395
     396
     397
     398
     399
     400
    394401void WriteInitialization::LayoutDefaultHandler::writeProperty(int p, const QString &indent, const QString &objectName,
    395402                                                              const DomPropertyMap &properties, const QString &propertyName, const QString &setter,
     
    409416            if (ifndefMac)
    410417                str << "#ifndef Q_OS_MAC\n";
    411             writeSetter(indent, objectName, setter, value, str);
     418            if (p == Margin) { // Use setContentsMargins for numeric values
     419                writeContentsMargins(indent, objectName, value, str);
     420            } else {
     421                writeSetter(indent, objectName, setter, value, str);
     422            }
    412423            if (ifndefMac)
    413424                str << "#endif\n";
     
    417428    if (suppressDefault)
    418429        return;
    419     // get default
     430    // get default
    420431    if (m_state[p] & HasDefaultFunction) {
     432
    421433        writeSetter(indent, objectName, setter, m_functions[p], str);
    422434        return;
    423435    }
    424436    if (m_state[p] & HasDefaultValue) {
    425         writeSetter(indent, objectName, setter, m_defaultValues[p], str);
     437        if (p == Margin) { // Use setContentsMargins for numeric values
     438            writeContentsMargins(indent, objectName, m_defaultValues[p], str);
     439        } else {
     440            writeSetter(indent, objectName, setter, m_defaultValues[p], str);
     441        }
    426442    }
    427443    return;
     
    459475      m_stdsetdef(true),
    460476      m_layoutMarginType(TopLevelMargin),
     477
    461478      m_delayedOut(&m_delayedInitialization, QIODevice::WriteOnly),
    462479      m_refreshOut(&m_refreshInitialization, QIODevice::WriteOnly),
     
    554571    m_output << m_option.indent << "} // setupUi\n\n";
    555572
    556     if (m_delayedActionInitialization.isEmpty()) {
     573    if () {
    557574        m_refreshInitialization += m_indent;
    558575        m_refreshInitialization += QLatin1String("Q_UNUSED(");
    559576        m_refreshInitialization += varName ;
    560         m_refreshInitialization +=QLatin1String(");\n");
     577        m_refreshInitialization +=QLatin1String(");\n");
    561578    }
    562579
     
    654671    m_layoutWidget = false;
    655672    if (className == QLatin1String("QWidget") && !node->hasAttributeNative()) {
    656         if (m_widgetChain.top()
    657             && m_widgetChain.top()->attributeClass() != QLatin1String("QMainWindow")
    658             && !m_uic->isContainer(m_widgetChain.top()->attributeClass()))
     673        if (const DomWidget* parentWidget = m_widgetChain.top()) {
     674            const QString parentClass = parentWidget->attributeClass();
     675            if (parentClass != QLatin1String("QMainWindow")
     676                && !m_uic->isCustomWidgetContainer(parentClass)
     677                && !m_uic->isContainer(parentClass))
    659678            m_layoutWidget = true;
     679
    660680    }
    661681    m_widgetChain.push(node);
     
    702722        } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStatusBar"))) {
    703723            m_output << m_indent << parentWidget << "->setStatusBar(" << varName << ");\n";
    704         } else if (className == QLatin1String("QWidget")) {
     724        } else {
    705725            m_output << m_indent << parentWidget << "->setCentralWidget(" << varName << ");\n";
    706726        }
     
    15161536            if (defineC)
    15171537                closeIfndef(o, QLatin1String(defineC));
     1538
     1539
     1540
     1541
     1542
     1543
    15181544        }
    15191545    }
     
    16491675        m_output << m_indent << "QIcon " << iconName << ";\n";
    16501676        if (i->hasElementNormalOff())
    1651             m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementNormalOff()->text()) << ", QIcon::Normal, QIcon::Off);\n";
     1677            m_output << m_indent << iconName << ".add, QIcon::Normal, QIcon::Off);\n";
    16521678        if (i->hasElementNormalOn())
    1653             m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementNormalOn()->text()) << ", QIcon::Normal, QIcon::On);\n";
     1679            m_output << m_indent << iconName << ".add, QIcon::Normal, QIcon::On);\n";
    16541680        if (i->hasElementDisabledOff())
    1655             m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementDisabledOff()->text()) << ", QIcon::Disabled, QIcon::Off);\n";
     1681            m_output << m_indent << iconName << ".add, QIcon::Disabled, QIcon::Off);\n";
    16561682        if (i->hasElementDisabledOn())
    1657             m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementDisabledOn()->text()) << ", QIcon::Disabled, QIcon::On);\n";
     1683            m_output << m_indent << iconName << ".add, QIcon::Disabled, QIcon::On);\n";
    16581684        if (i->hasElementActiveOff())
    1659             m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementActiveOff()->text()) << ", QIcon::Active, QIcon::Off);\n";
     1685            m_output << m_indent << iconName << ".add, QIcon::Active, QIcon::Off);\n";
    16601686        if (i->hasElementActiveOn())
    1661             m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementActiveOn()->text()) << ", QIcon::Active, QIcon::On);\n";
     1687            m_output << m_indent << iconName << ".add, QIcon::Active, QIcon::On);\n";
    16621688        if (i->hasElementSelectedOff())
    1663             m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementSelectedOff()->text()) << ", QIcon::Selected, QIcon::Off);\n";
     1689            m_output << m_indent << iconName << ".add, QIcon::Selected, QIcon::Off);\n";
    16641690        if (i->hasElementSelectedOn())
    1665             m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementSelectedOn()->text()) << ", QIcon::Selected, QIcon::On);\n";
     1691            m_output << m_indent << iconName << ".add, QIcon::Selected, QIcon::On);\n";
    16661692    } else { // pre-4.4 legacy
    16671693        m_output <<  m_indent << "const QIcon " << iconName << " = " << pixCall(QLatin1String("QIcon"), i->text())<< ";\n";
     
    26842710        << sender
    26852711        << ", "
    2686         << "SIGNAL(" << connection->elementSignal() << ')'
     2712        << "SIGNAL("')'
    26872713        << ", "
    26882714        << receiver
    26892715        << ", "
    2690         << "SLOT(" << connection->elementSlot() << ')'
     2716        << "SLOT("')'
    26912717        << ");\n";
    26922718}
     
    28142840    if (emptyItemPolicy == Item::ConstructItemOnly && m_children.size() == 0) {
    28152841        if (m_setupUiData.policy == ItemData::DontGenerate) {
    2816             m_setupUiStream << m_indent << "new " << m_itemClassName << "(" << parent << ");\n";
     2842            m_setupUiStream << m_indent << "new " << m_itemClassName << << parent << ");\n";
    28172843                return QString();
    28182844        } else if (m_setupUiData.policy == ItemData::GenerateWithMultiDirective) {
     
    28252851
    28262852    const QString uniqueName = m_driver->unique(QLatin1String("__") + m_itemClassName.toLower());
    2827     m_setupUiStream << m_indent << m_itemClassName << " *" << uniqueName << " = new " << m_itemClassName << "(" << parent << ");\n";
     2853    m_setupUiStream << m_indent << m_itemClassName << " *" << uniqueName << " = new " << m_itemClassName << << parent << ");\n";
    28282854
    28292855    if (generateMultiDirective) {
    28302856        m_setupUiStream << "#else\n";
    2831         m_setupUiStream << m_indent << "new " << m_itemClassName << "(" << parent << ");\n";
     2857        m_setupUiStream << m_indent << "new " << m_itemClassName << << parent << ");\n";
    28322858        generateMultiDirectiveEnd(m_setupUiStream, m_setupUiData.directives);
    28332859    }
Note: See TracChangeset for help on using the changeset viewer.