Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    927927
    928928// ---- PropertyListCommand
    929 PropertyListCommand::PropertyListCommand(QDesignerFormWindowInterface *formWindow) :
    930     QDesignerFormWindowCommand(QString(), formWindow)
     929PropertyListCommand::PropertyListCommand(QDesignerFormWindowInterface *formWindow,
     930                                         QUndoCommand *parent) :
     931    QDesignerFormWindowCommand(QString(), formWindow, parent)
    931932{
    932933}
     
    967968            return false;
    968969    }
    969     m_propertyHelperList.push_back(PropertyHelper(object, m_propertyDescription.m_specialProperty, sheet, index));
     970
     971    const PropertyHelperPtr ph(createPropertyHelper(object, m_propertyDescription.m_specialProperty, sheet, index));
     972    m_propertyHelperList.push_back(ph);
    970973    return true;
    971974}
    972975
     976
     977
     978
     979
     980
    973981
    974982// Init from a list and make sure referenceObject is added first to obtain the right property group
     
    9941002{
    9951003    Q_ASSERT(index < m_propertyHelperList.size());
    996     return m_propertyHelperList[index].object();
     1004    return m_propertyHelperListobject();
    9971005}
    9981006
     
    10001008{
    10011009    Q_ASSERT(index < m_propertyHelperList.size());
    1002     return m_propertyHelperList[index].oldValue();
     1010    return m_propertyHelperListoldValue();
    10031011}
    10041012
     
    10061014{
    10071015    Q_ASSERT(index < m_propertyHelperList.size());
    1008     m_propertyHelperList[index].setOldValue(oldValue);
     1016    m_propertyHelperListsetOldValue(oldValue);
    10091017}
    10101018// ----- SetValueFunction: Set a new value when applied to a PropertyHelper.
     
    10661074
    10671075    for (PropertyListIterator it = begin; it != end; ++it) {
    1068         if (QObject* object = it->object()) { // Might have been deleted in the meantime
    1069             const PropertyHelper::Value newValue = function(*it);
    1070             updateMask |= it->updateMask();
     1076        PropertyHelper *ph = it->data();
     1077        if (QObject* object = ph->object()) { // Might have been deleted in the meantime
     1078            const PropertyHelper::Value newValue = function( *ph );
     1079            updateMask |= ph->updateMask();
    10711080            // Update property editor if it is the current object
    10721081            if (!updatedPropertyEditor && propertyEditor && object == propertyEditor->object()) {
     
    10851094{
    10861095    if(debugPropertyCommands)
    1087         qDebug() << "PropertyListCommand::setValue(" << value <<  changed << subPropertyMask << ')';
     1096        qDebug() << "PropertyListCommand::setValue(" << value
     1097                 << changed << subPropertyMask << ')';
    10881098    return changePropertyList(formWindow()->core(),
    1089                               m_propertyDescription.m_propertyName, m_propertyHelperList.begin(), m_propertyHelperList.end(),
     1099                              m_propertyDescription.m_propertyName,
     1100                              m_propertyHelperList.begin(), m_propertyHelperList.end(),
    10901101                              SetValueFunction(formWindow(), PropertyHelper::Value(value, changed), subPropertyMask));
    10911102}
     
    11471158        return false;
    11481159    for (int i = 0; i < m_propertyHelperList.size(); i++) {
    1149         if (!m_propertyHelperList[i].canMerge(other[i]))
     1160        if (!m_propertyHelperList))
    11501161            return false;
    11511162    }
     
    11541165
    11551166// ---- SetPropertyCommand ----
    1156 SetPropertyCommand::SetPropertyCommand(QDesignerFormWindowInterface *formWindow)
    1157     :  PropertyListCommand(formWindow),
     1167SetPropertyCommand::SetPropertyCommand(QDesignerFormWindowInterface *formWindow,
     1168                                       QUndoCommand *parent)
     1169    :  PropertyListCommand(formWindow, parent),
    11581170       m_subPropertyMask(SubPropertyAll)
    11591171{
     
    12111223{
    12121224    if (propertyHelperList().size() == 1) {
    1213         setText(QApplication::translate("Command", "Changed '%1' of '%2'").arg(propertyName()).arg(propertyHelperList()[0].object()->objectName()));
     1225        setText(QApplication::translate("Command", "Changed '%1' of '%2'").arg(propertyName()).arg(propertyHelperList()object()->objectName()));
    12141226    } else {
    12151227        int count = propertyHelperList().size();
     
    12301242{
    12311243    return 1976;
     1244
     1245
     1246
     1247
     1248
    12321249}
    12331250
     
    12491266        return false;
    12501267
    1251     m_newValue = cmd->newValue();
     1268    const QVariant newValue = mergeValue(cmd->newValue());
     1269    if (!newValue.isValid())
     1270        return false;
     1271    m_newValue = newValue;
    12521272    m_subPropertyMask |= cmd->m_subPropertyMask;
    12531273    if(debugPropertyCommands)
     
    12901310{
    12911311    if (propertyHelperList().size() == 1) {
    1292         setText(QApplication::translate("Command", "Reset '%1' of '%2'").arg(propertyName()).arg(propertyHelperList()[0].object()->objectName()));
     1312        setText(QApplication::translate("Command", "Reset '%1' of '%2'").arg(propertyName()).arg(propertyHelperList()object()->objectName()));
    12931313    } else {
    12941314        int count = propertyHelperList().size();
Note: See TracChangeset for help on using the changeset viewer.