42 #include "private/qdeclarativepropertychanges_p.h" 44 #include "private/qdeclarativeopenmetaobject_p.h" 45 #include "private/qdeclarativerewrite_p.h" 46 #include "private/qdeclarativeengine_p.h" 47 #include "private/qdeclarativecompiler_p.h" 60 #include <QtCore/qdebug.h> 62 #include <private/qobject_p.h> 164 if (ownedExpression == expression)
171 if (ownedExpression == reverseExpression)
196 if (ownedExpression == rewindExpression)
206 if (other->typeName() !=
typeName())
208 if (static_cast<QDeclarativeReplaceSignalHandler*>(other)->property ==
property)
257 for (
int ii = 0; ii < values.
count(); ++ii) {
260 if (value.
userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) {
261 error(qvariant_cast<QDeclarativeCustomParserNode>(value),
264 }
else if(value.
userType() == qMetaTypeId<QDeclarativeCustomParserProperty>()) {
269 compileList(list, pre, prop);
281 for(
int ii = 0; ii < props.
count(); ++ii)
288 for(
int ii = 0; ii < data.
count(); ++ii) {
309 id = rewriteBinding(expression, data.
at(ii).first);
332 for (
int ii = 0; ii < count; ++ii) {
347 if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
348 expression->
setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
353 }
else if (isScript) {
356 if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
357 expression->
setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
385 for(
int ii = 0; ii <
d->expressions.count(); ++ii)
386 delete d->expressions.at(ii).expression;
387 for(
int ii = 0; ii <
d->signalReplacements.count(); ++ii)
388 delete d->signalReplacements.at(ii);
450 for (
int ii = 0; ii <
d->properties.count(); ++ii) {
455 if (
a.property.isValid()) {
461 for (
int ii = 0; ii <
d->signalReplacements.count(); ++ii) {
472 for (
int ii = 0; ii <
d->expressions.count(); ++ii) {
474 const QString &
property =
d->expressions.at(ii).name;
486 a.
toValue =
d->expressions.at(ii).expression->evaluate();
533 return d->isExplicit;
547 QListIterator<PropertyEntry> propertyIterator(
d->properties);
548 while (propertyIterator.hasNext()) {
549 const PropertyEntry &entry = propertyIterator.next();
550 if (entry.first == name) {
563 QListIterator<ExpressionEntry> expressionIterator(
d->expressions);
564 while (expressionIterator.hasNext()) {
565 const ExpressionEntry &entry = expressionIterator.next();
566 if (entry.name == name) {
585 QMutableListIterator<ExpressionEntry> expressionIterator(
d->expressions);
586 while (expressionIterator.hasNext()) {
587 const ExpressionEntry &entry = expressionIterator.next();
588 if (entry.name == name) {
589 expressionIterator.remove();
596 d->property(name).write(value);
599 d->properties.append(PropertyEntry(name, value));
604 QMutableListIterator<PropertyEntry> propertyIterator(
d->properties);
605 while (propertyIterator.hasNext()) {
606 PropertyEntry &entry = propertyIterator.next();
607 if (entry.first == name) {
608 entry.second =
value;
610 d->property(name).write(value);
623 propertyIterator.insert(PropertyEntry(name, value));
629 d->property(name).write(value);
639 bool hadValue =
false;
641 QMutableListIterator<PropertyEntry> propertyIterator(
d->properties);
642 while (propertyIterator.hasNext()) {
643 PropertyEntry &entry = propertyIterator.next();
644 if (entry.first == name) {
645 propertyIterator.remove();
651 QMutableListIterator<ExpressionEntry> expressionIterator(
d->expressions);
652 while (expressionIterator.hasNext()) {
653 const ExpressionEntry &entry = expressionIterator.next();
654 if (entry.name == name) {
655 entry.expression->setExpression(expression);
720 QListIterator<PropertyEntry> propertyIterator(
d->properties);
721 while (propertyIterator.hasNext()) {
722 const PropertyEntry &entry = propertyIterator.next();
723 if (entry.first == name) {
728 QListIterator<ExpressionEntry> expressionIterator(
d->expressions);
729 while (expressionIterator.hasNext()) {
730 const ExpressionEntry &entry = expressionIterator.next();
731 if (entry.name == name) {
732 return QVariant(entry.expression->expression());
745 QMutableListIterator<ExpressionEntry> expressionIterator(
d->expressions);
746 while (expressionIterator.hasNext()) {
747 const ExpressionEntry &entry = expressionIterator.next();
748 if (entry.name == name) {
749 expressionIterator.remove();
755 QMutableListIterator<PropertyEntry> propertyIterator(
d->properties);
756 while (propertyIterator.hasNext()) {
757 const PropertyEntry &entry = propertyIterator.next();
758 if (entry.first == name) {
759 propertyIterator.remove();
771 QListIterator<PropertyEntry> propertyIterator(
d->properties);
772 while (propertyIterator.hasNext()) {
773 const PropertyEntry &entry = propertyIterator.next();
774 if (entry.first == name) {
787 QListIterator<ExpressionEntry> expressionIterator(
d->expressions);
788 while (expressionIterator.hasNext()) {
789 const ExpressionEntry &entry = expressionIterator.next();
790 if (entry.name == name) {
791 return entry.expression->expression();
The QVariant class acts like a union for the most common Qt data types.
virtual QByteArray compile(const QList< QDeclarativeCustomParserProperty > &)
void changeValue(const QString &name, const QVariant &value)
virtual void copyOriginals(QDeclarativeActionEvent *other)
virtual void setCustomData(QObject *, const QByteArray &)
QDeclarativeGuard< QDeclarativeExpression > ownedExpression
static QDeclarativeData * get(const QObject *object, bool create=false)
QDeclarativeProperty property
#define QT_END_NAMESPACE
This macro expands to.
void setObject(QObject *)
void compileList(QList< QPair< QByteArray, QVariant > > &list, const QByteArray &pre, const QDeclarativeCustomParserProperty &prop)
QDeclarativeExpression * expression
The QByteArray class provides an array of bytes.
void removeProperty(const QString &name)
void setTarget(const QDeclarativeProperty &)
bool containsProperty(const QString &name) const
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
static QDeclarativeAbstractBinding * binding(QObject *, int coreIndex, int valueTypeIndex)
QDeclarativePropertyChangesPrivate()
QList< QVariant > assignedValues() const
void removeAllEntriesFromRevertList(QObject *target)
QDeclarativeProperty property
virtual void saveOriginals()
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
long ASN1_INTEGER_get ASN1_INTEGER * a
QVariant evaluate(bool *valueIsUndefined=0)
Evaulates the expression, returning the result of the evaluation, or an invalid QVariant if the expre...
int count(const T &t) const
Returns the number of occurrences of value in the list.
Type type() const
Returns the type of the property.
~QDeclarativePropertyChanges()
void setRestoreEntryValues(bool)
The QString class provides a Unicode character string.
QDeclarativeExpression * rewindExpression
QDeclarativeExpression * reverseExpression
The QObject class is the base class of all Qt objects.
Q_DECLARATIVE_EXPORT QDeclarativeContext * qmlContext(const QObject *)
bool isValid() const
Returns true if the QDeclarativeProperty refers to a valid property, otherwise false.
bool containsValue(const QString &name) const
static QObjectPrivate * get(QObject *o)
void addEntriesToRevertList(const QList< QDeclarativeAction > &actions)
virtual ActionList actions()
static Identifier Invalid
QDeclarativeExpression * expression
#define QT_BEGIN_NAMESPACE
This macro expands to.
QList< ExpressionChange > expressions
const T & at(int i) const
Returns the item at index position i in the list.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
QDeclarativeReplaceSignalHandler()
~QDeclarativeReplaceSignalHandler()
QDeclarativeState * state() const
QDeclarativePropertyChanges()
static const char * data(const QByteArray &arr)
static QDeclarativeExpression * signalExpression(const QDeclarativeProperty &that)
Returns the expression associated with this signal property, or 0 if no signal expression exists...
QWeakPointer< QDeclarativeAbstractBinding > toBinding
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
ExpressionChange(const QString &_name, QDeclarativeBinding::Identifier _id, QDeclarativeExpression *_expr)
bool changeBindingInRevertList(QObject *target, const QString &name, QDeclarativeAbstractBinding *binding)
QString expression() const
Returns the expression string.
int lineNumber() const
Returns the source file line number for this expression.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
QVariant value(const QString &name) const
int userType() const
Returns the storage type of the value stored in the variant.
#define Q_DECLARE_PUBLIC(Class)
QVariant property(const QString &name) const
bool removeEntryFromRevertList(QObject *target, const QString &name)
QString expression(const QString &name) const
void addEntryToRevertList(const QDeclarativeAction &action)
QDeclarativeProperty property(const QString &)
QDeclarativeBinding::Identifier id
virtual void reverse(Reason)
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
virtual void execute(Reason)
QString sourceFile() const
Returns the source file URL for this expression.
QObject * specifiedObject
bool restoreEntryValues() const
virtual void saveCurrentValues()
void changeExpression(const QString &name, const QString &expression)
bool isWritable() const
Returns true if the property is writable, otherwise false.
T qvariant_cast(const QVariant &)
static const QCssKnownValue properties[NumProperties - 1]
void setSourceLocation(const QString &fileName, int line)
Set the location of this expression to line of url.
QDeclarativeGuard< QObject > object
The QDeclarativeProperty class abstracts accessing properties on objects created from QML...
QString specifiedProperty
virtual QString typeName() const
static QDeclarativeExpression * setSignalExpression(const QDeclarativeProperty &that, QDeclarativeExpression *)
Set the signal expression associated with this signal property to expr.
QDeclarativeActionEvent * event
The QDataStream class provides serialization of binary data to a QIODevice.
The QDeclarativeExpression class evaluates JavaScript in a QML context.
QDeclarativeInfo qmlInfo(const QObject *me)
QImageIOHandler * handler
bool containsExpression(const QString &name) const
static QDeclarativeBinding * createBinding(Identifier, QObject *, QDeclarativeContext *, const QString &, int, QObject *parent=0)
virtual bool isReversable()
QList< QPair< QString, QVariant > > properties
QVariant read() const
Returns the property value.
The QList class is a template class that provides lists.
QList< QDeclarativeReplaceSignalHandler * > signalReplacements