Skip to content
Permalink
Browse files

Port some more color buttons to QgsColorButtonV2

  • Loading branch information
nyalldawson committed Aug 12, 2014
1 parent 766f078 commit cecb3d184beb645a309092ad45fb65d4781bca1a
@@ -44,9 +44,15 @@ QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * par
mFrameColorButton->setColor( mItem->frameColor() );
mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) );
mFrameColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mFrameColorButton->setContext( "symbology" );
mFrameColorButton->setNoColorString( tr( "Transparent frame" ) );
mFrameColorButton->setShowNoColor( true );
mBackgroundColorButton->setColor( mItem->frameBackgroundColor() );
mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mBackgroundColorButton->setContext( "symbology" );
mBackgroundColorButton->setNoColorString( tr( "Transparent" ) );
mBackgroundColorButton->setShowNoColor( true );

const QgsMarkerSymbolV2* symbol = mItem->markerSymbol();
if ( symbol )
@@ -42,6 +42,9 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
cboPlacement->setCurrentIndex( mDeco.mPlacementIndex );
// color
pbnColorChooser->setColor( mDeco.mLabelQColor );
pbnColorChooser->setContext( "gui" );
pbnColorChooser->setColorDialogTitle( tr( "Select text color" ) );

QTextCursor cursor = txtCopyrightText->textCursor();
txtCopyrightText->selectAll();
txtCopyrightText->setTextColor( mDeco.mLabelQColor );
@@ -59,6 +59,8 @@ QgsDecorationScaleBarDialog::QgsDecorationScaleBarDialog( QgsDecorationScaleBar&
cboStyle->setCurrentIndex( mDeco.mStyleIndex );

pbnChangeColor->setColor( mDeco.mColor );
pbnChangeColor->setContext( "gui" );
pbnChangeColor->setColorDialogTitle( tr( "Select scalebar color" ) );
}

QgsDecorationScaleBarDialog::~QgsDecorationScaleBarDialog()
@@ -141,6 +141,23 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas,

populateFontCapitalsComboBox();

// color buttons
mPreviewBackgroundBtn->setColorDialogTitle( tr( "Select fill color" ) );
mPreviewBackgroundBtn->setContext( "labelling" );
btnTextColor->setColorDialogTitle( tr( "Select text color" ) );
btnTextColor->setContext( "labelling" );
btnTextColor->setDefaultColor( Qt::black );
btnBufferColor->setColorDialogTitle( tr( "Select buffer color" ) );
btnBufferColor->setContext( "labelling" );
btnBufferColor->setDefaultColor( Qt::white );
mShapeBorderColorBtn->setColorDialogTitle( tr( "Select border color" ) );
mShapeBorderColorBtn->setContext( "labelling" );
mShapeFillColorBtn->setColorDialogTitle( tr( "Select fill color" ) );
mShapeFillColorBtn->setContext( "labelling" );
mShadowColorBtn->setColorDialogTitle( tr( "Select shadow color" ) );
mShadowColorBtn->setContext( "labelling" );
mShadowColorBtn->setDefaultColor( Qt::black );

// set up quadrant offset button group
mQuadrantBtnGrp = new QButtonGroup( this );
mQuadrantBtnGrp->addButton( mPointOffsetAboveLeft, ( int )QgsPalLayerSettings::QuadrantAboveLeft );
@@ -344,6 +361,7 @@ void QgsLabelingGui::init()
chkPreserveRotation->setChecked( lyr.preserveRotation );

mPreviewBackgroundBtn->setColor( lyr.previewBkgrdColor );
mPreviewBackgroundBtn->setDefaultColor( lyr.previewBkgrdColor );
setPreviewBackground( lyr.previewBkgrdColor );

mScaleBasedVisibilityChkBx->setChecked( lyr.scaleVisibility );
@@ -101,6 +101,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :

mIdentifyHighlightColorButton->setColorDialogTitle( tr( "Identify highlight color" ) );
mIdentifyHighlightColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mIdentifyHighlightColorButton->setContext( "gui" );
mIdentifyHighlightColorButton->setDefaultColor( QGis::DEFAULT_HIGHLIGHT_COLOR );

QSettings settings;

