Files
qt-creator/share/qtcreator/qml/qmlpuppet/instances/qmlpropertychangesnodeinstance.h

151 lines
5.3 KiB
C
Raw Normal View History

/**************************************************************************
**
** This file is part of Qt Creator
**
2011-01-11 16:28:15 +01:00
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
2011-04-13 08:42:33 +02:00
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
2011-04-13 08:42:33 +02:00
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
2010-12-17 16:01:08 +01:00
** In addition, as a special exception, Nokia gives you certain additional
2011-04-13 08:42:33 +02:00
** rights. These rights are described in the Nokia Qt LGPL Exception
2010-12-17 16:01:08 +01:00
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
2011-04-13 08:42:33 +02:00
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
2010-12-17 16:01:08 +01:00
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef QMLPROPERTYCHANGESNODEINSTANCE_H
#define QMLPROPERTYCHANGESNODEINSTANCE_H
#include "objectnodeinstance.h"
#include <private/qdeclarativestateoperations_p.h>
2010-09-02 18:27:58 +02:00
#include <private/qdeclarativepropertychanges_p.h>
#include <QPair>
#include <QWeakPointer>
2010-04-01 11:17:38 +02:00
QT_BEGIN_NAMESPACE
class QDeclarativeProperty;
2010-04-01 11:17:38 +02:00
QT_END_NAMESPACE
namespace QmlDesigner {
namespace Internal {
class QmlPropertyChangesNodeInstance;
// Original QmlPropertyChanges class requires a custom parser
// work around this by writing a replacement class
2010-09-02 18:27:58 +02:00
//class QmlPropertyChangesObject : public QDeclarativeStateOperation
//{
// Q_OBJECT
// Q_PROPERTY(QObject *target READ targetObject WRITE setTargetObject)
// Q_PROPERTY(bool restoreEntryValues READ restoreEntryValues WRITE setRestoreEntryValues)
// Q_PROPERTY(bool explicit READ isExplicit WRITE setIsExplicit)
2010-09-02 18:27:58 +02:00
// typedef QPair<QString, QWeakPointer<QDeclarativeBinding> > ExpressionPair;
//public:
// ~QmlPropertyChangesObject();
// QObject *targetObject() const;
// void setTargetObject(QObject *object);
2010-09-02 18:27:58 +02:00
// bool restoreEntryValues() const;
// void setRestoreEntryValues(bool restore);
2010-09-02 18:27:58 +02:00
// bool isExplicit() const;
// void setIsExplicit(bool isExplicit);
2010-09-02 18:27:58 +02:00
// virtual ActionList actions();
2010-09-02 18:27:58 +02:00
// void setVariantValue(const QString &name, const QVariant & value);
// void setExpression(const QString &name, const QString &expression);
// void removeVariantValue(const QString &name);
// void removeExpression(const QString &name);
2010-09-02 18:27:58 +02:00
// void resetProperty(const QString &name);
2010-09-02 18:27:58 +02:00
// QVariant variantValue(const QString &name) const;
// QString expression(const QString &name) const;
2010-09-02 18:27:58 +02:00
// bool hasVariantValue(const QString &name) const;
// bool hasExpression(const QString &name) const;
2010-09-02 18:27:58 +02:00
// QmlPropertyChangesObject();
2010-09-02 18:27:58 +02:00
// bool updateStateVariant(const QString &propertyName, const QVariant &value);
// bool updateStateBinding(const QString &propertyName, const QString &expression);
// bool resetStateProperty(const QString &propertyName, const QVariant &resetValue);
2010-09-02 18:27:58 +02:00
// QDeclarativeState *state() const;
// void updateRevertValueAndBinding(const QString &name);
2010-09-02 18:27:58 +02:00
// void removeFromStateRevertList();
// void addToStateRevertList();
2010-09-02 18:27:58 +02:00
//private: // functions
// bool isActive() const;
2010-09-02 18:27:58 +02:00
// QDeclarativeStatePrivate *statePrivate() const;
2010-09-02 18:27:58 +02:00
// QDeclarativeStateGroup *stateGroup() const;
// QDeclarativeProperty createMetaProperty(const QString &property);
2010-09-02 18:27:58 +02:00
// QDeclarativeAction &qmlActionForProperty(const QString &propertyName) const;
// bool hasActionForProperty(const QString &propertyName) const;
// void removeActionForProperty(const QString &propertyName);
2010-09-02 18:27:58 +02:00
// QDeclarativeAction createQDeclarativeAction(const QString &propertyName);
2010-09-02 18:27:58 +02:00
//private: // variables
// QWeakPointer<QObject> m_targetObject;
// bool m_restoreEntryValues;
// bool m_isExplicit;
2010-09-02 18:27:58 +02:00
// mutable ActionList m_qmlActionList;
// QHash<QString, ExpressionPair> m_expressionHash;
//};
class QmlPropertyChangesNodeInstance : public ObjectNodeInstance
{
public:
typedef QSharedPointer<QmlPropertyChangesNodeInstance> Pointer;
typedef QWeakPointer<QmlPropertyChangesNodeInstance> WeakPointer;
static Pointer create(QObject *objectToBeWrapped);
virtual void setPropertyVariant(const QString &name, const QVariant &value);
virtual void setPropertyBinding(const QString &name, const QString &expression);
virtual QVariant property(const QString &name) const;
virtual void resetProperty(const QString &name);
using ObjectNodeInstance::reparent; // keep the virtual reparent(...) method around
void reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty);
protected:
2010-09-02 18:27:58 +02:00
QmlPropertyChangesNodeInstance(QDeclarativePropertyChanges *object);
QDeclarativePropertyChanges *changesObject() const;
};
} // namespace Internal
} // namespace QmlDesigner
2010-09-02 18:27:58 +02:00
//QML_DECLARE_TYPE(QmlDesigner::Internal::QmlPropertyChangesObject)
#endif // QMLPROPERTYCHANGESNODEINSTANCE_H