本文整理汇总了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);
}
示例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_ );
}
示例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));
}
示例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);
}
示例5: setSParent
void PropertiesPane::setSParent(QString f)
{
QDeclarativeItem* tm = root->findChild<QDeclarativeItem *>(namepr);
tm->setProperty("parentName",f);
// qDebug()<<f;
}
示例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));
}
}
}
示例7: specialSetParentForQmlGraphicsItemChildren
static void specialSetParentForQmlGraphicsItemChildren(QObject *object, QDeclarativeItem *parent)
{
QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(object);
if (item)
item->setParentItem(parent);
else
object->setParent(parent);
}
示例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;
}
示例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());
}
示例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);
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}