// { "time", strlen("time"), Object::DynamicProperty::Time },
// { "date", strlen("date"), Object::DynamicProperty::Date },
{ "date", strlen("date"), Object::DynamicProperty::DateTime },
+ { "rect", strlen("rect"), Object::DynamicProperty::Rect },
{ "variant", strlen("variant"), Object::DynamicProperty::Variant },
{ "var", strlen("var"), Object::DynamicProperty::Var }
};
DynamicProperty();
enum Type { Var, Variant, Int, Bool, Real, String, Url, Color,
- Time, Date, DateTime, Alias, Custom, CustomList };
+ Time, Date, DateTime, Rect, Alias, Custom, CustomList };
quint32 isDefaultProperty:1;
quint32 isReadOnly:1;
inline const QTime &asQTime();
inline const QDate &asQDate();
inline const QDateTime &asQDateTime();
+ inline const QRectF &asQRectF();
inline const QJSValue &asQJSValue();
inline void setValue(QObject *v, QQmlVMEMetaObject *target, int index);
inline void setValue(const QTime &);
inline void setValue(const QDate &);
inline void setValue(const QDateTime &);
+ inline void setValue(const QRectF &);
inline void setValue(const QJSValue &);
inline void setDataType(int t);
private:
int type;
- void *data[6]; // Large enough to hold all types
+ void *data[8]; // Large enough to hold all types
inline void cleanup();
};
} else if (type == QMetaType::QDateTime) {
((QDateTime *)dataPtr())->~QDateTime();
type = QVariant::Invalid;
+ } else if (type == QMetaType::QRectF) {
+ ((QRectF *)dataPtr())->~QRectF();
+ type = QVariant::Invalid;
} else if (type == qMetaTypeId<QVariant>()) {
((QVariant *)dataPtr())->~QVariant();
type = QVariant::Invalid;
return *(QDateTime *)(dataPtr());
}
+const QRectF &QQmlVMEVariant::asQRectF()
+{
+ if (type != QMetaType::QRectF)
+ setValue(QRectF());
+
+ return *(QRectF *)(dataPtr());
+}
+
const QJSValue &QQmlVMEVariant::asQJSValue()
{
if (type != qMetaTypeId<QJSValue>())
}
}
+void QQmlVMEVariant::setValue(const QRectF &v)
+{
+ if (type != QMetaType::QRectF) {
+ cleanup();
+ type = QMetaType::QRectF;
+ new (dataPtr()) QRectF(v);
+ } else {
+ *(QRectF *)(dataPtr()) = v;
+ }
+}
+
void QQmlVMEVariant::setValue(const QJSValue &v)
{
if (type != qMetaTypeId<QJSValue>()) {
case QVariant::DateTime:
*reinterpret_cast<QDateTime *>(a[0]) = data[id].asQDateTime();
break;
+ case QVariant::RectF:
+ *reinterpret_cast<QRectF *>(a[0]) = data[id].asQRectF();
+ break;
case QMetaType::QObjectStar:
*reinterpret_cast<QObject **>(a[0]) = data[id].asQObject();
break;
needActivate = *reinterpret_cast<QDateTime *>(a[0]) != data[id].asQDateTime();
data[id].setValue(*reinterpret_cast<QDateTime *>(a[0]));
break;
+ case QVariant::RectF:
+ needActivate = *reinterpret_cast<QRectF *>(a[0]) != data[id].asQRectF();
+ data[id].setValue(*reinterpret_cast<QRectF *>(a[0]));
+ break;
case QMetaType::QObjectStar:
needActivate = *reinterpret_cast<QObject **>(a[0]) != data[id].asQObject();
data[id].setValue(*reinterpret_cast<QObject **>(a[0]), this, id);