Changeset 561 for trunk/tools/designer/src/lib/uilib
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
- 2 copied
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/tools/designer/src/lib/uilib/abstractformbuilder.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 **sw … … 136 136 implementation for constructing forms from user interface 137 137 files. It is not intended to be instantiated directly. Use the 138 QFormBuilder class to create user interfaces from \c{.ui}files at138 QFormBuilder class to create user interfaces from UI files at 139 139 run-time. For example: 140 140 … … 146 146 147 147 \list 148 \o load() handles reading of \c{.ui}format files from arbitrary148 \o load() handles reading of UI format files from arbitrary 149 149 QIODevices, and construction of widgets from the XML data 150 150 that they contain. 151 \o save() handles saving of widget details in \c{.ui}format to151 \o save() handles saving of widget details in UI format to 152 152 arbitrary QIODevices. 153 153 \o workingDirectory() and setWorkingDirectory() control the … … 209 209 } 210 210 if (reader.hasError()) { 211 uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the uifile at line %1, column %2: %3")211 uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the UI file at line %1, column %2: %3") 212 212 .arg(reader.lineNumber()).arg(reader.columnNumber()) 213 213 .arg(reader.errorString())); … … 215 215 } 216 216 if (!initialized) { 217 uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid uifile: The root element <ui> is missing."));217 uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid UI file: The root element <ui> is missing.")); 218 218 return 0; 219 219 } … … 286 286 QFormBuilderExtra *formBuilderPrivate = QFormBuilderExtra::instance(this); 287 287 const DomCustomWidgetList::const_iterator cend = customWidgets.constEnd(); 288 for (DomCustomWidgetList::const_iterator it = customWidgets.constBegin(); it != cend; ++it) { 289 const DomCustomWidget *cw = *it; 290 #ifndef QT_FORMBUILDER_NO_SCRIPT 291 if (const DomScript *domScript = cw->elementScript()) { 292 const QString script = domScript->text(); 293 if (!script.isEmpty()) 294 formBuilderPrivate->storeCustomWidgetScript(cw->elementClass(), script); 295 } 296 #endif 297 const QString addPageMethod = cw->elementAddPageMethod(); 298 if (!addPageMethod.isEmpty()) 299 formBuilderPrivate->storeCustomWidgetAddPageMethod(cw->elementClass(), addPageMethod); 300 301 const QString extends = cw->elementExtends(); 302 if (!extends.isEmpty()) 303 formBuilderPrivate->storeCustomWidgetBaseClass(cw->elementClass(), extends); 304 } 288 for (DomCustomWidgetList::const_iterator it = customWidgets.constBegin(); it != cend; ++it) 289 formBuilderPrivate->storeCustomWidgetData((*it)->elementClass(), *it); 305 290 } 306 291 } … … 404 389 return 0; 405 390 391 m_actions.insert(ui_action->attributeName(), a); 406 392 applyProperties(a, ui_action->elementProperty()); 407 393 return a; … … 416 402 if (!a) 417 403 return 0; 418 404 m_actionGroups.insert(ui_action_group->attributeName(), a); 419 405 applyProperties(a, ui_action_group->elementProperty()); 420 406 … … 657 643 658 644 #ifdef Q_OS_MAC 659 // here we recognize uifile < 4.3 (no we don't store margin property)645 // here we recognize UI file < 4.3 (no we don't store margin property) 660 646 if (mar != INT_MIN) { 661 647 const int defaultMargin = parent->inherits("QLayoutWidget") ? 0 : 9; … … 1185 1171 QAction *action = new QAction(parent); 1186 1172 action->setObjectName(name); 1187 m_actions.insert(name, action);1188 1189 1173 return action; 1190 1174 } … … 1197 1181 QActionGroup *g = new QActionGroup(parent); 1198 1182 g->setObjectName(name); 1199 m_actionGroups.insert(name, g);1200 1201 1183 return g; 1202 1184 } … … 1206 1188 1207 1189 Saves an XML representation of the given \a widget to the 1208 specified \a device in the standard \c{.ui}file format.1190 specified \a device in the standard UI file format. 1209 1191 1210 1192 \sa load()*/ … … 1702 1684 1703 1685 template<class T> 1686 static void storeItemFlags(const T *item, QList<DomProperty*> *properties) 1687 { 1688 static const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); 1689 static const Qt::ItemFlags defaultFlags = T().flags(); 1690 static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags"); 1691 1692 if (item->flags() != defaultFlags) { 1693 DomProperty *p = new DomProperty; 1694 p->setAttributeName(strings.flagsAttribute); 1695 p->setElementSet(QString::fromAscii(itemFlags_enum.valueToKeys(item->flags()))); 1696 properties->append(p); 1697 } 1698 } 1699 1700 #ifndef Q_CC_RVCT 1701 // RVCT does not accept static inline functions if one argument is templated type 1702 // For this reason all necessary function variants are explicityly written for it. 1703 template<class T> 1704 1704 static void storeItemProps(QAbstractFormBuilder *abstractFormBuilder, const T *item, 1705 1705 QList<DomProperty*> *properties) … … 1727 1727 1728 1728 template<class T> 1729 static void storeItemFlags(const T *item, QList<DomProperty*> *properties)1730 {1731 static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();1732 static const Qt::ItemFlags defaultFlags = T().flags();1733 static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");1734 1735 if (item->flags() != defaultFlags) {1736 DomProperty *p = new DomProperty;1737 p->setAttributeName(strings.flagsAttribute);1738 p->setElementSet(QString::fromAscii(itemFlags_enum.valueToKeys(item->flags())));1739 properties->append(p);1740 }1741 }1742 1743 template<class T>1744 1729 static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const T *item, 1745 1730 QList<DomProperty*> *properties) … … 1793 1778 item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toAscii())); 1794 1779 } 1780 1781 #else 1782 1783 static void storeItemProps(QAbstractFormBuilder *abstractFormBuilder, const QTableWidgetItem *item, 1784 QList<DomProperty*> *properties) 1785 { 1786 static const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); 1787 FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder); 1788 1789 DomProperty *p; 1790 QVariant v; 1791 1792 foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles) 1793 if ((p = formBuilder->saveText(it.second, item->data(it.first.second)))) 1794 properties->append(p); 1795 1796 foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles) 1797 if ((v = item->data(it.first)).isValid() && 1798 (p = variantToDomProperty(abstractFormBuilder, 1799 static_cast<const QMetaObject *>(&QAbstractFormBuilderGadget::staticMetaObject), 1800 it.second, v))) 1801 properties->append(p); 1802 1803 if ((p = formBuilder->saveResource(item->data(Qt::DecorationPropertyRole)))) 1804 properties->append(p); 1805 } 1806 1807 static void storeItemProps(QAbstractFormBuilder *abstractFormBuilder, const QListWidgetItem *item, 1808 QList<DomProperty*> *properties) 1809 { 1810 static const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); 1811 FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder); 1812 1813 DomProperty *p; 1814 QVariant v; 1815 1816 foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles) 1817 if ((p = formBuilder->saveText(it.second, item->data(it.first.second)))) 1818 properties->append(p); 1819 1820 foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles) 1821 if ((v = item->data(it.first)).isValid() && 1822 (p = variantToDomProperty(abstractFormBuilder, 1823 static_cast<const QMetaObject *>(&QAbstractFormBuilderGadget::staticMetaObject), 1824 it.second, v))) 1825 properties->append(p); 1826 1827 if ((p = formBuilder->saveResource(item->data(Qt::DecorationPropertyRole)))) 1828 properties->append(p); 1829 } 1830 1831 static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const QTableWidgetItem *item, 1832 QList<DomProperty*> *properties) 1833 { 1834 storeItemProps(abstractFormBuilder, item, properties); 1835 storeItemFlags(item, properties); 1836 } 1837 1838 static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const QListWidgetItem *item, 1839 QList<DomProperty*> *properties) 1840 { 1841 storeItemProps(abstractFormBuilder, item, properties); 1842 storeItemFlags(item, properties); 1843 } 1844 1845 static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, QTableWidgetItem *item, 1846 const QHash<QString, DomProperty*> &properties) 1847 { 1848 static const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); 1849 FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder); 1850 1851 DomProperty *p; 1852 QVariant v; 1853 1854 foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles) 1855 if ((p = properties.value(it.second))) { 1856 v = formBuilder->textBuilder()->loadText(p); 1857 QVariant nativeValue = formBuilder->textBuilder()->toNativeValue(v); 1858 item->setData(it.first.first, qVariantValue<QString>(nativeValue)); 1859 item->setData(it.first.second, v); 1860 } 1861 1862 foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles) 1863 if ((p = properties.value(it.second)) && 1864 (v = formBuilder->toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p)).isValid()) 1865 item->setData(it.first, v); 1866 1867 if ((p = properties.value(strings.iconAttribute))) { 1868 v = formBuilder->resourceBuilder()->loadResource(formBuilder->workingDirectory(), p); 1869 QVariant nativeValue = formBuilder->resourceBuilder()->toNativeValue(v); 1870 item->setIcon(qVariantValue<QIcon>(nativeValue)); 1871 item->setData(Qt::DecorationPropertyRole, v); 1872 } 1873 } 1874 1875 static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, QListWidgetItem *item, 1876 const QHash<QString, DomProperty*> &properties) 1877 { 1878 static const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); 1879 FriendlyFB * const formBuilder = static_cast<FriendlyFB *>(abstractFormBuilder); 1880 1881 DomProperty *p; 1882 QVariant v; 1883 1884 foreach (const QFormBuilderStrings::TextRoleNName &it, strings.itemTextRoles) 1885 if ((p = properties.value(it.second))) { 1886 v = formBuilder->textBuilder()->loadText(p); 1887 QVariant nativeValue = formBuilder->textBuilder()->toNativeValue(v); 1888 item->setData(it.first.first, qVariantValue<QString>(nativeValue)); 1889 item->setData(it.first.second, v); 1890 } 1891 1892 foreach (const QFormBuilderStrings::RoleNName &it, strings.itemRoles) 1893 if ((p = properties.value(it.second)) && 1894 (v = formBuilder->toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p)).isValid()) 1895 item->setData(it.first, v); 1896 1897 if ((p = properties.value(strings.iconAttribute))) { 1898 v = formBuilder->resourceBuilder()->loadResource(formBuilder->workingDirectory(), p); 1899 QVariant nativeValue = formBuilder->resourceBuilder()->toNativeValue(v); 1900 item->setIcon(qVariantValue<QIcon>(nativeValue)); 1901 item->setData(Qt::DecorationPropertyRole, v); 1902 } 1903 } 1904 1905 static void loadItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, QTableWidgetItem *item, 1906 const QHash<QString, DomProperty*> &properties) 1907 { 1908 static const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); 1909 static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags"); 1910 1911 loadItemProps(abstractFormBuilder, item, properties); 1912 1913 DomProperty *p; 1914 if ((p = properties.value(strings.flagsAttribute)) && p->kind() == DomProperty::Set) 1915 item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toAscii())); 1916 } 1917 1918 static void loadItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, QListWidgetItem *item, 1919 const QHash<QString, DomProperty*> &properties) 1920 { 1921 static const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); 1922 static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags"); 1923 1924 loadItemProps(abstractFormBuilder, item, properties); 1925 1926 DomProperty *p; 1927 if ((p = properties.value(strings.flagsAttribute)) && p->kind() == DomProperty::Set) 1928 item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toAscii())); 1929 } 1930 1931 #endif 1795 1932 1796 1933 /*! … … 2146 2283 const DomPropertyHash properties = propertyMap(ui_item->elementProperty()); 2147 2284 QListWidgetItem *item = new QListWidgetItem(listWidget); 2285 #ifndef Q_CC_RVCT 2148 2286 loadItemPropsNFlags<QListWidgetItem>(this, item, properties); 2287 #else 2288 loadItemPropsNFlags(this, item, properties); 2289 #endif 2149 2290 } 2150 2291 … … 2670 2811 } 2671 2812 2672 namespace {2673 // set forward slashes in image path.2674 inline void fixImagePath(QString &p) {2675 p.replace(QLatin1Char('\\'), QLatin1Char('/'));2676 }2677 }2678 2679 2813 /*! 2680 2814 \internal -
trunk/tools/designer/src/lib/uilib/abstractformbuilder.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/container.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/customwidget.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/formbuilder.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 58 58 59 59 \brief The QFormBuilder class is used to dynamically construct 60 user interfaces from .uifiles at run-time.60 user interfaces from UI files at run-time. 61 61 62 62 \inmodule QtDesigner 63 63 64 64 The QFormBuilder class provides a mechanism for dynamically 65 creating user interfaces at run-time, based on \c{.ui}files65 creating user interfaces at run-time, based on UI files 66 66 created with \QD. For example: 67 67 … … 121 121 QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) 122 122 { 123 QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false); 123 QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); 124 if (!fb->parentWidgetIsSet()) 125 fb->setParentWidget(parentWidget); 126 // Is this a QLayoutWidget with a margin of 0: Not a known page-based 127 // container and no method for adding pages registered. 128 fb->setProcessingLayoutWidget(false); 124 129 if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative() 125 130 && parentWidget … … 145 150 && !qobject_cast<QDockWidget *>(parentWidget) 146 151 #endif 147 ) 148 QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(true); 152 ) { 153 const QString parentClassName = QLatin1String(parentWidget->metaObject()->className()); 154 if (!fb->isCustomWidgetContainer(parentClassName)) 155 fb->setProcessingLayoutWidget(true); 156 } 149 157 return QAbstractFormBuilder::create(ui_widget, parentWidget); 150 158 } … … 228 236 if (qobject_cast<QDialog *>(w)) 229 237 w->setParent(parentWidget); 230 231 if (!fb->rootWidget())232 fb->setRootWidget(w);233 238 234 239 return w; … … 370 375 QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget) 371 376 { 377 QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); 372 378 // Is this a temporary layout widget used to represent QLayout hierarchies in Designer? 373 379 // Set its margins to 0. 374 bool layoutWidget = QFormBuilderExtra::instance(this)->processingLayoutWidget();380 bool layoutWidget = fb->processingLayoutWidget(); 375 381 QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget); 376 382 if (layoutWidget) { … … 393 399 394 400 l->setContentsMargins(left, top, right, bottom); 395 QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false);401 fb->setProcessingLayoutWidget(false); 396 402 } 397 403 return l; … … 526 532 \internal 527 533 */ 534 528 535 void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties) 529 536 { … … 543 550 544 551 const QString attributeName = (*it)->attributeName(); 545 if (o == fb->rootWidget() && attributeName == strings.geometryProperty) { 546 // apply only the size for the rootWidget 547 fb->rootWidget()->resize(qvariant_cast<QRect>(v).size()); 552 const bool isWidget = o->isWidgetType(); 553 if (isWidget && o->parent() == fb->parentWidget() && attributeName == strings.geometryProperty) { 554 // apply only the size part of a geometry for the root widget 555 static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size()); 548 556 } else if (fb->applyPropertyInternally(o, attributeName, v)) { 549 } else if ( !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {557 } else if (isWidget && !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) { 550 558 // ### special-casing for Line (QFrame) -- try to fix me 551 559 o->setProperty("frameShape", v); // v is of QFrame::Shape enum -
trunk/tools/designer/src/lib/uilib/formbuilder.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/formbuilderextra.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 66 66 } 67 67 68 69 QFormBuilderExtra::CustomWidgetData::CustomWidgetData() : 70 isContainer(false) 71 { 72 } 73 74 QFormBuilderExtra::CustomWidgetData::CustomWidgetData(const DomCustomWidget *dcw) : 75 addPageMethod(dcw->elementAddPageMethod()), 76 baseClass(dcw->elementExtends()), 77 isContainer(dcw->hasElementContainer() && dcw->elementContainer() != 0) 78 { 79 #ifndef QT_FORMBUILDER_NO_SCRIPT 80 if (const DomScript *domScript = dcw->elementScript()) 81 script = domScript->text(); 82 #endif 83 } 84 68 85 QFormBuilderExtra::QFormBuilderExtra() : 69 86 m_layoutWidget(false), … … 82 99 { 83 100 m_buddies.clear(); 84 m_rootWidget = 0; 101 m_parentWidget = 0; 102 m_parentWidgetIsSet = false; 85 103 #ifndef QT_FORMBUILDER_NO_SCRIPT 86 104 m_FormScriptRunner.clearErrors(); 87 m_customWidgetScriptHash.clear();88 105 #endif 106 m_customWidgetDataHash.clear(); 89 107 m_buttonGroups.clear(); 90 108 } … … 137 155 } 138 156 139 const QPointer<QWidget> &QFormBuilderExtra::rootWidget() const 140 { 141 return m_rootWidget; 142 } 143 144 void QFormBuilderExtra::setRootWidget(const QPointer<QWidget> &w) 145 { 146 m_rootWidget = w; 157 const QPointer<QWidget> &QFormBuilderExtra::parentWidget() const 158 { 159 return m_parentWidget; 160 } 161 162 bool QFormBuilderExtra::parentWidgetIsSet() const 163 { 164 return m_parentWidgetIsSet; 165 } 166 167 void QFormBuilderExtra::setParentWidget(const QPointer<QWidget> &w) 168 { 169 // Parent widget requires special handling of the geometry property. 170 m_parentWidget = w; 171 m_parentWidgetIsSet = true; 147 172 } 148 173 … … 153 178 } 154 179 155 void QFormBuilderExtra::storeCustomWidgetScript(const QString &className, const QString &script)156 {157 m_customWidgetScriptHash.insert(className, script);158 }159 160 180 QString QFormBuilderExtra::customWidgetScript(const QString &className) const 161 181 { 162 const CustomWidgetScriptHash::const_iterator it = m_customWidgetScriptHash.constFind(className);163 if ( it == m_customWidgetScriptHash.constEnd())164 return QString();165 return it.value();182 const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className); 183 if (it != m_customWidgetDataHash.constEnd()) 184 return it.value().script; 185 return QString(); 166 186 } 167 187 168 188 #endif 169 189 170 void QFormBuilderExtra::storeCustomWidgetBaseClass(const QString &className, const QString &baseClassName) 171 { 172 m_customWidgetBaseClassHash.insert(className, baseClassName); 190 void QFormBuilderExtra::storeCustomWidgetData(const QString &className, const DomCustomWidget *d) 191 { 192 if (d) 193 m_customWidgetDataHash.insert(className, CustomWidgetData(d)); 173 194 } 174 195 175 196 QString QFormBuilderExtra::customWidgetBaseClass(const QString &className) const 176 197 { 177 const QHash<QString, QString>::const_iterator it = m_customWidgetBaseClassHash.constFind(className); 178 if (it == m_customWidgetBaseClassHash.constEnd()) 179 return QString(); 180 return it.value(); 181 } 182 183 void QFormBuilderExtra::storeCustomWidgetAddPageMethod(const QString &className, const QString &ct) 184 { 185 m_customWidgetAddPageMethodHash.insert(className, ct); 198 const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className); 199 if (it != m_customWidgetDataHash.constEnd()) 200 return it.value().baseClass; 201 return QString(); 186 202 } 187 203 188 204 QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) const 189 205 { 190 const QHash<QString, QString>::const_iterator it = m_customWidgetAddPageMethodHash.constFind(className); 191 if (it == m_customWidgetAddPageMethodHash.constEnd()) 192 return QString(); 193 return it.value(); 206 const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className); 207 if (it != m_customWidgetDataHash.constEnd()) 208 return it.value().addPageMethod; 209 return QString(); 210 } 211 212 bool QFormBuilderExtra::isCustomWidgetContainer(const QString &className) const 213 { 214 const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className); 215 if (it != m_customWidgetDataHash.constEnd()) 216 return it.value().isContainer; 217 return false; 194 218 } 195 219 -
trunk/tools/designer/src/lib/uilib/formbuilderextra_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 83 83 class DomButtonGroups; 84 84 class DomButtonGroup; 85 class DomCustomWidget; 85 86 86 87 class QAbstractFormBuilder; … … 93 94 ~QFormBuilderExtra(); 94 95 public: 96 struct CustomWidgetData { 97 CustomWidgetData(); 98 explicit CustomWidgetData(const DomCustomWidget *dc); 99 100 QString addPageMethod; 101 QString script; 102 QString baseClass; 103 bool isContainer; 104 }; 105 95 106 void clear(); 96 107 … … 102 113 static bool applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label); 103 114 104 const QPointer<QWidget> &rootWidget() const; 105 void setRootWidget(const QPointer<QWidget> &w); 115 const QPointer<QWidget> &parentWidget() const; 116 bool parentWidgetIsSet() const; 117 void setParentWidget(const QPointer<QWidget> &w); 106 118 107 119 #ifndef QT_FORMBUILDER_NO_SCRIPT 108 120 QFormScriptRunner &formScriptRunner(); 109 void storeCustomWidgetScript(const QString &className, const QString &script);110 121 QString customWidgetScript(const QString &className) const; 111 122 #endif … … 123 134 static void removeInstance(const QAbstractFormBuilder *afb); 124 135 125 void storeCustomWidget AddPageMethod(const QString &className, const QString &ct);136 void storeCustomWidgetData(const QString &className, const DomCustomWidget *d); 126 137 QString customWidgetAddPageMethod(const QString &className) const; 127 128 void storeCustomWidgetBaseClass(const QString &className, const QString &baseClassName);129 138 QString customWidgetBaseClass(const QString &className) const; 139 bool isCustomWidgetContainer(const QString &className) const; 130 140 131 141 // --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group … … 169 179 #ifndef QT_FORMBUILDER_NO_SCRIPT 170 180 QFormScriptRunner m_FormScriptRunner; 171 172 typedef QHash<QString, QString> CustomWidgetScriptHash; 173 CustomWidgetScriptHash m_customWidgetScriptHash; 174 #endif 175 176 QHash<QString, QString> m_customWidgetAddPageMethodHash; 177 QHash<QString, QString> m_customWidgetBaseClassHash; 181 #endif 182 183 QHash<QString, CustomWidgetData> m_customWidgetDataHash; 178 184 179 185 ButtonGroupHash m_buttonGroups; … … 183 189 QTextBuilder *m_textBuilder; 184 190 185 QPointer<QWidget> m_rootWidget; 191 QPointer<QWidget> m_parentWidget; 192 bool m_parentWidgetIsSet; 186 193 }; 187 194 -
trunk/tools/designer/src/lib/uilib/formscriptrunner.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/formscriptrunner_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/properties.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/properties_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/qdesignerexportwidget.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/resourcebuilder.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 99 99 QIcon icon; 100 100 if (flags & NormalOff) 101 icon.add Pixmap(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QIcon::Normal, QIcon::Off);101 icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::Off); 102 102 if (flags & NormalOn) 103 icon.add Pixmap(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QIcon::Normal, QIcon::On);103 icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::On); 104 104 if (flags & DisabledOff) 105 icon.add Pixmap(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QIcon::Disabled, QIcon::Off);105 icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::Off); 106 106 if (flags & DisabledOn) 107 icon.add Pixmap(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QIcon::Disabled, QIcon::On);107 icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::On); 108 108 if (flags & ActiveOff) 109 icon.add Pixmap(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QIcon::Active, QIcon::Off);109 icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::Off); 110 110 if (flags & ActiveOn) 111 icon.add Pixmap(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QIcon::Active, QIcon::On);111 icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::On); 112 112 if (flags & SelectedOff) 113 icon.add Pixmap(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QIcon::Selected, QIcon::Off);113 icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::Off); 114 114 if (flags & SelectedOn) 115 icon.add Pixmap(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QIcon::Selected, QIcon::On);115 icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::On); 116 116 return qVariantFromValue(icon); 117 117 } else { // 4.3 legacy -
trunk/tools/designer/src/lib/uilib/resourcebuilder_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/textbuilder.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/textbuilder_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/tools/designer/src/lib/uilib/ui4.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 2369 2369 delete m_properties; 2370 2370 delete m_slots; 2371 delete m_propertyspecifications; 2371 2372 2372 2373 if (clear_all) { … … 2382 2383 m_properties = 0; 2383 2384 m_slots = 0; 2385 m_propertyspecifications = 0; 2384 2386 } 2385 2387 … … 2394 2396 m_properties = 0; 2395 2397 m_slots = 0; 2398 m_propertyspecifications = 0; 2396 2399 } 2397 2400 … … 2404 2407 delete m_properties; 2405 2408 delete m_slots; 2409 delete m_propertyspecifications; 2406 2410 } 2407 2411 … … 2469 2473 continue; 2470 2474 } 2475 if (tag == QLatin1String("propertyspecifications")) { 2476 DomPropertySpecifications *v = new DomPropertySpecifications(); 2477 v->read(reader); 2478 setElementPropertyspecifications(v); 2479 continue; 2480 } 2471 2481 reader.raiseError(QLatin1String("Unexpected element ") + tag); 2472 2482 } … … 2549 2559 continue; 2550 2560 } 2561 if (tag == QLatin1String("propertyspecifications")) { 2562 DomPropertySpecifications *v = new DomPropertySpecifications(); 2563 v->read(e); 2564 setElementPropertyspecifications(v); 2565 continue; 2566 } 2551 2567 } 2552 2568 m_text.clear(); … … 2606 2622 } 2607 2623 2624 if (m_children & Propertyspecifications) { 2625 m_propertyspecifications->write(writer, QLatin1String("propertyspecifications")); 2626 } 2627 2608 2628 if (!m_text.isEmpty()) 2609 2629 writer.writeCharacters(m_text); … … 2732 2752 } 2733 2753 2754 DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications() 2755 { 2756 DomPropertySpecifications* a = m_propertyspecifications; 2757 m_propertyspecifications = 0; 2758 m_children ^= Propertyspecifications; 2759 return a; 2760 } 2761 2762 void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications* a) 2763 { 2764 delete m_propertyspecifications; 2765 m_children |= Propertyspecifications; 2766 m_propertyspecifications = a; 2767 } 2768 2734 2769 void DomCustomWidget::clearElementClass() 2735 2770 { … … 2797 2832 m_slots = 0; 2798 2833 m_children &= ~Slots; 2834 } 2835 2836 void DomCustomWidget::clearElementPropertyspecifications() 2837 { 2838 delete m_propertyspecifications; 2839 m_propertyspecifications = 0; 2840 m_children &= ~Propertyspecifications; 2799 2841 } 2800 2842 … … 10884 10926 } 10885 10927 10928 void DomPropertySpecifications::clear(bool clear_all) 10929 { 10930 qDeleteAll(m_stringpropertyspecification); 10931 m_stringpropertyspecification.clear(); 10932 10933 if (clear_all) { 10934 m_text.clear(); 10935 } 10936 10937 m_children = 0; 10938 } 10939 10940 DomPropertySpecifications::DomPropertySpecifications() 10941 { 10942 m_children = 0; 10943 } 10944 10945 DomPropertySpecifications::~DomPropertySpecifications() 10946 { 10947 qDeleteAll(m_stringpropertyspecification); 10948 m_stringpropertyspecification.clear(); 10949 } 10950 10951 void DomPropertySpecifications::read(QXmlStreamReader &reader) 10952 { 10953 10954 for (bool finished = false; !finished && !reader.hasError();) { 10955 switch (reader.readNext()) { 10956 case QXmlStreamReader::StartElement : { 10957 const QString tag = reader.name().toString().toLower(); 10958 if (tag == QLatin1String("stringpropertyspecification")) { 10959 DomStringPropertySpecification *v = new DomStringPropertySpecification(); 10960 v->read(reader); 10961 m_stringpropertyspecification.append(v); 10962 continue; 10963 } 10964 reader.raiseError(QLatin1String("Unexpected element ") + tag); 10965 } 10966 break; 10967 case QXmlStreamReader::EndElement : 10968 finished = true; 10969 break; 10970 case QXmlStreamReader::Characters : 10971 if (!reader.isWhitespace()) 10972 m_text.append(reader.text().toString()); 10973 break; 10974 default : 10975 break; 10976 } 10977 } 10978 } 10979 10980 #ifdef QUILOADER_QDOM_READ 10981 void DomPropertySpecifications::read(const QDomElement &node) 10982 { 10983 for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { 10984 if (!n.isElement()) 10985 continue; 10986 QDomElement e = n.toElement(); 10987 QString tag = e.tagName().toLower(); 10988 if (tag == QLatin1String("stringpropertyspecification")) { 10989 DomStringPropertySpecification *v = new DomStringPropertySpecification(); 10990 v->read(e); 10991 m_stringpropertyspecification.append(v); 10992 continue; 10993 } 10994 } 10995 m_text.clear(); 10996 for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { 10997 if (child.isText()) 10998 m_text.append(child.nodeValue()); 10999 } 11000 } 11001 #endif 11002 11003 void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const 11004 { 11005 writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower()); 11006 11007 for (int i = 0; i < m_stringpropertyspecification.size(); ++i) { 11008 DomStringPropertySpecification* v = m_stringpropertyspecification[i]; 11009 v->write(writer, QLatin1String("stringpropertyspecification")); 11010 } 11011 if (!m_text.isEmpty()) 11012 writer.writeCharacters(m_text); 11013 11014 writer.writeEndElement(); 11015 } 11016 11017 void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a) 11018 { 11019 m_children |= Stringpropertyspecification; 11020 m_stringpropertyspecification = a; 11021 } 11022 11023 void DomStringPropertySpecification::clear(bool clear_all) 11024 { 11025 11026 if (clear_all) { 11027 m_text.clear(); 11028 m_has_attr_name = false; 11029 m_has_attr_type = false; 11030 m_has_attr_notr = false; 11031 } 11032 11033 m_children = 0; 11034 } 11035 11036 DomStringPropertySpecification::DomStringPropertySpecification() 11037 { 11038 m_children = 0; 11039 m_has_attr_name = false; 11040 m_has_attr_type = false; 11041 m_has_attr_notr = false; 11042 } 11043 11044 DomStringPropertySpecification::~DomStringPropertySpecification() 11045 { 11046 } 11047 11048 void DomStringPropertySpecification::read(QXmlStreamReader &reader) 11049 { 11050 11051 foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { 11052 QStringRef name = attribute.name(); 11053 if (name == QLatin1String("name")) { 11054 setAttributeName(attribute.value().toString()); 11055 continue; 11056 } 11057 if (name == QLatin1String("type")) { 11058 setAttributeType(attribute.value().toString()); 11059 continue; 11060 } 11061 if (name == QLatin1String("notr")) { 11062 setAttributeNotr(attribute.value().toString()); 11063 continue; 11064 } 11065 reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); 11066 } 11067 11068 for (bool finished = false; !finished && !reader.hasError();) { 11069 switch (reader.readNext()) { 11070 case QXmlStreamReader::StartElement : { 11071 const QString tag = reader.name().toString().toLower(); 11072 reader.raiseError(QLatin1String("Unexpected element ") + tag); 11073 } 11074 break; 11075 case QXmlStreamReader::EndElement : 11076 finished = true; 11077 break; 11078 case QXmlStreamReader::Characters : 11079 if (!reader.isWhitespace()) 11080 m_text.append(reader.text().toString()); 11081 break; 11082 default : 11083 break; 11084 } 11085 } 11086 } 11087 11088 #ifdef QUILOADER_QDOM_READ 11089 void DomStringPropertySpecification::read(const QDomElement &node) 11090 { 11091 if (node.hasAttribute(QLatin1String("name"))) 11092 setAttributeName(node.attribute(QLatin1String("name"))); 11093 if (node.hasAttribute(QLatin1String("type"))) 11094 setAttributeType(node.attribute(QLatin1String("type"))); 11095 if (node.hasAttribute(QLatin1String("notr"))) 11096 setAttributeNotr(node.attribute(QLatin1String("notr"))); 11097 11098 for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { 11099 if (!n.isElement()) 11100 continue; 11101 QDomElement e = n.toElement(); 11102 QString tag = e.tagName().toLower(); 11103 } 11104 m_text.clear(); 11105 for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { 11106 if (child.isText()) 11107 m_text.append(child.nodeValue()); 11108 } 11109 } 11110 #endif 11111 11112 void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const 11113 { 11114 writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower()); 11115 11116 if (hasAttributeName()) 11117 writer.writeAttribute(QLatin1String("name"), attributeName()); 11118 11119 if (hasAttributeType()) 11120 writer.writeAttribute(QLatin1String("type"), attributeType()); 11121 11122 if (hasAttributeNotr()) 11123 writer.writeAttribute(QLatin1String("notr"), attributeNotr()); 11124 11125 if (!m_text.isEmpty()) 11126 writer.writeCharacters(m_text); 11127 11128 writer.writeEndElement(); 11129 } 11130 10886 11131 QT_END_NAMESPACE 10887 11132 -
trunk/tools/designer/src/lib/uilib/ui4_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 162 162 class DomDesignerData; 163 163 class DomSlots; 164 class DomPropertySpecifications; 165 class DomStringPropertySpecification; 164 166 165 167 /******************************************************************************* … … 1016 1018 void clearElementSlots(); 1017 1019 1020 inline DomPropertySpecifications* elementPropertyspecifications() const { return m_propertyspecifications; } 1021 DomPropertySpecifications* takeElementPropertyspecifications(); 1022 void setElementPropertyspecifications(DomPropertySpecifications* a); 1023 inline bool hasElementPropertyspecifications() const { return m_children & Propertyspecifications; } 1024 void clearElementPropertyspecifications(); 1025 1018 1026 private: 1019 1027 QString m_text; … … 1034 1042 DomProperties* m_properties; 1035 1043 DomSlots* m_slots; 1044 DomPropertySpecifications* m_propertyspecifications; 1036 1045 enum Child { 1037 1046 Class = 1, … … 1045 1054 Script = 256, 1046 1055 Properties = 512, 1047 Slots = 1024 1056 Slots = 1024, 1057 Propertyspecifications = 2048 1048 1058 }; 1049 1059 … … 3687 3697 }; 3688 3698 3699 class QDESIGNER_UILIB_EXPORT DomPropertySpecifications { 3700 public: 3701 DomPropertySpecifications(); 3702 ~DomPropertySpecifications(); 3703 3704 void read(QXmlStreamReader &reader); 3705 #ifdef QUILOADER_QDOM_READ 3706 void read(const QDomElement &node); 3707 #endif 3708 void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; 3709 inline QString text() const { return m_text; } 3710 inline void setText(const QString &s) { m_text = s; } 3711 3712 // attribute accessors 3713 // child element accessors 3714 inline QList<DomStringPropertySpecification*> elementStringpropertyspecification() const { return m_stringpropertyspecification; } 3715 void setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a); 3716 3717 private: 3718 QString m_text; 3719 void clear(bool clear_all = true); 3720 3721 // attribute data 3722 // child element data 3723 uint m_children; 3724 QList<DomStringPropertySpecification*> m_stringpropertyspecification; 3725 enum Child { 3726 Stringpropertyspecification = 1 3727 }; 3728 3729 DomPropertySpecifications(const DomPropertySpecifications &other); 3730 void operator = (const DomPropertySpecifications&other); 3731 }; 3732 3733 class QDESIGNER_UILIB_EXPORT DomStringPropertySpecification { 3734 public: 3735 DomStringPropertySpecification(); 3736 ~DomStringPropertySpecification(); 3737 3738 void read(QXmlStreamReader &reader); 3739 #ifdef QUILOADER_QDOM_READ 3740 void read(const QDomElement &node); 3741 #endif 3742 void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; 3743 inline QString text() const { return m_text; } 3744 inline void setText(const QString &s) { m_text = s; } 3745 3746 // attribute accessors 3747 inline bool hasAttributeName() const { return m_has_attr_name; } 3748 inline QString attributeName() const { return m_attr_name; } 3749 inline void setAttributeName(const QString& a) { m_attr_name = a; m_has_attr_name = true; } 3750 inline void clearAttributeName() { m_has_attr_name = false; } 3751 3752 inline bool hasAttributeType() const { return m_has_attr_type; } 3753 inline QString attributeType() const { return m_attr_type; } 3754 inline void setAttributeType(const QString& a) { m_attr_type = a; m_has_attr_type = true; } 3755 inline void clearAttributeType() { m_has_attr_type = false; } 3756 3757 inline bool hasAttributeNotr() const { return m_has_attr_notr; } 3758 inline QString attributeNotr() const { return m_attr_notr; } 3759 inline void setAttributeNotr(const QString& a) { m_attr_notr = a; m_has_attr_notr = true; } 3760 inline void clearAttributeNotr() { m_has_attr_notr = false; } 3761 3762 // child element accessors 3763 private: 3764 QString m_text; 3765 void clear(bool clear_all = true); 3766 3767 // attribute data 3768 QString m_attr_name; 3769 bool m_has_attr_name; 3770 3771 QString m_attr_type; 3772 bool m_has_attr_type; 3773 3774 QString m_attr_notr; 3775 bool m_has_attr_notr; 3776 3777 // child element data 3778 uint m_children; 3779 3780 DomStringPropertySpecification(const DomStringPropertySpecification &other); 3781 void operator = (const DomStringPropertySpecification&other); 3782 }; 3783 3689 3784 3690 3785 #ifdef QFORMINTERNAL_NAMESPACE -
trunk/tools/designer/src/lib/uilib/uilib.pri
r2 r561 3 3 4 4 DEFINES += QT_DESIGNER 5 !contains(QT_CONFIG, script): DEFINES += QT_FORMBUILDER_NO_SCRIPT 5 6 6 7 # Input -
trunk/tools/designer/src/lib/uilib/uilib_global.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 **
Note:
See TracChangeset
for help on using the changeset viewer.