void ColorChooser::showCurrentHistogram() { dividerLower->setVisible(m_discretizeMethod != DiscretizeNone); dividerUpper->setVisible(m_discretizeMethod != DiscretizeNone); refreshHistogram(&intensityHistogram, DiscretizeIntensity); refreshHistogram(&foregroundHistogram, DiscretizeForeground); refreshHistogram(&hueHistogram, DiscretizeHue); refreshHistogram(&saturationHistogram, DiscretizeSaturation); refreshHistogram(&valueHistogram, DiscretizeValue); }
QgsHistogramWidget::QgsHistogramWidget( QWidget *parent, QgsVectorLayer* layer, const QString& fieldOrExp ) : QWidget( parent ) , mRedrawRequired( true ) , mVectorLayer( layer ) , mSourceFieldExp( fieldOrExp ) { setupUi( this ); mPlot = mpPlot; // hide the ugly canvas frame #if defined(QWT_VERSION) && QWT_VERSION>=0x060000 QFrame* plotCanvasFrame = dynamic_cast<QFrame*>( mpPlot->canvas() ); if ( plotCanvasFrame ) plotCanvasFrame->setFrameStyle( QFrame::NoFrame ); #else mpPlot->canvas()->setFrameStyle( QFrame::NoFrame ); #endif QSettings settings; mMeanCheckBox->setChecked( settings.value( "/HistogramWidget/showMean", false ).toBool() ); mStdevCheckBox->setChecked( settings.value( "/HistogramWidget/showStdev", false ).toBool() ); connect( mBinsSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( refreshAndRedraw() ) ); connect( mMeanCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( refreshAndRedraw() ) ); connect( mStdevCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( refreshAndRedraw() ) ); mGridPen = QPen( QColor( 0, 0, 0, 40 ) ); mMeanPen = QPen( QColor( 10, 10, 10, 220 ) ); mMeanPen.setStyle( Qt::DashLine ); mStdevPen = QPen( QColor( 30, 30, 30, 200 ) ); mStdevPen.setStyle( Qt::DashLine ); if ( layer && !mSourceFieldExp.isEmpty() ) { refreshHistogram(); } }
void QgsHistogramWidget::refreshAndRedraw() { refreshHistogram(); drawHistogram(); }