当前位置: 首页>>代码示例>>C++>>正文


C++ QDeclarativeAbstractBinding::bindingType方法代码示例

本文整理汇总了C++中QDeclarativeAbstractBinding::bindingType方法的典型用法代码示例。如果您正苦于以下问题:C++ QDeclarativeAbstractBinding::bindingType方法的具体用法?C++ QDeclarativeAbstractBinding::bindingType怎么用?C++ QDeclarativeAbstractBinding::bindingType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDeclarativeAbstractBinding的用法示例。


在下文中一共展示了QDeclarativeAbstractBinding::bindingType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

/*!
    Returns the binding associated with this property, or 0 if no binding 
    exists.
*/
QDeclarativeAbstractBinding *
QDeclarativePropertyPrivate::binding(const QDeclarativeProperty &that) 
{
    if (!that.isProperty() || !that.d->object)
        return 0;

    QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(that.d->object);
    if (!data) 
        return 0;

    if (!data->hasBindingBit(that.d->core.coreIndex))
        return 0;

    QDeclarativeAbstractBinding *binding = data->bindings;
    while (binding && binding->propertyIndex() != that.d->core.coreIndex) 
        binding = binding->m_nextBinding;

    if (binding && that.d->valueType.valueTypeCoreIdx != -1) {
        if (binding->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy) {
            QDeclarativeValueTypeProxyBinding *proxy = static_cast<QDeclarativeValueTypeProxyBinding *>(binding);

            binding = proxy->binding(bindingIndex(that));
        }
    }

    return binding;
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例2: addToObject

void QDeclarativeAbstractBinding::addToObject(QObject *object)
{
    Q_ASSERT(object);

    if (m_object == object)
        return;

    int index = propertyIndex();

    removeFromObject();

    Q_ASSERT(!m_prevBinding);

    m_object = object;
    QDeclarativeData *data = QDeclarativeData::get(object, true);

    if (index & 0xFF000000) {
        // Value type

        int coreIndex = index & 0xFFFFFF;

        // Find the value type proxy (if there is one)
        QDeclarativeValueTypeProxyBinding *proxy = 0;
        if (data->hasBindingBit(coreIndex)) {
            QDeclarativeAbstractBinding *b = data->bindings;
            while (b && b->propertyIndex() != coreIndex)
                b = b->m_nextBinding;
            Q_ASSERT(b && b->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy);
            proxy = static_cast<QDeclarativeValueTypeProxyBinding *>(b);
        }

        if (!proxy) 
            proxy = new QDeclarativeValueTypeProxyBinding(object, coreIndex);
        proxy->addToObject(object);

        m_nextBinding = proxy->m_bindings;
        if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
        m_prevBinding = &proxy->m_bindings;
        proxy->m_bindings = this;

    } else {
        m_nextBinding = data->bindings;
        if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
        m_prevBinding = &data->bindings;
        data->bindings = this;

        data->setBindingBit(m_object, index);
    }
}
开发者ID:,项目名称:,代码行数:49,代码来源:

示例3: QDeclarativeComponent


//.........这里部分代码省略.........

                stack.push(obj);
            }
            break;

        case QDeclarativeInstruction::PopQList:
            {
                qliststack.pop();
            }
            break;

        case QDeclarativeInstruction::Defer:
            {
                if (instr.defer.deferCount) {
                    QObject *target = stack.top();
                    QDeclarativeData *data = 
                        QDeclarativeData::get(target, true);
                    comp->addref();
                    data->deferredComponent = comp;
                    data->deferredIdx = ii;
                    ii += instr.defer.deferCount;
                }
            }
            break;

        case QDeclarativeInstruction::PopFetchedObject:
            {
                stack.pop();
            }
            break;

        case QDeclarativeInstruction::FetchValueType:
            {
                QObject *target = stack.top();

                if (instr.fetchValue.bindingSkipList != 0) {
                    // Possibly need to clear bindings
                    QDeclarativeData *targetData = QDeclarativeData::get(target);
                    if (targetData) {
                        QDeclarativeAbstractBinding *binding = 
                            QDeclarativePropertyPrivate::binding(target, instr.fetchValue.property, -1);

                        if (binding && binding->bindingType() != QDeclarativeAbstractBinding::ValueTypeProxy) {
                            QDeclarativePropertyPrivate::setBinding(target, instr.fetchValue.property, -1, 0);
                            binding->destroy();
                        } else if (binding) {
                            QDeclarativeValueTypeProxyBinding *proxy = 
                                static_cast<QDeclarativeValueTypeProxyBinding *>(binding);
                            proxy->removeBindings(instr.fetchValue.bindingSkipList);
                        }
                    }
                }

                QDeclarativeValueType *valueHandler = ep->valueTypes[instr.fetchValue.type];
                valueHandler->read(target, instr.fetchValue.property);
                stack.push(valueHandler);
            }
            break;

        case QDeclarativeInstruction::PopValueType:
            {
                QDeclarativeValueType *valueHandler = 
                    static_cast<QDeclarativeValueType *>(stack.pop());
                QObject *target = stack.top();
                valueHandler->write(target, instr.fetchValue.property, 
                                    QDeclarativePropertyPrivate::BypassInterceptor);
            }
            break;

        default:
            qFatal("QDeclarativeCompiledData: Internal error - unknown instruction %d", instr.type);
            break;
        }
    }

    if (isError()) {
        if (!stack.isEmpty()) {
            delete stack.at(0); // ### What about failures in deferred creation?
        } else {
            ctxt->destroy();
        }

        QDeclarativeEnginePrivate::clear(bindValues);
        QDeclarativeEnginePrivate::clear(parserStatus);
        return 0;
    }

    if (bindValues.count)
        ep->bindValues << bindValues;
    else if (bindValues.values)
        bindValues.clear();

    if (parserStatus.count)
        ep->parserStatus << parserStatus;
    else if (parserStatus.values)
        parserStatus.clear();

    Q_ASSERT(stack.count() == 1);
    return stack.top();
}
开发者ID:maxxant,项目名称:qt,代码行数:101,代码来源:qdeclarativevme.cpp


注:本文中的QDeclarativeAbstractBinding::bindingType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。