@@ -616,20 +618,28 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
int myBlue = settings.value( "/qgis/default_selection_color_blue", 0 ).toInt();
int myAlpha = settings.value( "/qgis/default_selection_color_alpha", 255 ).toInt();
pbnSelectionColor->setColor( QColor( myRed, myGreen, myBlue, myAlpha ) );
pbnSelectionColor->setColorDialogTitle( tr( "Selection color" ) );
pbnSelectionColor->setColorDialogTitle( tr( "Set selection color" ) );
pbnSelectionColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
pbnSelectionColor->setContext( "gui" );
pbnSelectionColor->setDefaultColor( QColor( 255, 255, 0, 255 ) );

//set the default color for canvas background
myRed = settings.value( "/qgis/default_canvas_color_red", 255 ).toInt();
myGreen = settings.value( "/qgis/default_canvas_color_green", 255 ).toInt();
myBlue = settings.value( "/qgis/default_canvas_color_blue", 255 ).toInt();
pbnCanvasColor->setColor( QColor( myRed, myGreen, myBlue ) );
pbnCanvasColor->setColorDialogTitle( tr( "Set canvas color" ) );
pbnCanvasColor->setContext( "gui" );
pbnCanvasColor->setDefaultColor( Qt::white );

// set the default color for the measure tool
myRed = settings.value( "/qgis/default_measure_color_red", 222 ).toInt();
myGreen = settings.value( "/qgis/default_measure_color_green", 155 ).toInt();
myBlue = settings.value( "/qgis/default_measure_color_blue", 67 ).toInt();
pbnMeasureColor->setColor( QColor( myRed, myGreen, myBlue ) );
pbnMeasureColor->setColorDialogTitle( tr( "Set measuring tool color" ) );
pbnMeasureColor->setContext( "gui" );
pbnMeasureColor->setDefaultColor( QColor( 222, 155, 67 ) );

capitaliseCheckBox->setChecked( settings.value( "/qgis/capitaliseLayerName", QVariant( false ) ).toBool() );

@@ -703,6 +713,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
mGridColorButton->setColor( gridColor );
mGridColorButton->setColorDialogTitle( tr( "Select grid color" ) );
mGridColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mGridColorButton->setContext( "gui" );
mGridColorButton->setDefaultColor( QColor( 190, 190, 190, 100 ) );

//default composer grid style
QString gridStyleString;
@@ -758,6 +770,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
myAlpha = settings.value( "/qgis/digitizing/line_color_alpha", 200 ).toInt();
mLineColorToolButton->setColor( QColor( myRed, myGreen, myBlue, myAlpha ) );
mLineColorToolButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mLineColorToolButton->setContext( "gui" );
mLineColorToolButton->setDefaultColor( QColor( 255, 0, 0, 200 ) );

//default snap mode
mDefaultSnapModeComboBox->insertItem( 0, tr( "To vertex" ), "to vertex" );
@@ -6,90 +6,144 @@
<rect>
<x>0</x>
<y>0</y>
<width>221</width>
<width>319</width>
<height>172</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="mMapPositionFixedCheckBox">
<property name="text">
<string>Fixed map position</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<widget class="QgsColorButton" name="mFrameColorButton">
<property name="text">
<string/>
<widget class="QLabel" name="mMapMarkerLabel">
<property name="text">
<string>Map marker</string>
</property>
<property name="buddy">
<cstring>mMapMarkerButton</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="mMapMarkerButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mFrameWidthLabel">
<property name="text">
<string>Frame width</string>
</property>
<property name="buddy">
<cstring>mFrameWidthSpinBox</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="mFrameWidthSpinBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mBackgroundColorLabel">
<property name="text">
<string>Background color</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<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>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mBackgroundColorLabel">
<property name="text">
<string>Background color</string>
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mMapMarkerLabel">
<property name="text">
<string>Map marker</string>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="buddy">
<cstring>mMapMarkerButton</cstring>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="2" column="1">
<widget class="QgsColorButton" name="mBackgroundColorButton">
<property name="text">
<string/>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="mFrameColorLabel">
<property name="text">
<string>Frame color</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QgsColorButtonV2" name="mFrameColorButton">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="mMapMarkerButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mFrameWidthLabel">
<property name="text">
<string>Frame width</string>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="buddy">
<cstring>mFrameWidthSpinBox</cstring>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="mFrameWidthSpinBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mFrameColorLabel">
<property name="text">
<string>Frame color</string>
</property>
</widget>
</spacer>
</item>
</layout>
</item>
</layout>
</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/>

0 comments on commit cecb3d1

Please sign in to comment.
You can’t perform that action at this time.