Skip to content

Commit

Permalink
Flip more colors buttons to QgsColorButtonV2
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 13, 2014
1 parent b8bdc8f commit 3e9ab60
Show file tree
Hide file tree
Showing 13 changed files with 298 additions and 226 deletions.
10 changes: 8 additions & 2 deletions src/app/qgsdiagramproperties.cpp
Expand Up @@ -52,10 +52,16 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare

mDiagramPropertiesTabWidget->setCurrentIndex( tabIdx );

mBackgroundColorButton->setColorDialogTitle( tr( "Background color" ) );
mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mDiagramPenColorButton->setColorDialogTitle( tr( "Pen color" ) );
mBackgroundColorButton->setContext( "symbology" );
mBackgroundColorButton->setShowNoColor( true );
mBackgroundColorButton->setNoColorString( tr( "Transparent background" ) );
mDiagramPenColorButton->setColorDialogTitle( tr( "Select pen color" ) );
mDiagramPenColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mDiagramPenColorButton->setContext( "symbology" );
mDiagramPenColorButton->setShowNoColor( true );
mDiagramPenColorButton->setNoColorString( tr( "Transparent outline" ) );

mValueLineEdit->setValidator( new QDoubleValidator( mValueLineEdit ) );
mMinimumDiagramScaleLineEdit->setValidator( new QDoubleValidator( mMinimumDiagramScaleLineEdit ) );
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -262,6 +262,9 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
mMaximumOversamplingSpinBox->setValue( resampleFilter->maxOversampling() );
}

btnColorizeColor->setColorDialogTitle( tr( "Select color" ) );
btnColorizeColor->setContext( "symbology" );

// Hue and saturation color control
const QgsHueSaturationFilter* hueSaturationFilter = mRasterLayer->hueSaturationFilter();
//set hue and saturation controls to current values
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgstextannotationdialog.cpp
Expand Up @@ -35,6 +35,8 @@ QgsTextAnnotationDialog::QgsTextAnnotationDialog( QgsTextAnnotationItem* item, Q
}
mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
mFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mFontColorButton->setContext( "symbology" );

setCurrentFontPropertiesToGui();

QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applyTextToItem() ) );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgscolorswatchgrid.cpp
Expand Up @@ -258,11 +258,11 @@ void QgsColorSwatchGrid::draw( QPainter &painter )
//draw header background
painter.setBrush( headerBgColor ) ;
painter.setPen( Qt::NoPen );
painter.drawRect( QRect( 0, 0, mWidth, LABEL_SIZE ) );
painter.drawRect( QRect( 0, 0, width(), LABEL_SIZE ) );

//draw header text
painter.setPen( headerTextColor );
painter.drawText( QRect( LABEL_MARGIN, 0, mWidth - 2 * LABEL_MARGIN, LABEL_SIZE ),
painter.drawText( QRect( LABEL_MARGIN, 0, width() - 2 * LABEL_MARGIN, LABEL_SIZE ),
Qt::AlignLeft | Qt::AlignVCenter, mScheme->schemeName() );

//draw color swatches
Expand Down
5 changes: 5 additions & 0 deletions src/gui/symbology-ng/qgspointdisplacementrendererwidget.cpp
Expand Up @@ -93,6 +93,11 @@ QgsPointDisplacementRendererWidget::QgsPointDisplacementRendererWidget( QgsVecto
}
}

mCircleColorButton->setColorDialogTitle( tr( "Select color" ) );
mCircleColorButton->setContext( "symbology" );
mLabelColorButton->setContext( "symbology" );
mLabelColorButton->setColorDialogTitle( tr( "Select color" ) );

mCircleWidthSpinBox->setValue( mRenderer->circleWidth() );
mCircleColorButton->setColor( mRenderer->circleColor() );
mLabelColorButton->setColor( mRenderer->labelColor() );
Expand Down
8 changes: 8 additions & 0 deletions src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp
Expand Up @@ -36,7 +36,15 @@ QgsVectorGradientColorRampV2Dialog::QgsVectorGradientColorRampV2Dialog( QgsVecto
#endif

btnColor1->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnColor1->setColorDialogTitle( tr( "Select ramp color" ) );
btnColor1->setContext( "symbology" );
btnColor1->setShowNoColor( true );
btnColor1->setNoColorString( tr( "Transparent" ) );
btnColor2->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnColor2->setColorDialogTitle( tr( "Select ramp color" ) );
btnColor2->setContext( "symbology" );
btnColor2->setShowNoColor( true );
btnColor2->setNoColorString( tr( "Transparent" ) );
connect( btnColor1, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor1( const QColor& ) ) );
connect( btnColor2, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor2( const QColor& ) ) );

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/grass/qgsgrassregion.cpp
Expand Up @@ -270,6 +270,8 @@ QgsGrassRegion::QgsGrassRegion( QgsGrassPlugin *plugin, QgisInterface *iface,

// Symbology
QPen pen = mPlugin->regionPen();
mColorButton->setContext( "gui" );
mColorButton->setColorDialogTitle( tr( "Select color" ) );
mColorButton->setColor( pen.color() );
connect( mColorButton, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( changeColor( const QColor& ) ) );

Expand Down
12 changes: 6 additions & 6 deletions src/plugins/grass/qgsgrassregionbase.ui
Expand Up @@ -199,16 +199,16 @@ or change the following values</string>
</spacer>
</item>
<item row="0" column="1">
<widget class="QgsColorButton" name="mColorButton">
<widget class="QgsColorButtonV2" name="mColorButton">
<property name="minimumSize">
<size>
<width>64</width>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<width>120</width>
<height>16777215</height>
</size>
</property>
Expand All @@ -234,9 +234,9 @@ or change the following values</string>
</widget>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
<class>QgsColorButtonV2</class>
<extends>QToolButton</extends>
<header>qgscolorbuttonv2.h</header>
</customwidget>
</customwidgets>
<resources/>
Expand Down
40 changes: 32 additions & 8 deletions src/ui/qgsdiagrampropertiesbase.ui
Expand Up @@ -39,8 +39,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>743</width>
<height>761</height>
<width>756</width>
<height>627</height>
</rect>
</property>
<layout class="QVBoxLayout" name="scrollAreaLayout">
Expand Down Expand Up @@ -120,7 +120,7 @@
<item>
<widget class="QTabWidget" name="mDiagramPropertiesTabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="mDiagramPropertiesTabWidgetPage1">
<attribute name="title">
Expand All @@ -130,7 +130,19 @@
<item row="0" column="0" rowspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="2">
<widget class="QgsColorButton" name="mDiagramPenColorButton">
<widget class="QgsColorButtonV2" name="mDiagramPenColorButton">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
Expand Down Expand Up @@ -227,7 +239,19 @@
</widget>
</item>
<item row="3" column="2">
<widget class="QgsColorButton" name="mBackgroundColorButton">
<widget class="QgsColorButtonV2" name="mBackgroundColorButton">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
Expand Down Expand Up @@ -992,9 +1016,9 @@ Leave empty to automatically apply the maximum value.</string>
</widget>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
<class>QgsColorButtonV2</class>
<extends>QToolButton</extends>
<header>qgscolorbuttonv2.h</header>
</customwidget>
</customwidgets>
<resources>
Expand Down

0 comments on commit 3e9ab60

Please sign in to comment.