// -------------------------------------------------------------------------- void ctkMatrixWidget::setValues(const QVector<double> & vector) { Q_D(ctkMatrixWidget); Q_ASSERT(vector.size() == this->rowCount() * this->columnCount()); // As we are potentially making a lot of changes, just fire a unique // signal at the end if at least one matrix value has been changed. bool blocked = this->blockSignals(true); bool modified = false; for (int row=0; row < this->rowCount(); ++row) { for (int column=0; column < this->columnCount(); ++column) { double newValue = vector.at(row * this->columnCount() + column); newValue = qBound(d->Minimum, newValue, d->Maximum); if (newValue != this->value(row, column)) { this->setValue(row, column, newValue); modified = true; } } } this->blockSignals(blocked); if (modified) { this->emit matrixChanged(); } }
void ZoomWidget::setZoom( const double & z ) { // set world matrix, reverse y direction wm_.setMatrix( z, 0.0, 0.0, -z, 0.0, height() ); emit matrixChanged( wm_ ); }
void ZoomWidget::moveViewWorldCs( const QPointF & d ) { if ( d.isNull() ) return; wm_.translate( d.x(), -d.y() ); emit matrixChanged( wm_ ); }
void Transform::setMatrix(QMatrix4x4 matrix) { if (m_matrix == matrix) return; m_matrix = matrix; update(); emit matrixChanged(); }
void QQuickMatrix4x4::setMatrix(const QMatrix4x4 &matrix) { Q_D(QQuickMatrix4x4); if (d->matrix == matrix) return; d->matrix = matrix; update(); emit matrixChanged(); }
ColorMatrixEffectConfigWidget::ColorMatrixEffectConfigWidget(QWidget *parent) : KFilterEffectConfigWidgetBase(parent), m_effect(0) { QGridLayout * g = new QGridLayout(this); m_type = new KComboBox(this); m_type->addItem(i18n("Apply color matrix")); m_type->addItem(i18n("Saturate colors")); m_type->addItem(i18n("Rotate hue")); m_type->addItem(i18n("Luminance to alpha")); g->addWidget(m_type, 0, 0); m_stack = new QStackedWidget(this); m_stack->setContentsMargins(0, 0, 0, 0); g->addWidget(m_stack, 1, 0); m_matrixModel = new MatrixDataModel(this); QTableView * matrixWidget = new QTableView(m_stack); matrixWidget->setModel(m_matrixModel); matrixWidget->horizontalHeader()->hide(); matrixWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch); matrixWidget->verticalHeader()->hide(); matrixWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); m_stack->addWidget(matrixWidget); QWidget * saturateWidget = new QWidget(m_stack); QGridLayout * saturateLayout = new QGridLayout(saturateWidget); saturateLayout->addWidget(new QLabel(i18n("Saturate value"), saturateWidget), 0, 0); m_saturate = new KDoubleNumInput(saturateWidget); m_saturate->setRange(0.0, 1.0, 0.05, false); saturateLayout->addWidget(m_saturate, 0, 1); saturateLayout->addItem(new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 1, 0); saturateWidget->setLayout(saturateLayout); m_stack->addWidget(saturateWidget); QWidget * hueRotateWidget = new QWidget(m_stack); QGridLayout * hueRotateLayout = new QGridLayout(hueRotateWidget); hueRotateLayout->addWidget(new QLabel(i18n("Angle"), hueRotateWidget), 0, 0); m_hueRotate = new KDoubleNumInput(hueRotateWidget); m_hueRotate->setRange(0.0, 360.0, 1.0, false); hueRotateLayout->addWidget(m_hueRotate, 0, 1); hueRotateLayout->addItem(new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 1, 0); hueRotateWidget->setLayout(hueRotateLayout); m_stack->addWidget(hueRotateWidget); QWidget * luminanceWidget = new QWidget(m_stack); m_stack->addWidget(luminanceWidget); setLayout(g); connect(m_type, SIGNAL(currentIndexChanged(int)), m_stack, SLOT(setCurrentIndex(int))); connect(m_type, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int))); connect(m_saturate, SIGNAL(valueChanged(double)), this, SLOT(saturateChanged(double))); connect(m_hueRotate, SIGNAL(valueChanged(double)), this, SLOT(hueRotateChanged(double))); connect(m_matrixModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(matrixChanged())); }
/*! \internal */ QCamera::QCamera(QCameraPrivate &dd, QNode *parent) : QEntity(dd, parent) { QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged()), this, SIGNAL(projectionMatrixChanged())); QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged()), this, SIGNAL(nearPlaneChanged())); QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged()), this, SIGNAL(farPlaneChanged())); QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged()), this, SIGNAL(fieldOfViewChanged())); QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged()), this, SIGNAL(aspectRatioChanged())); QObject::connect(d_func()->m_lens, SIGNAL(leftChanged()), this, SIGNAL(leftChanged())); QObject::connect(d_func()->m_lens, SIGNAL(rightChanged()), this, SIGNAL(rightChanged())); QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged()), this, SIGNAL(bottomChanged())); QObject::connect(d_func()->m_lens, SIGNAL(topChanged()), this, SIGNAL(topChanged())); QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged()), this, SIGNAL(projectionMatrixChanged())); QObject::connect(d_func()->m_lookAt, SIGNAL(positionChanged()), this, SIGNAL(positionChanged())); QObject::connect(d_func()->m_lookAt, SIGNAL(upVectorChanged()), this, SIGNAL(upVectorChanged())); QObject::connect(d_func()->m_lookAt, SIGNAL(viewCenterChanged()), this, SIGNAL(viewCenterChanged())); QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged()), this, SIGNAL(matrixChanged())); d_func()->m_transform->addTransform(d_func()->m_lookAt); addComponent(d_func()->m_lens); addComponent(d_func()->m_transform); }
void ZoomWidget::moveView( const QPointF & d ) { if ( d.isNull() ) return; QMatrix m; m = wm_.inverted(); m.translate( -d.x(), -d.y() ); wm_ = m.inverted(); emit matrixChanged( wm_ ); }
void SketchArea::updateMatrix() { // 1 : viewport matrix mMatrix=mViewportTransform; // scaleX, scaleY <=> zoom and aspectratio mMatrix.scale(mViewportScalingX, mViewportScalingY); // 3 : mMatrix.ortho(mPlotRect); emit matrixChanged(); update(); }
void ZoomWidget::zoomView( const double & z ) { if ( z == 1.0 ) return; // remember current center point in MAP CS QPointF pcenter = QPointF( width()/2,height()/2 ) * wm_.inverted(); // scale the matrix wm_.scale( z, z ); // put the center point back in the center centerView( pcenter ); emit matrixChanged( wm_ ); }
void ZoomWidget::transmitMatrix() { emit matrixChanged( wm_ ); }