Skip to content

Commit d8f2120

Browse files
committedAug 11, 2014
[composer] Flip all color buttons to QgsColorButtonV2
1 parent 856341d commit d8f2120

16 files changed

+520
-184
lines changed
 

‎src/app/composer/qgscomposerarrowwidget.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsCo
4141
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, mArrow );
4242
mainLayout->addWidget( itemPropertiesWidget );
4343

44+
mArrowHeadOutlineColorButton->setColorDialogTitle( tr( "Select arrow head outline color" ) );
45+
mArrowHeadOutlineColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
46+
mArrowHeadOutlineColorButton->setContext( "composer" );
47+
mArrowHeadOutlineColorButton->setNoColorString( tr( "Transparent outline" ) );
48+
mArrowHeadOutlineColorButton->setShowNoColor( true );
49+
mArrowHeadFillColorButton->setColorDialogTitle( tr( "Select arrow head fill color" ) );
50+
mArrowHeadFillColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
51+
mArrowHeadFillColorButton->setContext( "composer" );
52+
mArrowHeadFillColorButton->setNoColorString( tr( "Transparent fill" ) );
53+
mArrowHeadFillColorButton->setShowNoColor( true );
54+
4455
setGuiElementValues();
4556

4657
if ( arrow )
@@ -131,11 +142,7 @@ void QgsComposerArrowWidget::setGuiElementValues()
131142

132143
blockAllSignals( true );
133144
mArrowHeadFillColorButton->setColor( mArrow->arrowHeadFillColor() );
134-
mArrowHeadFillColorButton->setColorDialogTitle( tr( "Select arrow head fill color" ) );
135-
mArrowHeadFillColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
136145
mArrowHeadOutlineColorButton->setColor( mArrow->arrowHeadOutlineColor() );
137-
mArrowHeadOutlineColorButton->setColorDialogTitle( tr( "Select arrow head outline color" ) );
138-
mArrowHeadOutlineColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
139146
mOutlineWidthSpinBox->setValue( mArrow->arrowHeadOutlineWidth() );
140147
mArrowHeadWidthSpinBox->setValue( mArrow->arrowHeadWidth() );
141148

‎src/app/composer/qgscomposeritemwidget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,10 @@ void QgsComposerItemWidget::setValuesForGuiElements()
623623

624624
mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
625625
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
626+
mBackgroundColorButton->setContext( "composer" );
626627
mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) );
627628
mFrameColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
629+
mFrameColorButton->setContext( "composer" );
628630

629631
setValuesForGuiPositionElements();
630632
setValuesForGuiNonPositionElements();

‎src/app/composer/qgscomposerlabelwidget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QgsCo
3333
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
3434
mainLayout->addWidget( itemPropertiesWidget );
3535

36+
mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
37+
mFontColorButton->setContext( "composer" );
3638

3739
if ( mComposerLabel )
3840
{

‎src/app/composer/qgscomposerlegendwidget.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ): Q
117117
mMoveDownToolButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyDown.png" ) ) );
118118
mCountToolButton->setIcon( QIcon( QgsApplication::iconPath( "mActionSum.png" ) ) );
119119

120+
mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
121+
mFontColorButton->setContext( "composer" );
122+
120123
//add widget for item properties
121124
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, legend );
122125
mainLayout->addWidget( itemPropertiesWidget );

‎src/app/composer/qgscomposermapwidget.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
7070

7171
mAnnotationFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
7272
mAnnotationFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
73+
mAnnotationFontColorButton->setContext( "composer" );
7374

7475
insertAnnotationPositionEntries( mAnnotationPositionLeftComboBox );
7576
insertAnnotationPositionEntries( mAnnotationPositionRightComboBox );
@@ -83,10 +84,21 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
8384

8485
mGridFramePenColorButton->setColorDialogTitle( tr( "Select grid frame color" ) );
8586
mGridFramePenColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
87+
mGridFramePenColorButton->setContext( "composer" );
88+
mGridFramePenColorButton->setNoColorString( tr( "Transparent frame" ) );
89+
mGridFramePenColorButton->setShowNoColor( true );
90+
8691
mGridFrameFill1ColorButton->setColorDialogTitle( tr( "Select grid frame fill color" ) );
8792
mGridFrameFill1ColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
93+
mGridFrameFill1ColorButton->setContext( "composer" );
94+
mGridFrameFill1ColorButton->setNoColorString( tr( "Transparent fill" ) );
95+
mGridFrameFill1ColorButton->setShowNoColor( true );
96+
8897
mGridFrameFill2ColorButton->setColorDialogTitle( tr( "Select grid frame fill color" ) );
8998
mGridFrameFill2ColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
99+
mGridFrameFill2ColorButton->setContext( "composer" );
100+
mGridFrameFill2ColorButton->setNoColorString( tr( "Transparent fill" ) );
101+
mGridFrameFill2ColorButton->setShowNoColor( true );
90102

