42 #include "private/qdeclarativebinding_p.h" 43 #include "private/qdeclarativebinding_p_p.h" 48 #include "private/qdeclarativecontext_p.h" 49 #include "private/qdeclarativecompiler_p.h" 50 #include "private/qdeclarativedata_p.h" 51 #include "private/qdeclarativestringconverters_p.h" 52 #include "private/qdeclarativestate_p_p.h" 53 #include "private/qdeclarativedebugtrace_p.h" 56 #include <QtCore/qdebug.h> 61 : m_object(0), m_propertyIndex(-1), m_mePtr(0), m_prevBinding(0), m_nextBinding(0)
113 if (index & 0xFF000000) {
116 int coreIndex = index & 0xFFFFFF;
161 if (index & 0xFF000000) {
212 if (enabled)
update(flags);
224 : updating(false),
enabled(false), deleted(0)
311 d->setEvaluateFlags(QDeclarativeQtScriptExpression::EvaluateFlags(static_cast<int>(flags)));
317 return QDeclarativeBinding::EvaluateFlags(static_cast<int>(
d->evaluateFlags()));
340 if (!
d->enabled || !
d->context() || !
d->context()->isValid())
346 bool wasDeleted =
false;
347 d->deleted = &wasDeleted;
349 if (
d->property.propertyType() == qMetaTypeId<QDeclarativeBinding *>()) {
351 int idx =
d->property.index();
356 void *
a[] = { &t, 0, &
status, &flags };
367 bool isUndefined =
false;
376 }
else if (scriptValue.
isNull() &&
392 if (
d->error.isValid()) {
394 }
else if (isUndefined &&
d->property.isResettable()) {
398 }
else if (isUndefined &&
d->property.propertyType() == qMetaTypeId<QVariant>()) {
402 }
else if (isUndefined) {
408 d->error.setUrl(url);
409 d->error.setLine(line);
410 d->error.setColumn(-1);
411 d->error.setDescription(
QLatin1String(
"Unable to assign [undefined] to ") +
421 d->error.setUrl(url);
422 d->error.setLine(line);
423 d->error.setColumn(-1);
424 d->error.setDescription(
QLatin1String(
"Unable to assign a function to a property."));
426 }
else if (
d->property.object() &&
436 const char *valueType = 0;
440 d->error.setUrl(url);
441 d->error.setLine(line);
442 d->error.setColumn(-1);
452 if (
d->error.isValid()) {
453 if (!
d->addError(ep)) ep->
warning(this->error());
462 qmlInfo(
d->property.object()) <<
tr(
"Binding loop detected for property \"%1\"").
arg(
d->property.name());
501 :
m_object(o), m_index(index), m_bindings(0)
The QVariant class acts like a union for the most common Qt data types.
void setBindingBit(QObject *obj, int)
bool isNull() const
Returns true if this QScriptValue is of the primitive type Null; otherwise returns false...
static QDeclarativeData * get(const QObject *object, bool create=false)
#define QT_END_NAMESPACE
This macro expands to.
bool isFunction() const
Returns true if this QScriptValue is a function; otherwise returns false.
QDeclarativeEngine * engine
QDeclarativeEngine * engine() const
Returns the QDeclarativeEngine this expression is associated with, or 0 if there is no association or...
static void rangeLocation(RangeType, const QString &, int)
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
~QDeclarativeBindingProfiler()
int propertyIndex() const
QDeclarativeCompiledData * compiledData() const
void addToObject(QObject *, int)
Add this binding to object.
void setTarget(const QDeclarativeProperty &)
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
QWeakPointer< T > toWeakRef() const
Returns a weak reference object that shares the pointer referenced by this object.
QDeclarativeAbstractBinding * bindings
static LibLoadStatus status
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
virtual void emitValueChanged()
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QDeclarativeBindingPrivate()
virtual Type bindingType() const
long ASN1_INTEGER_get ASN1_INTEGER * a
~QDeclarativeValueTypeProxyBinding()
QDeclarativeBindingProfiler(QDeclarativeBinding *bind)
QDeclarativeValueTypeProxyBinding(QObject *o, int coreIndex)
The QUrl class provides a convenient interface for working with URLs.
QDeclarativeTypeLoader typeLoader
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
void recursiveEnable(QDeclarativeAbstractBinding *, QDeclarativePropertyPrivate::WriteFlags)
bool hasBindingBit(int) const
virtual void disconnect(DisconnectMode disconnectMode)
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
void clearBindingBit(int)
friend class QDeclarativeValueTypeProxyBinding
void setNotifyOnValueChanged(bool)
Sets whether the valueChanged() signal is emitted when the expression's evaluated value changes...
void setParent(QObject *)
Makes the object a child of parent.
QVariant scriptValueToVariant(const QScriptValue &, int hint=QVariant::Invalid)
static Identifier Invalid
QDeclarativeAbstractBinding()
#define QT_BEGIN_NAMESPACE
This macro expands to.
QDeclarativeBinding(const QString &, QObject *, QDeclarativeContext *, QObject *parent=0)
~QDeclarativeBindingPrivate()
const T & at(int i) const
Returns the item at index position i in the list.
static const char * data(const QByteArray &arr)
virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags)
QDeclarativeAbstractBinding * m_nextBinding
void setEvaluateFlags(EvaluateFlags flags)
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
QDeclarativeAbstractBinding * binding(int propertyIndex)
QDeclarativeObjectScriptClass * objectClass
static void endRange(RangeType)
void removeBindings(quint32 mask)
Removes a collection of bindings, corresponding to the set bits in mask.
static void startRange(RangeType)
QString expression() const
Returns the expression string.
const char * constData() const
Returns a pointer to the data stored in the byte array.
virtual void disconnect(DisconnectMode disconnectMode)=0
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
int userType() const
Returns the storage type of the value stored in the variant.
static void bindingDummyDeleter(QDeclarativeAbstractBinding *)
virtual void disconnect(DisconnectMode disconnectMode)
void removeFromObject()
Remove the binding from the object.
int objectType(const QScriptValue &) const
bool isRegExp() const
Returns true if this QScriptValue is an object of the RegExp class; otherwise returns false...
QObject * parent() const
Returns a pointer to the parent object.
QDeclarativeAbstractBinding * m_bindings
QString sourceFile() const
Returns the source file URL for this expression.
virtual QString expression() const
virtual QString expression() const
static void rangeData(RangeType, const QString &)
static const char * get(QDBusError::ErrorType code)
T qvariant_cast(const QVariant &)
The QDeclarativeContext class defines a context within a QML engine.
virtual ~QDeclarativeAbstractBinding()
void recursiveDisable(QDeclarativeAbstractBinding *)
QDeclarativeTypeData * get(const QUrl &url)
Returns a QDeclarativeTypeData for the specified url.
The QDeclarativeProperty class abstracts accessing properties on objects created from QML...
QSharedPointer< QDeclarativeAbstractBinding > m_selfPointer
QDeclarativeProperty property() const
The QDeclarativeExpression class evaluates JavaScript in a QML context.
QDeclarativeAbstractBinding ** m_prevBinding
QDeclarativeInfo qmlInfo(const QObject *me)
void warning(const QDeclarativeError &)
The QScriptValue class acts as a container for the Qt Script data types.
bool isNull() const
Returns true if this object is holding a reference to a null pointer.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags flags)
static QDeclarativeBinding * createBinding(Identifier, QObject *, QDeclarativeContext *, const QString &, int, QObject *parent=0)
EvaluateFlags evaluateFlags() const
The QList class is a template class that provides lists.
QList< QByteArray > datas
static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &, QDeclarativeContextData *, WriteFlags flags=0)
QDeclarativeAbstractBinding ** m_mePtr
static QDeclarativeContextData * get(QDeclarativeContext *context)