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


C++ QDeclarativeItem类代码示例

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


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

示例1: setSGameName

//ui--->qml
void PropertiesPane::setSGameName(QString name)
{
    if(namepr.isEmpty())
        return;
    QDeclarativeItem* tm = root->findChild<QDeclarativeItem *>(namepr);
    tm->setProperty("objectName",name);
}
开发者ID:bitores,项目名称:QT_Demo,代码行数:8,代码来源:propertiespane.cpp

示例2: createQmlItem

void QmlWindowRenderer::setupPixelStreamItem()
{
    PixelStream* stream = static_cast<PixelStream*>( wallContent_.get( ));
    windowContext_->setContextProperty( "pixelstream", stream );
    QDeclarativeItem* pixelStreamItem = createQmlItem( QML_PIXELSTREAM_URL );
    pixelStreamItem->setParentItem( windowItem_ );
}
开发者ID:jafyvilla,项目名称:DisplayCluster,代码行数:7,代码来源:QmlWindowRenderer.cpp

示例3: showSingleCamera

void LiveViewWindow::showSingleCamera(DVRCamera *camera)
{
    m_liveView->layout()->setGridSize(1, 1);
    QDeclarativeItem *item = m_liveView->layout()->addItem(0, 0);
    if (item)
        item->setProperty("camera", QVariant::fromValue(camera));
}
开发者ID:Wellsen,项目名称:bluecherry-client,代码行数:7,代码来源:LiveViewWindow.cpp

示例4: qDebug

void KinoafishaWidget::setCinamaList(const QList<Cinema *> cinemaList)
{
    QTime progressTime;
    qDebug() << "Set cinema list to qmlView...";
    progressTime.start();
    QSettings settings;
    QString affishaQmlPatch = settings.value(SETT_KEY_KINOAFISHA_QML_PATCH,
                                             QCoreApplication::applicationDirPath() +
                                             DEFATUL_SETT_VALUE_KINOAFISHA_QML_PATCH).toString();
    qDebug() << "Load qml " << affishaQmlPatch + "/Affisha.qml...";
    QTime loadTime;
    loadTime.start();
    if (!QFile::exists(affishaQmlPatch + "/Affisha.qml"))
    {
        qWarning() << "Affisha.qml not found";
        return;
    }
    setSource(QUrl::fromLocalFile(affishaQmlPatch + "/Affisha.qml"));
    qDebug() << "Load qml finished in " << loadTime.elapsed();
    QDeclarativeItem * rootItem = qobject_cast<QDeclarativeItem *>(rootObject());
    qDebug() << "Kinoafisha widget width " << _screenWidth <<" height " << _screenHeight;
    rootItem->setWidth(_screenWidth);
    rootItem->setHeight(_screenHeight);
    connect(rootObject(), SIGNAL(trailerPlayFinished(int)), this, SIGNAL(traylerPlayedFinised(int)));
    foreach (Cinema *currentCinema, cinemaList)
    {
        addCinema(currentCinema);
    }
开发者ID:0x6368656174,项目名称:iqMultipleDesktopVideo,代码行数:28,代码来源:kinoafishawidget.cpp

示例5: setSParent

void PropertiesPane::setSParent(QString f)
{
    QDeclarativeItem* tm = root->findChild<QDeclarativeItem *>(namepr);
    tm->setProperty("parentName",f);
//    qDebug()<<f;

}
开发者ID:bitores,项目名称:QT_Demo,代码行数:7,代码来源:propertiespane.cpp

示例6: qDebug

void
E6Irc::fixCaps (QObject * root)
{
  if (root) {
    objectCount++;
    QVariant suppressVar = root->property ("noInitialCaps");
    if (suppressVar.isValid()) {
      qDebug () << "found property on " << root ;
      qDebug () << suppressVar;
      if (suppressVar.type() == QVariant::Bool) {
        bool suppress = suppressVar.toBool();
        if (suppress) {
          QDeclarativeItem * item = qobject_cast<QDeclarativeItem*> (root);
          if (item) {
            item->setInputMethodHints (Qt::ImhNoAutoUppercase);
          }
        }
      }
    }
    QObjectList children = root->children();
    for (int i=0; i<children.count(); i++) {
      fixCaps (children.at(i));
    }
  }
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例7: specialSetParentForQmlGraphicsItemChildren

static void specialSetParentForQmlGraphicsItemChildren(QObject *object, QDeclarativeItem *parent)
{
    QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(object);
    if (item)
        item->setParentItem(parent);
    else
        object->setParent(parent);
}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:8,代码来源:objectnodeinstance.cpp

示例8: Q_D

bool QDeclarativeMouseArea::sendMouseEvent(QGraphicsSceneMouseEvent *event)
{
    Q_D(QDeclarativeMouseArea);
    QGraphicsSceneMouseEvent mouseEvent(event->type());
    QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect();

    QGraphicsScene *s = scene();
    QDeclarativeItem *grabber = s ? qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem()) : 0;
    bool stealThisEvent = d->stealMouse;
    if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) {
        mouseEvent.setAccepted(false);
        for (int i = 0x1; i <= 0x10; i <<= 1) {
            if (event->buttons() & i) {
                Qt::MouseButton button = Qt::MouseButton(i);
                mouseEvent.setButtonDownPos(button, mapFromScene(event->buttonDownPos(button)));
            }
        }
        mouseEvent.setScenePos(event->scenePos());
        mouseEvent.setLastScenePos(event->lastScenePos());
        mouseEvent.setPos(mapFromScene(event->scenePos()));
        mouseEvent.setLastPos(mapFromScene(event->lastScenePos()));

        switch(mouseEvent.type()) {
        case QEvent::GraphicsSceneMouseMove:
            mouseMoveEvent(&mouseEvent);
            break;
        case QEvent::GraphicsSceneMousePress:
            mousePressEvent(&mouseEvent);
            break;
        case QEvent::GraphicsSceneMouseRelease:
            mouseReleaseEvent(&mouseEvent);
            break;
        default:
            break;
        }
        grabber = qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem());
        if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this)
            grabMouse();

        return stealThisEvent;
    }
    if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) {
        if (d->pressed) {
            d->pressed = false;
            d->stealMouse = false;
            if (s && s->mouseGrabberItem() == this)
                ungrabMouse();
            emit canceled();
            emit pressedChanged();
            if (d->hovered) {
                d->hovered = false;
                emit hoveredChanged();
            }
        }
    }
    return false;
}
开发者ID:Afreeca,项目名称:qt,代码行数:57,代码来源:qdeclarativemousearea.cpp

