本文整理汇总了C++中QQuickItemPrivate类的典型用法代码示例。如果您正苦于以下问题:C++ QQuickItemPrivate类的具体用法?C++ QQuickItemPrivate怎么用?C++ QQuickItemPrivate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QQuickItemPrivate类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMouseEvent
// Copied with minor modifications from qtdeclarative/src/quick/items/qquickwindow.cpp
QMouseEvent *TouchDispatcher::touchToMouseEvent(
QEvent::Type type, const QTouchEvent::TouchPoint &p,
ulong timestamp, Qt::KeyboardModifiers modifiers,
bool transformNeeded)
{
QQuickItem *item = m_targetItem.data();
// The touch point local position and velocity are not yet transformed.
QMouseEvent *me = new QMouseEvent(type, transformNeeded ? item->mapFromScene(p.scenePos()) : p.pos(),
p.scenePos(), p.screenPos(), Qt::LeftButton,
(type == QEvent::MouseButtonRelease ? Qt::NoButton : Qt::LeftButton),
modifiers);
me->setAccepted(true);
me->setTimestamp(timestamp);
QVector2D transformedVelocity = p.velocity();
if (transformNeeded) {
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
QMatrix4x4 transformMatrix(itemPrivate->windowToItemTransform());
transformedVelocity = transformMatrix.mapVector(p.velocity()).toVector2D();
}
// Add these later if needed:
//QGuiApplicationPrivate::setMouseEventCapsAndVelocity(me, event->device()->capabilities(), transformedVelocity);
//QGuiApplicationPrivate::setMouseEventSource(me, Qt::MouseEventSynthesizedByQt);
return me;
}
示例2: Q_ASSERT
QuickWindowNodeInstance::Pointer QuickWindowNodeInstance::create(QObject *object)
{
QQuickWindow *quickWindow = qobject_cast<QQuickWindow*>(object);
Q_ASSERT(quickWindow);
Pointer instance(new QuickWindowNodeInstance(quickWindow));
instance->setHasContent(anyItemHasContent(quickWindow->contentItem()));
quickWindow->contentItem()->setFlag(QQuickItem::ItemHasContents, true);
static_cast<QQmlParserStatus*>(quickWindow->contentItem())->classBegin();
instance->populateResetHashes();
QQuickItemPrivate *privateItem = static_cast<QQuickItemPrivate*>(QObjectPrivate::get(quickWindow->contentItem()));
if (privateItem->window) {
if (!privateItem->parentItem)
QQuickWindowPrivate::get(privateItem->window)->parentlessItems.remove(quickWindow->contentItem());
privateItem->derefWindow();
privateItem->window = 0;
}
return instance;
}
示例3: initialize
void QQuickOpacityAnimatorJob::initialize(QQuickAnimatorController *controller)
{
QQuickAnimatorJob::initialize(controller);
QQuickItemPrivate *d = QQuickItemPrivate::get(m_target);
if (d->extra.isAllocated()
&& d->extra->layer
&& d->extra->layer->enabled()) {
d = QQuickItemPrivate::get(d->extra->layer->m_effectSource);
}
m_opacityNode = d->opacityNode();
if (!m_opacityNode) {
m_opacityNode = new QSGOpacityNode();
d->extra.value().opacityNode = m_opacityNode;
QSGNode *child = d->clipNode();
if (!child)
child = d->rootNode();
if (!child)
child = d->groupNode;
if (child) {
if (child->parent())
child->parent()->removeChildNode(child);
m_opacityNode->appendChildNode(child);
}
d->itemNode()->appendChildNode(m_opacityNode);
}
}
示例4: Q_D
QQuickLoader::~QQuickLoader()
{
Q_D(QQuickLoader);
if (d->item) {
QQuickItemPrivate *p = QQuickItemPrivate::get(d->item);
p->removeItemChangeListener(d, watchedChanges);
}
}
示例5: initResize
void QQuickLoaderPrivate::initResize()
{
if (!item)
return;
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
p->addItemChangeListener(this, watchedChanges);
_q_updateSize();
}
示例6: QRectF
void QuickInspector::renderScene()
{
if (!m_clientConnected || !m_window)
return;
QImage img;
if (m_window->windowState() != Qt::WindowMinimized)
img = m_window->grabWindow();
if (m_currentItem) {
QQuickItem *parent = m_currentItem->parentItem();
QVariantMap geometryData;
if (parent)
geometryData.insert("itemRect", m_currentItem->parentItem()->mapRectToScene(QRectF(m_currentItem->x(), m_currentItem->y(), m_currentItem->width(), m_currentItem->height())));
else
geometryData.insert("itemRect", QRectF(0, 0, m_currentItem->width(), m_currentItem->height()));
geometryData.insert("boundingRect", m_currentItem->mapRectToScene(m_currentItem->boundingRect()));
geometryData.insert("childrenRect", m_currentItem->mapRectToScene(m_currentItem->childrenRect()));
geometryData.insert("transformOriginPoint", m_currentItem->mapToScene(m_currentItem->transformOriginPoint()));
#ifdef HAVE_SG_INSPECTOR
QQuickAnchors *anchors = m_currentItem->property("anchors").value<QQuickAnchors*>();
if (anchors) {
QQuickAnchors::Anchors usedAnchors = anchors->usedAnchors();
geometryData.insert("left", (bool)(usedAnchors & QQuickAnchors::LeftAnchor) || anchors->fill());
geometryData.insert("right", (bool)(usedAnchors & QQuickAnchors::RightAnchor) || anchors->fill());
geometryData.insert("top", (bool)(usedAnchors & QQuickAnchors::TopAnchor) || anchors->fill());
geometryData.insert("bottom", (bool)(usedAnchors & QQuickAnchors::BottomAnchor) || anchors->fill());
geometryData.insert("baseline", (bool)(usedAnchors & QQuickAnchors::BaselineAnchor));
geometryData.insert("horizontalCenter", (bool)(usedAnchors & QQuickAnchors::HCenterAnchor) || anchors->centerIn());
geometryData.insert("verticalCenter", (bool)(usedAnchors & QQuickAnchors::VCenterAnchor) || anchors->centerIn());
geometryData.insert("leftMargin", anchors->leftMargin());
geometryData.insert("rightMargin", anchors->rightMargin());
geometryData.insert("topMargin", anchors->topMargin());
geometryData.insert("bottomMargin", anchors->bottomMargin());
geometryData.insert("horizontalCenterOffset", anchors->horizontalCenterOffset());
geometryData.insert("verticalCenterOffset", anchors->verticalCenterOffset());
geometryData.insert("baselineOffset", anchors->baselineOffset());
geometryData.insert("margins", anchors->margins());
}
#endif
geometryData.insert("x", m_currentItem->x());
geometryData.insert("y", m_currentItem->y());
#ifdef HAVE_SG_INSPECTOR
QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(m_currentItem);
geometryData.insert("transform", itemPriv->itemToWindowTransform());
if (parent) {
QQuickItemPrivate *parentPriv = QQuickItemPrivate::get(parent);
geometryData.insert("parentTransform", parentPriv->itemToWindowTransform());
}
#endif
emit sceneRendered(img, geometryData);
} else {
emit sceneRendered(img, QVariantMap());
}
}
示例7: Q_Q
bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *item,const QPointF &sp, PropagateType sig)
{
//Based off of QQuickWindow::deliverInitialMousePressEvent
//But specific to MouseArea, so doesn't belong in window
Q_Q(const QQuickMouseArea);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
QPointF p = item->mapFromScene(sp);
if (!item->contains(p))
return false;
}
QList<QQuickItem *> children = itemPrivate->paintOrderChildItems();
for (int ii = children.count() - 1; ii >= 0; --ii) {
QQuickItem *child = children.at(ii);
if (!child->isVisible() || !child->isEnabled())
continue;
if (propagateHelper(ev, child, sp, sig))
return true;
}
QQuickMouseArea* ma = qobject_cast<QQuickMouseArea*>(item);
if (ma && ma != q && ma->isEnabled() && itemPrivate->acceptedMouseButtons() & ev->button()) {
switch (sig) {
case Click:
if (!ma->d_func()->isClickConnected())
return false;
break;
case DoubleClick:
if (!ma->d_func()->isDoubleClickConnected())
return false;
break;
case PressAndHold:
if (!ma->d_func()->isPressAndHoldConnected())
return false;
break;
}
QPointF p = item->mapFromScene(sp);
if (item->contains(p)) {
ev->setX(p.x());
ev->setY(p.y());
ev->setAccepted(true);//It is connected, they have to explicitly ignore to let it slide
switch (sig) {
case Click: emit ma->clicked(ev); break;
case DoubleClick: emit ma->doubleClicked(ev); break;
case PressAndHold: emit ma->pressAndHold(ev); break;
}
if (ev->isAccepted())
return true;
}
}
return false;
}
示例8: while
QSGNode *QuickSceneGraphModel::currentRootNode() const
{
if (!m_window)
return nullptr;
QQuickItem *item = m_window->contentItem();
QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
QSGNode *root = itemPriv->itemNode();
while (root->parent()) // Ensure that we really get the very root node.
root = root->parent();
return root;
}
示例9: beginResetModel
void QuickSceneGraphModel::setWindow(QQuickWindow* window)
{
beginResetModel();
clear();
m_window = window;
QQuickItem *item = window->contentItem();
QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
m_rootNode = itemPriv->itemNode();
while(m_rootNode->parent()) // Ensure that we really get the very root node.
m_rootNode = m_rootNode->parent();
updateSGTree();
connect(window, SIGNAL(beforeRendering()), this, SLOT(updateSGTree()));
endResetModel();
}
示例10: Q_ASSERT
bool DesignerSupport::isAnchoredTo(QQuickItem *fromItem, QQuickItem *toItem)
{
#ifndef QT_NO_DYNAMIC_CAST
Q_ASSERT(dynamic_cast<QQuickItemPrivate*>(QQuickItemPrivate::get(fromItem)));
#endif
QQuickItemPrivate *fromItemPrivate = static_cast<QQuickItemPrivate*>(QQuickItemPrivate::get(fromItem));
QQuickAnchors *anchors = fromItemPrivate->anchors();
return anchors->fill() == toItem
|| anchors->centerIn() == toItem
|| anchors->bottom().item == toItem
|| anchors->top().item == toItem
|| anchors->left().item == toItem
|| anchors->right().item == toItem
|| anchors->verticalCenter().item == toItem
|| anchors->horizontalCenter().item == toItem
|| anchors->baseline().item == toItem;
}
示例11: updateSGTree
void QuickSceneGraphModel::updateSGTree()
{
QQuickItem *item = m_window->contentItem();
QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
QSGNode *rootNode = itemPriv->itemNode();
while(rootNode->parent()) // Ensure that we really get the very root node.
rootNode = rootNode->parent();
m_oldChildParentMap = m_childParentMap;
m_oldParentChildMap = m_parentChildMap;
m_childParentMap = QHash<QSGNode*, QSGNode*>();
m_parentChildMap = QHash<QSGNode*, QVector<QSGNode*> >();
m_childParentMap[m_rootNode] = 0;
m_parentChildMap[0].append(m_rootNode);
populateFromNode(m_rootNode);
collectItemNodes(m_window->contentItem());
}
示例12:
void QQuickTransformAnimatorJob::Helper::sync()
{
const quint32 mask = QQuickItemPrivate::Position
| QQuickItemPrivate::BasicTransform
| QQuickItemPrivate::TransformOrigin
| QQuickItemPrivate::Size;
QQuickItemPrivate *d = QQuickItemPrivate::get(item);
if (d->extra.isAllocated()
&& d->extra->layer
&& d->extra->layer->enabled()) {
d = QQuickItemPrivate::get(d->extra->layer->m_effectSource);
}
quint32 dirty = mask & d->dirtyAttributes;
if (!wasSynced) {
dirty = 0xffffffffu;
wasSynced = true;
}
if (dirty == 0)
return;
node = d->itemNode();
if (dirty & QQuickItemPrivate::Position) {
dx = item->x();
dy = item->y();
}
if (dirty & QQuickItemPrivate::BasicTransform) {
scale = item->scale();
rotation = item->rotation();
}
if (dirty & (QQuickItemPrivate::TransformOrigin | QQuickItemPrivate::Size)) {
QPointF o = item->transformOriginPoint();
ox = o.x();
oy = o.y();
}
}
示例13: Q_Q
void QQuickLoaderPrivate::clear()
{
Q_Q(QQuickLoader);
disposeInitialPropertyValues();
if (incubator)
incubator->clear();
delete itemContext;
itemContext = 0;
if (loadingFromSource && component) {
// disconnect since we deleteLater
QObject::disconnect(component, SIGNAL(statusChanged(QQmlComponent::Status)),
q, SLOT(_q_sourceLoaded()));
QObject::disconnect(component, SIGNAL(progressChanged(qreal)),
q, SIGNAL(progressChanged()));
component->deleteLater();
component = 0;
}
componentStrongReference.clear();
source = QUrl();
if (item) {
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
p->removeItemChangeListener(this, watchedChanges);
// We can't delete immediately because our item may have triggered
// the Loader to load a different item.
item->setParentItem(0);
item->setVisible(false);
item = 0;
}
if (object) {
object->deleteLater();
object = 0;
}
}