QgsVectorGradientColorRampV2Dialog::QgsVectorGradientColorRampV2Dialog( QgsVectorGradientColorRampV2* ramp, QWidget* parent ) : QDialog( parent ) , mRamp( ramp ) , mCurrentPlotColorComponent( -1 ) , mCurrentPlotMarkerIndex( 0 ) { setupUi( this ); #ifdef Q_OS_MAC setWindowModality( Qt::WindowModal ); #endif mPositionSpinBox->setShowClearButton( false ); btnColor1->setAllowAlpha( true ); btnColor1->setColorDialogTitle( tr( "Select ramp color" ) ); btnColor1->setContext( "symbology" ); btnColor1->setShowNoColor( true ); btnColor1->setNoColorString( tr( "Transparent" ) ); btnColor2->setAllowAlpha( true ); btnColor2->setColorDialogTitle( tr( "Select ramp color" ) ); btnColor2->setContext( "symbology" ); btnColor2->setShowNoColor( true ); btnColor2->setNoColorString( tr( "Transparent" ) ); updateColorButtons(); connect( btnColor1, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor1( const QColor& ) ) ); connect( btnColor2, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor2( const QColor& ) ) ); // fill type combobox cboType->blockSignals( true ); cboType->addItem( tr( "Discrete" ) ); cboType->addItem( tr( "Continuous" ) ); if ( mRamp->isDiscrete() ) cboType->setCurrentIndex( 0 ); else cboType->setCurrentIndex( 1 ); cboType->blockSignals( false ); if ( mRamp->info().isEmpty() ) btnInformation->setEnabled( false ); mStopEditor->setGradientRamp( *mRamp ); connect( mStopEditor, SIGNAL( changed() ), this, SLOT( updateRampFromStopEditor() ) ); connect( mColorWidget, SIGNAL( currentColorChanged( QColor ) ), this, SLOT( colorWidgetChanged( QColor ) ) ); connect( mDeleteStopButton, SIGNAL( clicked() ), mStopEditor, SLOT( deleteSelectedStop() ) ); QSettings settings; restoreGeometry( settings.value( "/Windows/GradientEditor/geometry" ).toByteArray() ); // hide the ugly canvas frame mPlot->setFrameStyle( QFrame::NoFrame ); #if defined(QWT_VERSION) && QWT_VERSION>=0x060000 QFrame* plotCanvasFrame = dynamic_cast<QFrame*>( mPlot->canvas() ); if ( plotCanvasFrame ) plotCanvasFrame->setFrameStyle( QFrame::NoFrame ); #else mPlot->canvas()->setFrameStyle( QFrame::NoFrame ); #endif mPlot->setAxisScale( QwtPlot::yLeft, 0.0, 1.0 ); mPlot->enableAxis( QwtPlot::yLeft, false ); mLightnessCurve = new QwtPlotCurve(); mLightnessCurve->setTitle( "Lightness" ); mLightnessCurve->setPen( QPen( QColor( 70, 150, 255 ), 0.0 ) ), mLightnessCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true ); mLightnessCurve->attach( mPlot ); mHueCurve = new QwtPlotCurve(); mHueCurve->setTitle( "Hue" ); mHueCurve->setPen( QPen( QColor( 255, 215, 70 ), 0.0 ) ), mHueCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true ); mHueCurve->attach( mPlot ); mSaturationCurve = new QwtPlotCurve(); mSaturationCurve->setTitle( "Saturation" ); mSaturationCurve->setPen( QPen( QColor( 255, 70, 150 ), 0.0 ) ), mSaturationCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true ); mSaturationCurve->attach( mPlot ); mAlphaCurve = new QwtPlotCurve(); mAlphaCurve->setTitle( "Alpha" ); mAlphaCurve->setPen( QPen( QColor( 50, 50, 50 ), 0.0 ) ), mAlphaCurve->setRenderHint( QwtPlotItem::RenderAntialiased, true ); mAlphaCurve->attach( mPlot ); mPlotFilter = new QgsGradientPlotEventFilter( mPlot ); connect( mPlotFilter, SIGNAL( mousePress( QPointF ) ), this, SLOT( plotMousePress( QPointF ) ) ); connect( mPlotFilter, SIGNAL( mouseRelease( QPointF ) ), this, SLOT( plotMouseRelease( QPointF ) ) ); connect( mPlotFilter, SIGNAL( mouseMove( QPointF ) ), this, SLOT( plotMouseMove( QPointF ) ) ); mPlotHueCheckbox->setChecked( settings.value( "/GradientEditor/plotHue", false ).toBool() ); mPlotLightnessCheckbox->setChecked( settings.value( "/GradientEditor/plotLightness", true ).toBool() ); mPlotSaturationCheckbox->setChecked( settings.value( "/GradientEditor/plotSaturation", false ).toBool() ); mPlotAlphaCheckbox->setChecked( settings.value( "/GradientEditor/plotAlpha", false ).toBool() ); mHueCurve->setVisible( mPlotHueCheckbox->isChecked() ); mLightnessCurve->setVisible( mPlotLightnessCheckbox->isChecked() ); mSaturationCurve->setVisible( mPlotSaturationCheckbox->isChecked() ); mAlphaCurve->setVisible( mPlotAlphaCheckbox->isChecked() ); connect( mStopEditor, SIGNAL( selectedStopChanged( QgsGradientStop ) ), this, SLOT( selectedStopChanged( QgsGradientStop ) ) ); mStopEditor->selectStop( 0 ); }
void QColorSelector::OnCurrentColorChanged(const QColor& Color) { emit currentColorChanged(Color); }
void QColorPushButton::OnCurrentColorChanged(const QColor& Color) { SetColor(Color); emit currentColorChanged(m_Color); }
{ connect(ui->lineWidthDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(treatLineWidthChanging())); connect(ui->lineStyleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(treatLineStyleChanging())); connect(ui->lineInterpolationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(treatLineInterpolationChanging())); connect(ui->scatterShapeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(treatScatterShapeChanging())); connect(ui->scatterSizeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(treatScatterSizeChanging())); connect(ui->scatterDecimationSpinBox, SIGNAL(valueChanged(int)), this, SLOT(treatScatterDecimationChanging())); connect(ui->isColorFixedCheckBox, SIGNAL(toggled(bool)), this, SLOT(treatLineColorFixing())); connect(ui->lineColorWidget, SIGNAL(currentColorChanged(QColor)), this, SLOT(treatLineColorChanging())); } void DataSourceControlWidget::disconnectStyleWidgets() { disconnect(ui->lineWidthDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(treatLineWidthChanging())); disconnect(ui->lineStyleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(treatLineStyleChanging())); disconnect(ui->lineInterpolationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(treatLineInterpolationChanging())); disconnect(ui->scatterShapeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(treatScatterShapeChanging())); disconnect(ui->scatterSizeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(treatScatterSizeChanging()));
void ToolsBar::changeCurrentColor(QColor col) { m_color->changeCurrentColor(col); emit currentColorChanged(col); }
void KnobGuiColor::showColorDialog() { QColorDialog dialog( _colorLabel->parentWidget() ); dialog.setOption(QColorDialog::DontUseNativeDialog); KnobColorPtr knob = _knob.lock(); if (!knob) { return; } const int nDims = knob->getNDimensions(); ViewIdx view = getView(); double curR = knob->getValue(DimIdx(0), view, false /*clampToMinmax*/); _lastColor.resize(nDims); _lastColor[0] = curR; double curG = curR; double curB = curR; double curA = 1.; if (nDims > 1) { curG = knob->getValue(DimIdx(1), view, false /*clampToMinmax*/); _lastColor[1] = curG; curB = knob->getValue(DimIdx(2), view, false /*clampToMinmax*/); _lastColor[2] = curB; } if (nDims > 3) { dialog.setOption(QColorDialog::ShowAlphaChannel); curA = knob->getValue(DimIdx(3), view, false /*clampToMinmax*/); _lastColor[3] = curA; } convertFromInternalToUIColorspace(&curR, &curG, &curB); QColor curColor; curColor.setRgbF( Image::clamp<qreal>(curR, 0., 1.), Image::clamp<qreal>(curG, 0., 1.), Image::clamp<qreal>(curB, 0., 1.), Image::clamp<qreal>(curA, 0., 1.) ); dialog.setCurrentColor(curColor); QObject::connect( &dialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(onDialogCurrentColorChanged(QColor)) ); if ( !dialog.exec() ) { knob->setValueAcrossDimensions(_lastColor, DimIdx(0), view, eValueChangedReasonUserEdited); } else { QColor userColor = dialog.currentColor(); std::vector<double> color(nDims); color[0] = userColor.redF(); convertFromUIToInternalColorspace(&color[0]); if (nDims > 1) { color[1] = userColor.greenF(); convertFromUIToInternalColorspace(&color[1]); } if (nDims > 2) { color[2] = userColor.blueF(); convertFromUIToInternalColorspace(&color[2]); } if (nDims > 3) { color[3] = userColor.alphaF(); } for (int i = 0; i < 3; ++i) { SpinBox* sb = 0; getSpinBox(DimIdx(i), &sb); if (sb) { sb->setValue(color[i]); } } std::vector<double> oldColor(nDims); for (int i = 0; i < nDims; ++i) { oldColor[i] = _lastColor[i]; } KnobGuiPtr knobUI = getKnobGui(); knobUI->pushUndoCommand( new KnobUndoCommand<double>(knob, oldColor, color, getView()) ); } KnobGuiPtr knobUI = getKnobGui(); if ( knobUI->getGui() ) { knobUI->getGui()->setDraftRenderEnabled(false); } } // showColorDialog