示例9: Q_D

void QDeclarativeBasePositioner::prePositioning()
{
    Q_D(QDeclarativeBasePositioner);
    if (!isComponentComplete())
        return;

    if (d->doingPositioning)
        return;

    d->queuedPositioning = false;
    d->doingPositioning = true;
    //Need to order children by creation order modified by stacking order
    QList<QGraphicsItem *> children = d->QGraphicsItemPrivate::children;
    qSort(children.begin(), children.end(), d->insertionOrder);

    QPODVector<PositionedItem,8> oldItems;
    positionedItems.copyAndClear(oldItems);
    for (int ii = 0; ii < children.count(); ++ii) {
        QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(ii));
        if (!child)
            continue;
        QDeclarativeItemPrivate *childPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(child));
        PositionedItem *item = 0;
        PositionedItem posItem(child);
        int wIdx = oldItems.find(posItem);
        if (wIdx < 0) {
            d->watchChanges(child);
            positionedItems.append(posItem);
            item = &positionedItems[positionedItems.count()-1];
            item->isNew = true;
            if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden)
                item->isVisible = false;
        } else {
            item = &oldItems[wIdx];
            // Items are only omitted from positioning if they are explicitly hidden
            // i.e. their positioning is not affected if an ancestor is hidden.
            if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden) {
                item->isVisible = false;
            } else if (!item->isVisible) {
                item->isVisible = true;
                item->isNew = true;
            } else {
                item->isNew = false;
            }
            positionedItems.append(*item);
        }
    }
    QSizeF contentSize;
    doPositioning(&contentSize);
    if(d->addTransition || d->moveTransition)
        finishApplyTransitions();
    d->doingPositioning = false;
    //Set implicit size to the size of its children
    setImplicitHeight(contentSize.height());
    setImplicitWidth(contentSize.width());
}
开发者ID:dirlinch,项目名称:chromecast-mirrored-source.vendor,代码行数:56,代码来源:qdeclarativepositioners.cpp

示例10: Q_D

