Changeset 561 for trunk/src/tools/uic/cpp/cppwriteinitialization.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/tools/uic/cpp/cppwriteinitialization.cpp
r2 r561 2 2 ** 3 3 ** 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]) 5 6 ** 6 7 ** This file is part of the tools applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 392 392 } 393 393 394 395 396 397 398 399 400 394 401 void WriteInitialization::LayoutDefaultHandler::writeProperty(int p, const QString &indent, const QString &objectName, 395 402 const DomPropertyMap &properties, const QString &propertyName, const QString &setter, … … 409 416 if (ifndefMac) 410 417 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 } 412 423 if (ifndefMac) 413 424 str << "#endif\n"; … … 417 428 if (suppressDefault) 418 429 return; 419 // get default 430 // get default 420 431 if (m_state[p] & HasDefaultFunction) { 432 421 433 writeSetter(indent, objectName, setter, m_functions[p], str); 422 434 return; 423 435 } 424 436 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 } 426 442 } 427 443 return; … … 459 475 m_stdsetdef(true), 460 476 m_layoutMarginType(TopLevelMargin), 477 461 478 m_delayedOut(&m_delayedInitialization, QIODevice::WriteOnly), 462 479 m_refreshOut(&m_refreshInitialization, QIODevice::WriteOnly), … … 554 571 m_output << m_option.indent << "} // setupUi\n\n"; 555 572 556 if ( m_delayedActionInitialization.isEmpty()) {573 if () { 557 574 m_refreshInitialization += m_indent; 558 575 m_refreshInitialization += QLatin1String("Q_UNUSED("); 559 576 m_refreshInitialization += varName ; 560 m_refreshInitialization += QLatin1String(");\n");577 m_refreshInitialization +=QLatin1String(");\n"); 561 578 } 562 579 … … 654 671 m_layoutWidget = false; 655 672 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)) 659 678 m_layoutWidget = true; 679 660 680 } 661 681 m_widgetChain.push(node); … … 702 722 } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStatusBar"))) { 703 723 m_output << m_indent << parentWidget << "->setStatusBar(" << varName << ");\n"; 704 } else if (className == QLatin1String("QWidget")){724 } else { 705 725 m_output << m_indent << parentWidget << "->setCentralWidget(" << varName << ");\n"; 706 726 } … … 1516 1536 if (defineC) 1517 1537 closeIfndef(o, QLatin1String(defineC)); 1538 1539 1540 1541 1542 1543 1518 1544 } 1519 1545 } … … 1649 1675 m_output << m_indent << "QIcon " << iconName << ";\n"; 1650 1676 if (i->hasElementNormalOff()) 1651 m_output << m_indent << iconName << ".add Pixmap(" << pixCall(pixmap, i->elementNormalOff()->text()) << ", QIcon::Normal, QIcon::Off);\n";1677 m_output << m_indent << iconName << ".add, QIcon::Normal, QIcon::Off);\n"; 1652 1678 if (i->hasElementNormalOn()) 1653 m_output << m_indent << iconName << ".add Pixmap(" << pixCall(pixmap, i->elementNormalOn()->text()) << ", QIcon::Normal, QIcon::On);\n";1679 m_output << m_indent << iconName << ".add, QIcon::Normal, QIcon::On);\n"; 1654 1680 if (i->hasElementDisabledOff()) 1655 m_output << m_indent << iconName << ".add Pixmap(" << pixCall(pixmap, i->elementDisabledOff()->text()) << ", QIcon::Disabled, QIcon::Off);\n";1681 m_output << m_indent << iconName << ".add, QIcon::Disabled, QIcon::Off);\n"; 1656 1682 if (i->hasElementDisabledOn()) 1657 m_output << m_indent << iconName << ".add Pixmap(" << pixCall(pixmap, i->elementDisabledOn()->text()) << ", QIcon::Disabled, QIcon::On);\n";1683 m_output << m_indent << iconName << ".add, QIcon::Disabled, QIcon::On);\n"; 1658 1684 if (i->hasElementActiveOff()) 1659 m_output << m_indent << iconName << ".add Pixmap(" << pixCall(pixmap, i->elementActiveOff()->text()) << ", QIcon::Active, QIcon::Off);\n";1685 m_output << m_indent << iconName << ".add, QIcon::Active, QIcon::Off);\n"; 1660 1686 if (i->hasElementActiveOn()) 1661 m_output << m_indent << iconName << ".add Pixmap(" << pixCall(pixmap, i->elementActiveOn()->text()) << ", QIcon::Active, QIcon::On);\n";1687 m_output << m_indent << iconName << ".add, QIcon::Active, QIcon::On);\n"; 1662 1688 if (i->hasElementSelectedOff()) 1663 m_output << m_indent << iconName << ".add Pixmap(" << pixCall(pixmap, i->elementSelectedOff()->text()) << ", QIcon::Selected, QIcon::Off);\n";1689 m_output << m_indent << iconName << ".add, QIcon::Selected, QIcon::Off);\n"; 1664 1690 if (i->hasElementSelectedOn()) 1665 m_output << m_indent << iconName << ".add Pixmap(" << pixCall(pixmap, i->elementSelectedOn()->text()) << ", QIcon::Selected, QIcon::On);\n";1691 m_output << m_indent << iconName << ".add, QIcon::Selected, QIcon::On);\n"; 1666 1692 } else { // pre-4.4 legacy 1667 1693 m_output << m_indent << "const QIcon " << iconName << " = " << pixCall(QLatin1String("QIcon"), i->text())<< ";\n"; … … 2684 2710 << sender 2685 2711 << ", " 2686 << "SIGNAL(" << connection->elementSignal() <<')'2712 << "SIGNAL("')' 2687 2713 << ", " 2688 2714 << receiver 2689 2715 << ", " 2690 << "SLOT(" << connection->elementSlot() <<')'2716 << "SLOT("')' 2691 2717 << ");\n"; 2692 2718 } … … 2814 2840 if (emptyItemPolicy == Item::ConstructItemOnly && m_children.size() == 0) { 2815 2841 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"; 2817 2843 return QString(); 2818 2844 } else if (m_setupUiData.policy == ItemData::GenerateWithMultiDirective) { … … 2825 2851 2826 2852 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"; 2828 2854 2829 2855 if (generateMultiDirective) { 2830 2856 m_setupUiStream << "#else\n"; 2831 m_setupUiStream << m_indent << "new " << m_itemClassName << "("<< parent << ");\n";2857 m_setupUiStream << m_indent << "new " << m_itemClassName << << parent << ");\n"; 2832 2858 generateMultiDirectiveEnd(m_setupUiStream, m_setupUiData.directives); 2833 2859 }
Note:
See TracChangeset
for help on using the changeset viewer.