本文整理汇总了C++中QDeclarativeProperty类的典型用法代码示例。如果您正苦于以下问题:C++ QDeclarativeProperty类的具体用法?C++ QDeclarativeProperty怎么用?C++ QDeclarativeProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDeclarativeProperty类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
bool QDeclarativePropertyPrivate::write(const QDeclarativeProperty &that,
const QVariant &value, WriteFlags flags)
{
if (that.d->object && that.type() & QDeclarativeProperty::Property &&
that.d->core.isValid() && that.isWritable())
return that.d->writeValueProperty(value, flags);
else
return false;
}
示例2: deleteObjectsInList
void ObjectNodeInstance::deleteObjectsInList(const QDeclarativeProperty &property)
{
QObjectList objectList;
QDeclarativeListReference list = qvariant_cast<QDeclarativeListReference>(property.read());
if (!hasFullImplementedListInterface(list)) {
qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!";
return;
}
for(int i = 0; i < list.count(); i++) {
objectList += list.at(i);
}
list.clear();
}
示例3: sipConvertFromEnum
static PyObject *meth_QDeclarativeProperty_type(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
QDeclarativeProperty *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QDeclarativeProperty, &sipCpp))
{
QDeclarativeProperty::Type sipRes;
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp->type();
Py_END_ALLOW_THREADS
return sipConvertFromEnum(sipRes,sipType_QDeclarativeProperty_Type);
}
}
示例4: setTarget
void QDeclarativeBehavior::setTarget(const QDeclarativeProperty &property)
{
Q_D(QDeclarativeBehavior);
d->property = property;
d->currentValue = property.read();
if (d->animation)
d->animation->setDefaultTarget(property);
QDeclarativeEnginePrivate *engPriv = QDeclarativeEnginePrivate::get(qmlEngine(this));
engPriv->registerFinalizedParserStatusObject(this, this->metaObject()->indexOfSlot("componentFinalized()"));
}
示例5: removeObjectFromList
static void removeObjectFromList(const QDeclarativeProperty &property, QObject *objectToBeRemoved, QDeclarativeEngine * engine)
{
QDeclarativeListReference listReference(property.object(), property.name().toLatin1(), engine);
if (!hasFullImplementedListInterface(listReference)) {
qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!";
return;
}
int count = listReference.count();
QObjectList objectList;
for(int i = 0; i < count; i ++) {
QObject *listItem = listReference.at(i);
if (listItem != objectToBeRemoved)
objectList.append(listItem);
}
listReference.clear();
foreach(QObject *object, objectList)
listReference.append(object);
}
示例6: outStream
void PQBaseItem::serializeProperty(QTextStream &stream, const QDeclarativeProperty &property, unsigned indentSize) const
{
QString str;
QTextStream outStream(&str);
if (property.propertyTypeCategory() == QDeclarativeProperty::Normal) { // Normal value property
const int propertyType = property.propertyType();
const QString propertyValue = property.read().toString();
if (propertyType >= QVariant::Bool && propertyType <= QVariant::Double) { // Numerical, unquoted values
outStream << propertyValue;
} else {
if (!propertyValue.isEmpty()) {
QString value = propertyValue;
value.replace(QLatin1Char('\\'), QLatin1String("\\\\")) // escape backslashes in rich text
.replace(QLatin1Char('"'), QLatin1String("\\\"")); // escape quotes
value = QLatin1Char('"') % value % QLatin1Char('"');
outStream << value;
}
}
} else if (property.propertyTypeCategory() == QDeclarativeProperty::Object) { // Complex Object type
const QVariant variantValue = property.read();
if (variantValue.isValid() && !variantValue.isNull()) {
serializeObject(outStream, variantValue.value<QObject *>(), indentSize);
}
} else if (property.propertyTypeCategory() == QDeclarativeProperty::List) { // List of objects
const QDeclarativeListReference list = qvariant_cast<QDeclarativeListReference>(property.read());
outStream << QLatin1Char('[') << endl;
for (int itemIndex = 0, c = list.count(); itemIndex < c; ++itemIndex) {
QObject *item = list.at(itemIndex);
serializeObject(outStream, item, indentSize+1);
if (itemIndex + 1 != list.count()) {
outStream << QLatin1Char(','); // separator
}
outStream << endl;
}
outStream << PQSerializer::indentStep().repeated(indentSize) << QLatin1String("]"); // close list
}
if (!str.isEmpty()) {
stream << PQSerializer::indentStep().repeated(indentSize)
<< property.name() << QLatin1String(": ") << str
<< endl;
}
}
示例7: isObject
static bool isObject(const QDeclarativeProperty &property)
{
return property.propertyTypeCategory() == QDeclarativeProperty::Object;
}
示例8: Q_ASSERT
QObject *QDeclarativeVME::run(QDeclarativeVMEObjectStack &stack,
QDeclarativeContextData *ctxt,
QDeclarativeCompiledData *comp,
int start, int count,
const QBitField &bindingSkipList)
{
Q_ASSERT(comp);
Q_ASSERT(ctxt);
const QList<QDeclarativeCompiledData::TypeReference> &types = comp->types;
const QList<QString> &primitives = comp->primitives;
const QList<QByteArray> &datas = comp->datas;
const QList<QDeclarativeCompiledData::CustomTypeData> &customTypeData = comp->customTypeData;
const QList<int> &intData = comp->intData;
const QList<float> &floatData = comp->floatData;
const QList<QDeclarativePropertyCache *> &propertyCaches = comp->propertyCaches;
const QList<QDeclarativeParser::Object::ScriptBlock> &scripts = comp->scripts;
const QList<QUrl> &urls = comp->urls;
QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bindValues;
QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> parserStatus;
QDeclarativeVMEStack<ListInstance> qliststack;
vmeErrors.clear();
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine);
int status = -1; //for dbus
QDeclarativePropertyPrivate::WriteFlags flags = QDeclarativePropertyPrivate::BypassInterceptor |
QDeclarativePropertyPrivate::RemoveBindingOnAliasWrite;
for (int ii = start; !isError() && ii < (start + count); ++ii) {
const QDeclarativeInstruction &instr = comp->bytecode.at(ii);
switch(instr.type) {
case QDeclarativeInstruction::Init:
{
if (instr.init.bindingsSize)
bindValues = QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding>(instr.init.bindingsSize);
if (instr.init.parserStatusSize)
parserStatus = QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus>(instr.init.parserStatusSize);
if (instr.init.contextCache != -1)
ctxt->setIdPropertyData(comp->contextCaches.at(instr.init.contextCache));
if (instr.init.compiledBinding != -1)
ctxt->optimizedBindings = new QDeclarativeCompiledBindings(datas.at(instr.init.compiledBinding).constData(), ctxt, comp);
}
break;
case QDeclarativeInstruction::CreateObject:
{
QBitField bindings;
if (instr.create.bindingBits != -1) {
const QByteArray &bits = datas.at(instr.create.bindingBits);
bindings = QBitField((const quint32*)bits.constData(),
bits.size() * 8);
}
if (stack.isEmpty())
bindings = bindings.united(bindingSkipList);
QObject *o =
types.at(instr.create.type).createInstance(ctxt, bindings, &vmeErrors);
if (!o) {
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)));
}
QDeclarativeData *ddata = QDeclarativeData::get(o);
Q_ASSERT(ddata);
if (stack.isEmpty()) {
if (ddata->context) {
Q_ASSERT(ddata->context != ctxt);
Q_ASSERT(ddata->outerContext);
Q_ASSERT(ddata->outerContext != ctxt);
QDeclarativeContextData *c = ddata->context;
while (c->linkedContext) c = c->linkedContext;
c->linkedContext = ctxt;
} else {
ctxt->addObject(o);
}
ddata->ownContext = true;
} else if (!ddata->context) {
ctxt->addObject(o);
}
ddata->setImplicitDestructible();
ddata->outerContext = ctxt;
ddata->lineNumber = instr.line;
ddata->columnNumber = instr.create.column;
if (instr.create.data != -1) {
QDeclarativeCustomParser *customParser =
types.at(instr.create.type).type->customParser();
customParser->setCustomData(o, datas.at(instr.create.data));
}
if (!stack.isEmpty()) {
QObject *parent = stack.top();
if (o->isWidgetType()) {
QWidget *widget = static_cast<QWidget*>(o);
if (parent->isWidgetType()) {
//.........这里部分代码省略.........
示例9: isObject
static bool isObject(const QDeclarativeProperty &property)
{
return (property.propertyTypeCategory() == QDeclarativeProperty::Object) ||
//QVariant can also store QObjects. Lets trust our model.
(QLatin1String(property.propertyTypeName()) == QLatin1String("QVariant"));
}
示例10: setTarget
void QDeclarativeSpringFollow::setTarget(const QDeclarativeProperty &property)
{
Q_D(QDeclarativeSpringFollow);
d->property = property;
d->currentValue = property.read().toReal();
}