91103
//set initial state of frame style controls
92104
toggleFrameControls( false );

‎src/app/composer/qgscomposerscalebarwidget.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,25 @@ QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scale
5555

5656
mFillColorButton->setColorDialogTitle( tr( "Select fill color" ) );
5757
mFillColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
58+
mFillColorButton->setContext( "composer" );
59+
mFillColorButton->setNoColorString( tr( "Transparent fill" ) );
60+
mFillColorButton->setShowNoColor( true );
61+
5862
mFillColor2Button->setColorDialogTitle( tr( "Select alternate fill color" ) );
5963
mFillColor2Button->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
64+
mFillColor2Button->setContext( "composer" );
65+
mFillColor2Button->setNoColorString( tr( "Transparent fill" ) );
66+
mFillColor2Button->setShowNoColor( true );
67+
6068
mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
6169
mFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
70+
mFontColorButton->setContext( "composer" );
71+
6272
mStrokeColorButton->setColorDialogTitle( tr( "Select stroke color" ) );
6373
mStrokeColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
74+
mStrokeColorButton->setContext( "composer" );
75+
mStrokeColorButton->setNoColorString( tr( "Transparent stroke" ) );
76+
mStrokeColorButton->setShowNoColor( true );
6477

6578
blockMemberSignals( false );
6679
setGuiElements(); //set the GUI elements to the state of scaleBar

‎src/app/composer/qgscomposertablewidget.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ QgsComposerTableWidget::QgsComposerTableWidget( QgsComposerAttributeTable* table
4242

4343
mHeaderFontColorButton->setColorDialogTitle( tr( "Select header font color" ) );
4444
mHeaderFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
45+
mHeaderFontColorButton->setContext( "composer" );
4546
mContentFontColorButton->setColorDialogTitle( tr( "Select content font color" ) );
4647
mContentFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
48+
mContentFontColorButton->setContext( "composer" );
4749
mGridColorButton->setColorDialogTitle( tr( "Select grid color" ) );
4850
mGridColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
51+
mGridColorButton->setContext( "composer" );
4952

5053
updateGuiElements();
5154
on_mComposerMapComboBox_activated( mComposerMapComboBox->currentIndex() );

‎src/gui/qgscolorswatchgrid.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ QgsColorSwatchGrid::QgsColorSwatchGrid( QgsColorScheme* scheme, QString context,
3838
, mCurrentHoverBox( -1 )
3939
, mFocused( false )
4040
, mCurrentFocusBox( 0 )
41+
, mPressedOnWidget( false )
4142
{
4243
//need to receive all mouse over events
4344
setMouseTracking( true );
@@ -143,10 +144,16 @@ void QgsColorSwatchGrid::mousePressEvent( QMouseEvent *event )
143144
mDrawBoxDepressed = true;
144145
repaint();
145146
}
147+
mPressedOnWidget = true;
146148
}
147149

148150
void QgsColorSwatchGrid::mouseReleaseEvent( QMouseEvent *event )
149151
{
152+
if ( ! mPressedOnWidget )
153+
{
154+
return;
155+
}
156+
150157
int box = swatchForPosition( event->pos() );
151158
if ( mDrawBoxDepressed && event->button() == Qt::LeftButton )
152159
{
@@ -158,7 +165,7 @@ void QgsColorSwatchGrid::mouseReleaseEvent( QMouseEvent *event )
158165
if ( box >= 0 && box < mColors.length() && event->button() == Qt::LeftButton )
159166
{
160167
//color clicked
161-
emit colorChanged( mColors.at( mCurrentHoverBox ).first );
168+
emit colorChanged( mColors.at( box ).first );
162169
}
163170
}
164171

‎src/gui/qgscolorswatchgrid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class GUI_EXPORT QgsColorSwatchGrid: public QWidget
113113

114114
int mWidth;
115115

116+
bool mPressedOnWidget;
117+
116118
/**Calculate height of widget based on number of colors
117119
* @returns required height of widget in pixels
118120
*/

0 commit comments

Comments
 (0)
Please sign in to comment.