CurvesView::CurvesView(QObject *parent) : QGraphicsScene(parent) { selectionFlag = false; currentSelection = NULL; lastSelected = NULL; zoomStarted = false; zoomFactor = 1; snapX = 0; snapY = 0; //add, delete addAction = new QAction(tr("&Add"), this); connect(addAction, SIGNAL(triggered()), this, SLOT(addPoint())); deleteAction = new QAction(tr("&Delete"), this); connect(deleteAction, SIGNAL(triggered()), this, SLOT(deletePoint())); //interpolation actions bezierAction = new QAction(tr("&Bezier"), this); bezierAction->setCheckable(true); connect(bezierAction, SIGNAL(triggered()), this, SLOT(setBezierInterpolation())); linearAction = new QAction(tr("&Linear"), this); linearAction->setCheckable(true); connect(linearAction, SIGNAL(triggered()), this, SLOT(setLinearInterpolation())); constantAction = new QAction(tr("&Constant"), this); constantAction->setCheckable(true); connect(constantAction, SIGNAL(triggered()), this, SLOT(setConstantInterpolation())); interpolationGroup = new QActionGroup(this); interpolationGroup->addAction(bezierAction); interpolationGroup->addAction(linearAction); interpolationGroup->addAction(constantAction); bezierAction->setChecked(true); connect(this, SIGNAL(selectionChanged()), this, SLOT(changeSelection())); //display where is the current frame QPen frameCursorPen(Qt::SolidLine); frameCursorPen.setBrush(QBrush(qRgb(0,100,0), Qt::SolidPattern)); frameCursorPen.setWidth(10); frameCursor = new CurveCursor(this,this,frameCursorPen); frameCursor->showCoord(false); /* display coordinates of points on curves, adding it to the scene after the frame cursor ensure that the coordinates will be shown on top */ QPen curveCursorPen(Qt::DotLine); curveCursor = new CurveCursor(this,this,curveCursorPen); curveCursor->showHorizontal(); connect(this, SIGNAL(scaleChanged(QPointF)), curveCursor, SLOT(counterSceneScale(QPointF))); connect(this, SIGNAL(scaleChanged(QPointF)), frameCursor, SLOT(counterSceneScale(QPointF))); }
QgsMapUnitScaleDialog::QgsMapUnitScaleDialog( QWidget* parent ) : QDialog( parent ) { setupUi( this ); mComboBoxMinScale->setScale( 0.0000001 ); mComboBoxMaxScale->setScale( 1 ); connect( mCheckBoxMinScale, SIGNAL( toggled( bool ) ), this, SLOT( configureMinComboBox() ) ); connect( mCheckBoxMaxScale, SIGNAL( toggled( bool ) ), this, SLOT( configureMaxComboBox() ) ); connect( mComboBoxMinScale, SIGNAL( scaleChanged() ), this, SLOT( configureMaxComboBox() ) ); connect( mComboBoxMaxScale, SIGNAL( scaleChanged() ), this, SLOT( configureMinComboBox() ) ); }
void GLWidget::setScale(double scale) { if (scale_ != scale) { scale_ = scale; emit scaleChanged(scale_); updateGL(); } }
/** Sets scrap that this class renders all the stations of */ void cwScrapStationView::setScrap(cwScrap* scrap) { if(Scrap != scrap) { if(Scrap != nullptr) { //disconnect disconnect(Scrap, nullptr, this, nullptr); disconnect(Scrap->noteTransformation(), nullptr, this, nullptr); } Scrap = scrap; if(Scrap != nullptr) { connect(Scrap, SIGNAL(stationAdded()), SLOT(pointAdded())); connect(Scrap, SIGNAL(stationRemoved(int)), SLOT(pointRemoved(int))); connect(Scrap, SIGNAL(stationPositionChanged(int, int)), SLOT(updateItemsPositions(int, int))); connect(Scrap, SIGNAL(stationNameChanged(int)), SLOT(updateShotLines())); connect(Scrap->noteTransformation(), SIGNAL(scaleChanged()), SLOT(updateShotLines())); connect(Scrap->noteTransformation(), SIGNAL(northUpChanged()), SLOT(updateShotLines())); resizeNumberOfItems(Scrap->numberOfStations()); } else { resizeNumberOfItems(0); //No items, remove all old ones } cwScrapPointView::setScrap(scrap); } }
//! Function to set the selected scale from text bool QgsScaleComboBox::setScaleString( const QString& scaleTxt ) { bool ok; double newScale = toDouble( scaleTxt, &ok ); double oldScale = mScale; if ( newScale < mMinScale ) { newScale = mMinScale; } if ( ! ok ) { return false; } else { mScale = newScale; setEditText( toString( mScale ) ); clearFocus(); if ( mScale != oldScale ) { emit scaleChanged( mScale ); } return true; } }
void QDeclarativeWebView::init() { d = new QDeclarativeWebViewPrivate(this); if (QWebSettings::iconDatabasePath().isNull() && QWebSettings::globalSettings()->localStoragePath().isNull() && QWebSettings::offlineStoragePath().isNull() && QWebSettings::offlineWebApplicationCachePath().isNull()) QWebSettings::enablePersistentStorage(); setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemHasNoContents, true); setFlag(QGraphicsItem::ItemIsFocusScope, true); setClip(true); d->view = new GraphicsWebView(this); d->view->setResizesToContents(true); d->view->setFocus(); QWebPage* wp = new QDeclarativeWebPage(this); setPage(wp); if (!preferredWidth()) setPreferredWidth(d->view->preferredWidth()); if (!preferredHeight()) setPreferredHeight(d->view->preferredHeight()); connect(d->view, SIGNAL(geometryChanged()), this, SLOT(updateDeclarativeWebViewSize())); connect(d->view, SIGNAL(doubleClick(int,int)), this, SIGNAL(doubleClick(int,int))); connect(d->view, SIGNAL(scaleChanged()), this, SIGNAL(contentsScaleChanged())); }
//! Slot called when QComboBox has changed void QgsScaleComboBox::fixupScale() { double newScale; double oldScale = mScale; bool ok, userSetScale; QStringList txtList = currentText().split( ':' ); txtList.size() == 2 ? userSetScale = false : userSetScale = true ; // QgsDebugMsg( QString( "entered with oldScale: %1" ).arg( oldScale ) ); newScale = toDouble( currentText(), &ok ); // Valid string representation if ( ok && ( newScale != oldScale ) ) { // if a user types scale = 2345, we transform to 1:2345 if ( userSetScale && newScale >= 1.0 ) { mScale = 1 / newScale; } else { mScale = newScale; } setScale( mScale ); emit scaleChanged(); } else { // Invalid string representation or same scale // Reset to the old setScale( mScale ); } }
void GraphicsView::setScale(qreal scale) { mScale = scale; QTransform transform; setTransform(transform.scale(mScale, mScale)); emit scaleChanged(scale * 1000); }
void TimeSeriesMotion::setScale(double scale) { if (fabs(m_scale - scale) > DBL_EPSILON) { // Compute the ratio and apply this to the acceleration const double ratio = scale / m_scale; m_scale = scale; emit scaleChanged(scale); if (m_isLoaded) { // Scale the various spectra for (int i = 0; i < m_accel.size(); ++i) m_accel[i] = ratio * m_accel.at(i); for (int i = 0; i < m_fourierAcc.size(); ++i) { m_fourierAcc[i] *= ratio; m_fourierVel[i] *= ratio; } m_respSpec->scaleBy(ratio); setPga(ratio * m_pga); setPgv(ratio * m_pgv); } } }
QgsMapUnitScaleDialog::QgsMapUnitScaleDialog( QWidget* parent ) : QDialog( parent ) { setupUi( this ); mComboBoxMinScale->setScale( 0.0000001 ); mComboBoxMaxScale->setScale( 1 ); mSpinBoxMinSize->setShowClearButton( false ); mSpinBoxMaxSize->setShowClearButton( false ); connect( mCheckBoxMinScale, SIGNAL( toggled( bool ) ), this, SLOT( configureMinComboBox() ) ); connect( mCheckBoxMaxScale, SIGNAL( toggled( bool ) ), this, SLOT( configureMaxComboBox() ) ); connect( mComboBoxMinScale, SIGNAL( scaleChanged() ), this, SLOT( configureMaxComboBox() ) ); connect( mComboBoxMaxScale, SIGNAL( scaleChanged() ), this, SLOT( configureMinComboBox() ) ); connect( mCheckBoxMinSize, SIGNAL( toggled( bool ) ), mSpinBoxMinSize, SLOT( setEnabled( bool ) ) ); connect( mCheckBoxMaxSize, SIGNAL( toggled( bool ) ), mSpinBoxMaxSize, SLOT( setEnabled( bool ) ) ); }
void QgsTileScaleWidget::layerChanged( QgsMapLayer *layer ) { mSlider->setDisabled( true ); QgsRasterLayer *rl = qobject_cast<QgsRasterLayer *>( layer ); if ( !rl || rl->providerType() != QLatin1String( "wms" ) || !rl->dataProvider() ) return; QVariant res = rl->dataProvider()->property( "resolutions" ); mResolutions.clear(); Q_FOREACH ( const QVariant &r, res.toList() ) { QgsDebugMsg( QString( "found resolution: %1" ).arg( r.toDouble() ) ); mResolutions << r.toDouble(); } if ( mResolutions.isEmpty() ) return; mSlider->setRange( 0, mResolutions.size() - 1 ); mSlider->setTickInterval( 1 ); mSlider->setInvertedAppearance( true ); mSlider->setPageStep( 1 ); mSlider->setTracking( false ); scaleChanged( mMapCanvas->scale() ); mSlider->setEnabled( true ); show(); }
void MiniMap::setMapEditor(MapEditor *editor) { const DocumentManager *dm = DocumentManager::instance(); if (mMapEditor) { mMapEditor->disconnect(this); if (MapView *mapView = dm->currentMapView()) { mapView->zoomable()->disconnect(this); mapView->horizontalScrollBar()->disconnect(this); mapView->verticalScrollBar()->disconnect(this); } } mMapEditor = editor; if (mMapEditor) { connect(mMapEditor->undoStack(), SIGNAL(indexChanged(int)), this, SLOT(scheduleMapImageUpdate())); if (MapView *mapView = dm->currentMapView()) { connect(mapView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(update())); connect(mapView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(update())); connect(mapView->zoomable(), SIGNAL(scaleChanged(qreal)), this, SLOT(update())); } }
void MeshDataModel::setScale(float arg) { if (m_scale == arg) return; m_scale = arg; if(m_mesh!=NULL) m_mesh->default_scale=m_scale; emit scaleChanged(arg); }
void DCameraView::setScale(qreal scale) { if (m_scale == scale) return; m_scale = scale; emit scaleChanged(scale); }
void AnalogPin::setScale(double s) { if(s>0 && !qFuzzyCompare(s+1.0, d->scale+1.0)) { d->scale = s; emit scaleChanged(s); emit valueChanged(); } }
void ViewportView::update() { scene()->invalidate(); emit(changed(getMatrix())); emit(centerChanged(center)); emit(scaleChanged(scale)); }
void InstancedHistogramScene::setScale( float scale ) { if ( qFuzzyCompare( m_scale, scale ) ) return; QMutexLocker locker( &m_mutex ); m_scale = scale; emit scaleChanged(); }
void QGraphicsScale3D::setScale(const QVector3D &value) { Q_D(QGraphicsScale3D); if (d->scale != value) { d->scale = value; emit transformChanged(); emit scaleChanged(); } }
void Viewport::wheelEvent(QWheelEvent *event) { QVector3D a = sceneToWorld(mapToScene(event->pos())); scale *= pow(1.001, -event->delta()); QVector3D b = sceneToWorld(mapToScene(event->pos())); pan(a - b); emit(viewChanged()); emit(scaleChanged(scale)); }
void CartesianWidget::setScale(int scaleX, int scaleY) { m_scaleX = scaleX; m_scaleY = scaleY; calcBounds(); emit scaleChanged(m_scaleX, m_scaleY); }
void SkeletonAnimationFbo::setScale(float value) { if (mScale == value) return; mScale = value; Q_EMIT scaleChanged(); if (isComponentComplete()) { loadSkeletonAndAtlasData(); } }
void TextField::doDraw(const CurrentTransform&, float sx, float sy, float ex, float ey) { G_UNUSED(sx); G_UNUSED(sy); G_UNUSED(ex); G_UNUSED(ey); if (scaleChanged()) createGraphics(); for (std::vector<GraphicsBase>::iterator it=graphicsBase_.begin();it!=graphicsBase_.end();it++) (*it).draw(shader_); }
void QQuickScale::setYScale(qreal scale) { Q_D(QQuickScale); if (d->yScale == scale) return; d->yScale = scale; update(); emit yScaleChanged(); emit scaleChanged(); }
void QGraphicsScale::setZScale(qreal scale) { Q_D(QGraphicsScale); if (d->zScale == scale) return; d->zScale = scale; update(); emit zScaleChanged(); emit scaleChanged(); }
void XFormView::reset() { emit rotationChanged(0); emit scaleChanged(1000); emit shearChanged(0); ctrlPoints = QPolygonF(); ctrlPoints << QPointF(250, 250) << QPointF(350, 250); pts->setPoints(ctrlPoints); pts->firePointChange(); }
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 UIConfig::setScale( float scale ) { m_Scale = scale; if ( m_Scale < LOWER_SCALE_LIMIT ) m_Scale = LOWER_SCALE_LIMIT; if ( m_Scale > UPPER_SCALE_LIMIT ) m_Scale = UPPER_SCALE_LIMIT; emit scaleChanged(); }
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."; }
void ScaleWidget::createControls() { style::margins margin(0, 0, 0, st::settingsSmallSkip); addChildRow(_auto, margin, lng_settings_scale_auto(lt_cur, scaleLabel(cScreenScale())), SLOT(onAutoChanged()), (cConfigScale() == dbisAuto)); addChildRow(_scale, style::margins(0, 0, 0, 0)); _scale->addSection(scaleLabel(dbisOne)); _scale->addSection(scaleLabel(dbisOneAndQuarter)); _scale->addSection(scaleLabel(dbisOneAndHalf)); _scale->addSection(scaleLabel(dbisTwo)); _scale->setActiveSectionFast(cEvalScale(cConfigScale()) - 1); _scale->setSectionActivatedCallback([this] { scaleChanged(); }); }
bool QgsScaleComboBox::setScaleString( const QString &string ) { double oldScale = mScale; if ( mAllowNull && string.trimmed().isEmpty() ) { mScale = std::numeric_limits< double >::quiet_NaN(); setEditText( toString( mScale ) ); clearFocus(); if ( !std::isnan( oldScale ) ) { emit scaleChanged( mScale ); } return true; } bool ok; double newScale = toDouble( string, &ok ); if ( newScale > mMinScale && newScale != 0 && mMinScale != 0 ) { newScale = mMinScale; } if ( ! ok ) { return false; } else { mScale = newScale; setEditText( toString( mScale ) ); clearFocus(); if ( mScale != oldScale ) { emit scaleChanged( mScale ); } return true; } }