void QDeclarativeBasePositioner::prePositioning()
{
    Q_D(QDeclarativeBasePositioner);
    if (!isComponentComplete())
        return;

    d->queuedPositioning = false;
    //Need to order children by creation order modified by stacking order
    QList<QGraphicsItem *> children = d->QGraphicsItemPrivate::children;
    qSort(children.begin(), children.end(), d->insertionOrder);

    QPODVector<PositionedItem,8> oldItems;
    positionedItems.copyAndClear(oldItems);
    for (int ii = 0; ii < children.count(); ++ii) {
        QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(ii));
        if (!child)
            continue;
        PositionedItem *item = 0;
        PositionedItem posItem(child);
        int wIdx = oldItems.find(posItem);
        if (wIdx < 0) {
            d->watchChanges(child);
            positionedItems.append(posItem);
            item = &positionedItems[positionedItems.count()-1];
            item->isNew = true;
            if (child->opacity() <= 0.0 || !child->isVisible())
                item->isVisible = false;
        } else {
            item = &oldItems[wIdx];
            if (child->opacity() <= 0.0 || !child->isVisible()) {
                item->isVisible = false;
            } else if (!item->isVisible) {
                item->isVisible = true;
                item->isNew = true;
            } else {
                item->isNew = false;
            }
            positionedItems.append(*item);
        }
    }
    doPositioning();
    if(d->addTransition || d->moveTransition)
        finishApplyTransitions();
    //Set implicit size to the size of its children
    qreal h = 0.0f;
    qreal w = 0.0f;
    for (int i = 0; i < positionedItems.count(); ++i) {
        const PositionedItem &posItem = positionedItems.at(i);
        if (posItem.isVisible) {
            h = qMax(h, posItem.item->y() + posItem.item->height());
            w = qMax(w, posItem.item->x() + posItem.item->width());
        }
    }
    setImplicitHeight(h);
    setImplicitWidth(w);
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例11: reparentQmlObject

void QDeclarativeViewInspector::reparentQmlObject(QObject *object, QObject *newParent)
{
    if (!newParent)
        return;

    object->setParent(newParent);
    QDeclarativeItem *newParentItem = qobject_cast<QDeclarativeItem*>(newParent);
    QDeclarativeItem *item    = qobject_cast<QDeclarativeItem*>(object);
    if (newParentItem && item)
        item->setParentItem(newParentItem);
}
开发者ID:wpbest,项目名称:copperspice,代码行数:11,代码来源:qdeclarativeviewinspector.cpp

示例12: scene

bool MInverseMouseArea::isClickedOnSoftwareInputPanel(QGraphicsSceneMouseEvent *event) const
{
    QGraphicsItem * item = scene()->itemAt(event->scenePos());
    while(item != NULL) {
        QDeclarativeItem * declItem = dynamic_cast<QDeclarativeItem *>(item);
        if(declItem != NULL && declItem->objectName() == "softwareInputPanel")
            return true;

        item = item->parentItem();
    }
    return false;
}
开发者ID:anushakalyan,项目名称:qmluiextensions,代码行数:12,代码来源:minversemousearea.cpp

示例13: c

//QTBUG-18362
void tst_qdeclarativebehaviors::delayedRegistration()
{
    QDeclarativeEngine engine;

    QDeclarativeComponent c(&engine, SRCDIR "/data/delayedRegistration.qml");
    QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
    QVERIFY(rect != 0);

    QDeclarativeItem *innerRect = rect->property("myItem").value<QDeclarativeItem*>();
    QVERIFY(innerRect != 0);

    QCOMPARE(innerRect->property("x").toInt(), int(0));

    QTRY_COMPARE(innerRect->property("x").toInt(), int(100));
}
开发者ID:Blizzard,项目名称:qt4,代码行数:16,代码来源:tst_qdeclarativebehaviors.cpp

示例14: while

QWidget *QuickTestEvent::eventWidget()
{
    QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(parent());
    if (!item)
        return 0;
    QGraphicsScene *s = item->scene();
    while (!s && item) {
        item = qobject_cast<QDeclarativeItem *>(item->parent());
        s = item->scene();
    }
    if (!s)
        return 0;
    QList<QGraphicsView *> views = s->views();
    if (views.isEmpty())
        return 0;
    return views.at(0);
}
开发者ID:ManoharUpputuri,项目名称:qt-labs-qtest-qml,代码行数:17,代码来源:quicktestevent.cpp

示例15: parentItem

QPointF MInverseMouseArea::mapToRootItem(QPointF pos) {
    QPointF mappedPos = pos;
    QDeclarativeItem *rootItem = parentItem();

    while (rootItem->parentItem()) {
        if (rootItem->objectName() == "windowContent") {
            break;
        }
        rootItem = rootItem->parentItem();
    }

    if (rootItem) {
        mappedPos = rootItem->mapFromScene(pos);
    }

    return mappedPos;
}
开发者ID:anushakalyan,项目名称:qmluiextensions,代码行数:17,代码来源:minversemousearea.cpp


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