/*! Associates the QGeoMapData instance \a mapData with this map object. This will create an appropriate QGeoMapObjectInfo instance for this QGeoMapObject and will connect the appropriate signals to it so that it can be kept up to date. \since 1.1 */ void QGeoMapObject::setMapData(QGeoMapData *mapData) { if (d_ptr->mapData == mapData) return; if (d_ptr->info) { delete d_ptr->info; d_ptr->info = 0; } d_ptr->mapData = mapData; if (!d_ptr->mapData) return; d_ptr->info = mapData->createMapObjectInfo(this); if (!d_ptr->info) return; connect(d_ptr->mapData, SIGNAL(windowSizeChanged(QSizeF)), d_ptr->info, SLOT(windowSizeChanged(QSizeF))); connect(d_ptr->mapData, SIGNAL(zoomLevelChanged(qreal)), d_ptr->info, SLOT(zoomLevelChanged(qreal))); connect(d_ptr->mapData, SIGNAL(centerChanged(QGeoCoordinate)), d_ptr->info, SLOT(centerChanged(QGeoCoordinate))); connect(this, SIGNAL(zValueChanged(int)), d_ptr->info, SLOT(zValueChanged(int))); connect(this, SIGNAL(visibleChanged(bool)), d_ptr->info, SLOT(visibleChanged(bool))); connect(this, SIGNAL(selectedChanged(bool)), d_ptr->info, SLOT(selectedChanged(bool))); connect(this, SIGNAL(originChanged(QGeoCoordinate)), d_ptr->info, SLOT(originChanged(QGeoCoordinate))); connect(this, SIGNAL(transformTypeChanged(QGeoMapObject::TransformType)), d_ptr->info, SLOT(transformTypeChanged(QGeoMapObject::TransformType))); connect(this, SIGNAL(unitsChanged(QGeoMapObject::CoordinateUnit)), d_ptr->info, SLOT(unitsChanged(QGeoMapObject::CoordinateUnit))); d_ptr->info->init(); }
void tst_QGraphicsTransform3D::rotation3D() { QGraphicsRotation3D rot1; QVERIFY(rot1.origin() == QVector3D(0, 0, 0)); QVERIFY(rot1.axis() == QVector3D(0, 0, 1)); QCOMPARE(rot1.angle(), qreal(0.0f)); QSignalSpy spy1(&rot1, SIGNAL(originChanged())); QSignalSpy spy2(&rot1, SIGNAL(axisChanged())); QSignalSpy spy3(&rot1, SIGNAL(angleChanged())); rot1.setOrigin(QVector3D(1, 2, 3)); rot1.setAxis(QVector3D(4, -5, 6)); rot1.setAngle(45.0f); QVERIFY(rot1.origin() == QVector3D(1, 2, 3)); QVERIFY(rot1.axis() == QVector3D(4, -5, 6)); QCOMPARE(rot1.angle(), qreal(45.0f)); QCOMPARE(spy1.size(), 1); QCOMPARE(spy2.size(), 1); QCOMPARE(spy3.size(), 1); QMatrix4x4 m1; rot1.applyTo(&m1); QMatrix4x4 m2; m2.translate(1, 2, 3); m2.rotate(45.0f, QVector3D(4, -5, 6)); m2.translate(-1, -2, -3); QVERIFY(isSameMatrix(m1, m2)); }
void QGraphicsRotation::setOrigin(const QVector3D &point) { Q_D(QGraphicsRotation); if (d->origin == point) return; d->origin = point; update(); emit originChanged(); }
void QQuickScale::setOrigin(const QVector3D &point) { Q_D(QQuickScale); if (d->origin == point) return; d->origin = point; update(); emit originChanged(); }
void QGraphicsScale3D::setOrigin(const QVector3D &value) { Q_D(QGraphicsScale3D); if (d->origin != value) { d->origin = value; emit transformChanged(); emit originChanged(); } }
/*! Sets the origin of the object to \a origin. \since 1.2 */ void QGeoMapObject::setOrigin(const QGeoCoordinate &origin) { if (origin == d_ptr->origin) return; d_ptr->origin = origin; emit originChanged(origin); }
void OriginWidget::setOrigin(const QString& newOrigin) { if (!originsStringList.contains(newOrigin)) return; if (newOrigin == m_originString) return; m_originString = newOrigin; update(); emit originChanged(); }
void tst_QGraphicsTransform3D::scale3D() { QGraphicsScale3D scale1; QVERIFY(scale1.origin() == QVector3D(0, 0, 0)); QVERIFY(scale1.scaleVector() == QVector3D(1, 1, 1)); QCOMPARE(scale1.xScale(), qreal(1.0f)); QCOMPARE(scale1.yScale(), qreal(1.0f)); QCOMPARE(scale1.zScale(), qreal(1.0f)); QCOMPARE(scale1.scale(), qreal(1.0f)); QSignalSpy spy1(&scale1, SIGNAL(originChanged())); QSignalSpy spy2(&scale1, SIGNAL(scaleChanged())); scale1.setOrigin(QVector3D(1, 2, 3)); scale1.setScaleVector(QVector3D(4, -6, 0.5f)); QVERIFY(scale1.origin() == QVector3D(1, 2, 3)); QVERIFY(scale1.scaleVector() == QVector3D(4, -6, 0.5f)); QCOMPARE(scale1.xScale(), qreal(4.0f)); QCOMPARE(scale1.yScale(), qreal(-6.0f)); QCOMPARE(scale1.zScale(), qreal(0.5f)); QCOMPARE(scale1.scale(), qreal(-0.5f)); // Average of scale factors. QCOMPARE(spy1.size(), 1); QCOMPARE(spy2.size(), 1); QMatrix4x4 m1; scale1.applyTo(&m1); QMatrix4x4 m2; m2.translate(1, 2, 3); m2.scale(QVector3D(4, -6, 0.5f)); m2.translate(-1, -2, -3); QVERIFY(isSameMatrix(m1, m2)); scale1.setXScale(20); QCOMPARE(spy2.size(), 2); scale1.setYScale(-4); QCOMPARE(spy2.size(), 3); scale1.setZScale(42); QCOMPARE(spy2.size(), 4); QVERIFY(scale1.scaleVector() == QVector3D(20, -4, 42)); QCOMPARE(scale1.scale(), qreal((20 - 4 + 42) / 3.0)); scale1.setScale(33); QCOMPARE(spy2.size(), 5); QVERIFY(scale1.scaleVector() == QVector3D(33, 33, 33)); QCOMPARE(scale1.scale(), qreal(33)); QVERIFY(scale1.origin() == QVector3D(1, 2, 3)); QCOMPARE(spy1.size(), 1); }
void Item3dPrivate::pretransform_append(QDeclarativeListProperty<QGraphicsTransform> *list, QGraphicsTransform *item) { Item3d *object = qobject_cast<Item3d *>(list->object); QList<QGraphicsTransform *> *ptrans; if (object) { ptrans = &object->d->pretransforms; //We now need to connect the underlying transform so that any change will update the graphical item. if (!ptrans->contains(item)) { ptrans->append(item); if (qobject_cast<QGraphicsScale *>(item)) { QObject::connect(item, SIGNAL(originChanged()), object, SLOT(update())); QObject::connect(item, SIGNAL(scaleChanged()), object, SLOT(update())); } else if (qobject_cast<QGraphicsRotation *>(item)) { QObject::connect(item, SIGNAL(originChanged()), object, SLOT(update())); QObject::connect(item, SIGNAL(angleChanged()), object, SLOT(update())); QObject::connect(item, SIGNAL(axisChanged()), object, SLOT(update())); } else if (qobject_cast<QGraphicsScale3D *>(item)) { QObject::connect(item, SIGNAL(originChanged()), object, SLOT(update())); QObject::connect(item, SIGNAL(scaleChanged()), object, SLOT(update())); } else if (qobject_cast<QGraphicsTranslation3D *>(item)) { QObject::connect(item, SIGNAL(translateChanged()), object, SLOT(update())); } else if (qobject_cast<QGraphicsFaceCamera *>(item)) { QObject::connect(item, SIGNAL(preserveUpVectorChanged()), object, SLOT(update())); } } } else qWarning()<<"Warning: could not find Item3d to add transformation to."; }
QTM_BEGIN_NAMESPACE QGeoTiledMapTextObjectInfo::QGeoTiledMapTextObjectInfo(QGeoTiledMapData *mapData, QGeoMapObject *mapObject) : QGeoTiledMapObjectInfo(mapData, mapObject) { text = static_cast<QGeoMapTextObject*>(mapObject); connect(text, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); connect(text, SIGNAL(fontChanged(QFont)), this, SLOT(fontChanged(QFont))); connect(text, SIGNAL(penChanged(QPen)), this, SLOT(penChanged(QPen))); connect(text, SIGNAL(brushChanged(QBrush)), this, SLOT(brushChanged(QBrush))); connect(text, SIGNAL(offsetChanged(QPoint)), this, SLOT(offsetChanged(QPoint))); connect(text, SIGNAL(alignmentChanged(Qt::Alignment)), this, SLOT(alignmentChanged(Qt::Alignment))); textItem = new QGraphicsSimpleTextItem(); graphicsItem = textItem; penChanged(text->pen()); brushChanged(text->brush()); originChanged(text->origin()); fontChanged(text->font()); textChanged(text->text()); }