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:
22 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/designer/src/lib/uilib/abstractformbuilder.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**sw
     
    136136    implementation for constructing forms from user interface
    137137    files. It is not intended to be instantiated directly. Use the
    138     QFormBuilder class to create user interfaces from \c{.ui} files at
     138    QFormBuilder class to create user interfaces from UI files at
    139139    run-time. For example:
    140140
     
    146146
    147147    \list
    148     \o load() handles reading of \c{.ui} format files from arbitrary
     148    \o load() handles reading of UI format files from arbitrary
    149149       QIODevices, and construction of widgets from the XML data
    150150       that they contain.
    151     \o save() handles saving of widget details in \c{.ui} format to
     151    \o save() handles saving of widget details in UI format to
    152152       arbitrary QIODevices.
    153153    \o workingDirectory() and setWorkingDirectory() control the
     
    209209    }
    210210    if (reader.hasError()) {
    211         uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the ui file 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")
    212212                                .arg(reader.lineNumber()).arg(reader.columnNumber())
    213213                                .arg(reader.errorString()));
     
    215215    }
    216216    if (!initialized) {
    217         uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid ui file: The root element <ui> is missing."));
     217        uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid UI file: The root element <ui> is missing."));
    218218        return 0;
    219219    }
     
    286286            QFormBuilderExtra *formBuilderPrivate = QFormBuilderExtra::instance(this);
    287287            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);
    305290        }
    306291    }
     
    404389        return 0;
    405390
     391    m_actions.insert(ui_action->attributeName(), a);
    406392    applyProperties(a, ui_action->elementProperty());
    407393    return a;
     
    416402    if (!a)
    417403        return 0;
    418 
     404    m_actionGroups.insert(ui_action_group->attributeName(), a);
    419405    applyProperties(a, ui_action_group->elementProperty());
    420406
     
    657643
    658644#ifdef Q_OS_MAC
    659     // here we recognize ui file < 4.3 (no we don't store margin property)
     645    // here we recognize UI file < 4.3 (no we don't store margin property)
    660646    if (mar != INT_MIN) {
    661647        const int defaultMargin = parent->inherits("QLayoutWidget") ? 0 : 9;
     
    11851171    QAction *action = new QAction(parent);
    11861172    action->setObjectName(name);
    1187     m_actions.insert(name, action);
    1188 
    11891173    return action;
    11901174}
     
    11971181    QActionGroup *g = new QActionGroup(parent);
    11981182    g->setObjectName(name);
    1199     m_actionGroups.insert(name, g);
    1200 
    12011183    return g;
    12021184}
     
    12061188
    12071189    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.
    12091191
    12101192    \sa load()*/
     
    17021684
    17031685template<class T>
     1686static 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.
     1703template<class T>
    17041704static void storeItemProps(QAbstractFormBuilder *abstractFormBuilder, const T *item,
    17051705        QList<DomProperty*> *properties)
     
    17271727
    17281728template<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>
    17441729static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const T *item,
    17451730        QList<DomProperty*> *properties)
     
    17931778        item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toAscii()));
    17941779}
     1780
     1781#else
     1782
     1783static 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
     1807static 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
     1831static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const QTableWidgetItem *item,
     1832        QList<DomProperty*> *properties)
     1833{
     1834    storeItemProps(abstractFormBuilder, item, properties);
     1835    storeItemFlags(item, properties);
     1836}
     1837
     1838static void storeItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, const QListWidgetItem *item,
     1839        QList<DomProperty*> *properties)
     1840{
     1841    storeItemProps(abstractFormBuilder, item, properties);
     1842    storeItemFlags(item, properties);
     1843}
     1844
     1845static 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
     1875static 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
     1905static 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
     1918static 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
    17951932
    17961933/*!
     
    21462283        const DomPropertyHash properties = propertyMap(ui_item->elementProperty());
    21472284        QListWidgetItem *item = new QListWidgetItem(listWidget);
     2285#ifndef Q_CC_RVCT
    21482286        loadItemPropsNFlags<QListWidgetItem>(this, item, properties);
     2287#else
     2288        loadItemPropsNFlags(this, item, properties);
     2289#endif       
    21492290    }
    21502291
     
    26702811}
    26712812
    2672 namespace {
    2673     // set forward slashes in image path.
    2674     inline void fixImagePath(QString &p)    {
    2675         p.replace(QLatin1Char('\\'), QLatin1Char('/'));
    2676     }
    2677 }
    2678 
    26792813/*!
    26802814    \internal
  • trunk/tools/designer/src/lib/uilib/abstractformbuilder.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/container.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/customwidget.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/formbuilder.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5858
    5959    \brief The QFormBuilder class is used to dynamically construct
    60     user interfaces from .ui files at run-time.
     60    user interfaces from UI files at run-time.
    6161
    6262    \inmodule QtDesigner
    6363
    6464    The QFormBuilder class provides a mechanism for dynamically
    65     creating user interfaces at run-time, based on \c{.ui} files
     65    creating user interfaces at run-time, based on UI files
    6666    created with \QD. For example:
    6767
     
    121121QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
    122122{
    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);
    124129    if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative()
    125130            && parentWidget
     
    145150            && !qobject_cast<QDockWidget *>(parentWidget)
    146151#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    }
    149157    return QAbstractFormBuilder::create(ui_widget, parentWidget);
    150158}
     
    228236    if (qobject_cast<QDialog *>(w))
    229237        w->setParent(parentWidget);
    230 
    231     if (!fb->rootWidget())
    232         fb->setRootWidget(w);
    233238
    234239    return w;
     
    370375QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget)
    371376{
     377    QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
    372378    // Is this a temporary layout widget used to represent QLayout hierarchies in Designer?
    373379    // Set its margins to 0.
    374     bool layoutWidget = QFormBuilderExtra::instance(this)->processingLayoutWidget();
     380    bool layoutWidget = fb->processingLayoutWidget();
    375381    QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget);
    376382    if (layoutWidget) {
     
    393399
    394400        l->setContentsMargins(left, top, right, bottom);
    395         QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false);
     401        fb->setProcessingLayoutWidget(false);
    396402    }
    397403    return l;
     
    526532    \internal
    527533*/
     534
    528535void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties)
    529536{
     
    543550
    544551        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());
    548556        } 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) {
    550558            // ### special-casing for Line (QFrame) -- try to fix me
    551559            o->setProperty("frameShape", v); // v is of QFrame::Shape enum
  • trunk/tools/designer/src/lib/uilib/formbuilder.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/formbuilderextra.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6666}
    6767
     68
     69QFormBuilderExtra::CustomWidgetData::CustomWidgetData() :
     70    isContainer(false)
     71{
     72}
     73
     74QFormBuilderExtra::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
    6885QFormBuilderExtra::QFormBuilderExtra() :
    6986    m_layoutWidget(false),
     
    8299{
    83100    m_buddies.clear();
    84     m_rootWidget = 0;
     101    m_parentWidget = 0;
     102    m_parentWidgetIsSet = false;
    85103#ifndef QT_FORMBUILDER_NO_SCRIPT
    86104    m_FormScriptRunner.clearErrors();
    87     m_customWidgetScriptHash.clear();
    88105#endif
     106    m_customWidgetDataHash.clear();
    89107    m_buttonGroups.clear();
    90108}
     
    137155}
    138156
    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;
     157const QPointer<QWidget> &QFormBuilderExtra::parentWidget() const
     158{
     159    return m_parentWidget;
     160}
     161
     162bool QFormBuilderExtra::parentWidgetIsSet() const
     163{
     164    return m_parentWidgetIsSet;
     165}
     166
     167void 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;
    147172}
    148173
     
    153178}
    154179
    155 void QFormBuilderExtra::storeCustomWidgetScript(const QString &className, const QString &script)
    156 {
    157     m_customWidgetScriptHash.insert(className, script);
    158 }
    159 
    160180QString QFormBuilderExtra::customWidgetScript(const QString &className) const
    161181{
    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();
    166186}
    167187
    168188#endif
    169189
    170 void QFormBuilderExtra::storeCustomWidgetBaseClass(const QString &className, const QString &baseClassName)
    171 {
    172     m_customWidgetBaseClassHash.insert(className, baseClassName);
     190void QFormBuilderExtra::storeCustomWidgetData(const QString &className, const DomCustomWidget *d)
     191{
     192    if (d)
     193        m_customWidgetDataHash.insert(className, CustomWidgetData(d));
    173194}
    174195
    175196QString QFormBuilderExtra::customWidgetBaseClass(const QString &className) const
    176197{
    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();
    186202}
    187203
    188204QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) const
    189205{
    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
     212bool 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;
    194218}
    195219
  • trunk/tools/designer/src/lib/uilib/formbuilderextra_p.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8383class DomButtonGroups;
    8484class DomButtonGroup;
     85class DomCustomWidget;
    8586
    8687class QAbstractFormBuilder;
     
    9394    ~QFormBuilderExtra();
    9495public:
     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
    95106    void clear();
    96107
     
    102113    static bool applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label);
    103114
    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);
    106118
    107119#ifndef QT_FORMBUILDER_NO_SCRIPT
    108120    QFormScriptRunner &formScriptRunner();
    109     void storeCustomWidgetScript(const QString &className, const QString &script);
    110121    QString customWidgetScript(const QString &className) const;
    111122#endif
     
    123134    static void removeInstance(const QAbstractFormBuilder *afb);
    124135
    125     void storeCustomWidgetAddPageMethod(const QString &className, const QString &ct);
     136    void storeCustomWidgetData(const QString &className, const DomCustomWidget *d);
    126137    QString customWidgetAddPageMethod(const QString &className) const;
    127 
    128     void storeCustomWidgetBaseClass(const QString &className, const QString &baseClassName);
    129138    QString customWidgetBaseClass(const QString &className) const;
     139    bool isCustomWidgetContainer(const QString &className) const;
    130140
    131141    // --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group
     
    169179#ifndef QT_FORMBUILDER_NO_SCRIPT
    170180    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;
    178184
    179185    ButtonGroupHash m_buttonGroups;
     
    183189    QTextBuilder *m_textBuilder;
    184190
    185     QPointer<QWidget> m_rootWidget;
     191    QPointer<QWidget> m_parentWidget;
     192    bool m_parentWidgetIsSet;
    186193};
    187194
  • trunk/tools/designer/src/lib/uilib/formscriptrunner.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/formscriptrunner_p.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/properties.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/properties_p.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/qdesignerexportwidget.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/resourcebuilder.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    9999                QIcon icon;
    100100                if (flags & NormalOff)
    101                     icon.addPixmap(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QIcon::Normal, QIcon::Off);
     101                    icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::Off);
    102102                if (flags & NormalOn)
    103                     icon.addPixmap(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QIcon::Normal, QIcon::On);
     103                    icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::On);
    104104                if (flags & DisabledOff)
    105                     icon.addPixmap(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QIcon::Disabled, QIcon::Off);
     105                    icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::Off);
    106106                if (flags & DisabledOn)
    107                     icon.addPixmap(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QIcon::Disabled, QIcon::On);
     107                    icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::On);
    108108                if (flags & ActiveOff)
    109                     icon.addPixmap(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QIcon::Active, QIcon::Off);
     109                    icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::Off);
    110110                if (flags & ActiveOn)
    111                     icon.addPixmap(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QIcon::Active, QIcon::On);
     111                    icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::On);
    112112                if (flags & SelectedOff)
    113                     icon.addPixmap(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QIcon::Selected, QIcon::Off);
     113                    icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::Off);
    114114                if (flags & SelectedOn)
    115                     icon.addPixmap(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QIcon::Selected, QIcon::On);
     115                    icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::On);
    116116                return qVariantFromValue(icon);
    117117            } else { // 4.3 legacy
  • trunk/tools/designer/src/lib/uilib/resourcebuilder_p.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/textbuilder.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/textbuilder_p.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/designer/src/lib/uilib/ui4.cpp

    r2 r561  
    22**
    33** 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)
    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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    23692369    delete m_properties;
    23702370    delete m_slots;
     2371    delete m_propertyspecifications;
    23712372
    23722373    if (clear_all) {
     
    23822383    m_properties = 0;
    23832384    m_slots = 0;
     2385    m_propertyspecifications = 0;
    23842386}
    23852387
     
    23942396    m_properties = 0;
    23952397    m_slots = 0;
     2398    m_propertyspecifications = 0;
    23962399}
    23972400
     
    24042407    delete m_properties;
    24052408    delete m_slots;
     2409    delete m_propertyspecifications;
    24062410}
    24072411
     
    24692473                continue;
    24702474            }
     2475            if (tag == QLatin1String("propertyspecifications")) {
     2476                DomPropertySpecifications *v = new DomPropertySpecifications();
     2477                v->read(reader);
     2478                setElementPropertyspecifications(v);
     2479                continue;
     2480            }
    24712481            reader.raiseError(QLatin1String("Unexpected element ") + tag);
    24722482        }
     
    25492559                continue;
    25502560            }
     2561            if (tag == QLatin1String("propertyspecifications")) {
     2562                DomPropertySpecifications *v = new DomPropertySpecifications();
     2563                v->read(e);
     2564                setElementPropertyspecifications(v);
     2565                continue;
     2566            }
    25512567    }
    25522568    m_text.clear();
     
    26062622    }
    26072623
     2624    if (m_children & Propertyspecifications) {
     2625        m_propertyspecifications->write(writer, QLatin1String("propertyspecifications"));
     2626    }
     2627
    26082628    if (!m_text.isEmpty())
    26092629        writer.writeCharacters(m_text);
     
    27322752}
    27332753
     2754DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications()
     2755{
     2756    DomPropertySpecifications* a = m_propertyspecifications;
     2757    m_propertyspecifications = 0;
     2758    m_children ^= Propertyspecifications;
     2759    return a;
     2760}
     2761
     2762void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications* a)
     2763{
     2764    delete m_propertyspecifications;
     2765    m_children |= Propertyspecifications;
     2766    m_propertyspecifications = a;
     2767}
     2768
    27342769void DomCustomWidget::clearElementClass()
    27352770{
     
    27972832    m_slots = 0;
    27982833    m_children &= ~Slots;
     2834}
     2835
     2836void DomCustomWidget::clearElementPropertyspecifications()
     2837{
     2838    delete m_propertyspecifications;
     2839    m_propertyspecifications = 0;
     2840    m_children &= ~Propertyspecifications;
    27992841}
    28002842
     
    1088410926}
    1088510927
     10928void 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
     10940DomPropertySpecifications::DomPropertySpecifications()
     10941{
     10942    m_children = 0;
     10943}
     10944
     10945DomPropertySpecifications::~DomPropertySpecifications()
     10946{
     10947    qDeleteAll(m_stringpropertyspecification);
     10948    m_stringpropertyspecification.clear();
     10949}
     10950
     10951void 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
     10981void 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
     11003void 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
     11017void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a)
     11018{
     11019    m_children |= Stringpropertyspecification;
     11020    m_stringpropertyspecification = a;
     11021}
     11022
     11023void 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
     11036DomStringPropertySpecification::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
     11044DomStringPropertySpecification::~DomStringPropertySpecification()
     11045{
     11046}
     11047
     11048void 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
     11089void 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
     11112void 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
    1088611131QT_END_NAMESPACE
    1088711132
  • trunk/tools/designer/src/lib/uilib/ui4_p.h

    r2 r561  
    22**
    33** 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)
    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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    162162class DomDesignerData;
    163163class DomSlots;
     164class DomPropertySpecifications;
     165class DomStringPropertySpecification;
    164166
    165167/*******************************************************************************
     
    10161018    void clearElementSlots();
    10171019
     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
    10181026private:
    10191027    QString m_text;
     
    10341042    DomProperties* m_properties;
    10351043    DomSlots* m_slots;
     1044    DomPropertySpecifications* m_propertyspecifications;
    10361045    enum Child {
    10371046        Class = 1,
     
    10451054        Script = 256,
    10461055        Properties = 512,
    1047         Slots = 1024
     1056        Slots = 1024,
     1057        Propertyspecifications = 2048
    10481058    };
    10491059
     
    36873697};
    36883698
     3699class QDESIGNER_UILIB_EXPORT DomPropertySpecifications {
     3700public:
     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
     3717private:
     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
     3733class QDESIGNER_UILIB_EXPORT DomStringPropertySpecification {
     3734public:
     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
     3763private:
     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
    36893784
    36903785#ifdef QFORMINTERNAL_NAMESPACE
  • trunk/tools/designer/src/lib/uilib/uilib.pri

    r2 r561  
    33
    44DEFINES += QT_DESIGNER
     5!contains(QT_CONFIG, script): DEFINES += QT_FORMBUILDER_NO_SCRIPT
    56
    67# Input
  • trunk/tools/designer/src/lib/uilib/uilib_global.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the Qt Designer 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
Note: See TracChangeset for help on using the changeset viewer.