Skip to content
Permalink
Browse files

[composer] Flip all color buttons to QgsColorButtonV2

  • Loading branch information
nyalldawson committed Aug 11, 2014
1 parent 856341d commit d8f21201ab4d25a0efa2b4f076723dfe0cc6427b
@@ -41,6 +41,17 @@ QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsCo
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, mArrow );
mainLayout->addWidget( itemPropertiesWidget );

mArrowHeadOutlineColorButton->setColorDialogTitle( tr( "Select arrow head outline color" ) );
mArrowHeadOutlineColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mArrowHeadOutlineColorButton->setContext( "composer" );
mArrowHeadOutlineColorButton->setNoColorString( tr( "Transparent outline" ) );
mArrowHeadOutlineColorButton->setShowNoColor( true );
mArrowHeadFillColorButton->setColorDialogTitle( tr( "Select arrow head fill color" ) );
mArrowHeadFillColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mArrowHeadFillColorButton->setContext( "composer" );
mArrowHeadFillColorButton->setNoColorString( tr( "Transparent fill" ) );
mArrowHeadFillColorButton->setShowNoColor( true );

setGuiElementValues();

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

blockAllSignals( true );
mArrowHeadFillColorButton->setColor( mArrow->arrowHeadFillColor() );
mArrowHeadFillColorButton->setColorDialogTitle( tr( "Select arrow head fill color" ) );
mArrowHeadFillColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mArrowHeadOutlineColorButton->setColor( mArrow->arrowHeadOutlineColor() );
mArrowHeadOutlineColorButton->setColorDialogTitle( tr( "Select arrow head outline color" ) );
mArrowHeadOutlineColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mOutlineWidthSpinBox->setValue( mArrow->arrowHeadOutlineWidth() );
mArrowHeadWidthSpinBox->setValue( mArrow->arrowHeadWidth() );

@@ -623,8 +623,10 @@ void QgsComposerItemWidget::setValuesForGuiElements()

mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mBackgroundColorButton->setContext( "composer" );
mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) );
mFrameColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mFrameColorButton->setContext( "composer" );

setValuesForGuiPositionElements();
setValuesForGuiNonPositionElements();
@@ -33,6 +33,8 @@ QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QgsCo
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
mainLayout->addWidget( itemPropertiesWidget );

mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
mFontColorButton->setContext( "composer" );

if ( mComposerLabel )
{
@@ -117,6 +117,9 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ): Q
mMoveDownToolButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyDown.png" ) ) );
mCountToolButton->setIcon( QIcon( QgsApplication::iconPath( "mActionSum.png" ) ) );

mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
mFontColorButton->setContext( "composer" );

//add widget for item properties
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, legend );
mainLayout->addWidget( itemPropertiesWidget );
@@ -70,6 +70,7 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo

mAnnotationFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
mAnnotationFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mAnnotationFontColorButton->setContext( "composer" );

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

mGridFramePenColorButton->setColorDialogTitle( tr( "Select grid frame color" ) );
mGridFramePenColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mGridFramePenColorButton->setContext( "composer" );
mGridFramePenColorButton->setNoColorString( tr( "Transparent frame" ) );
mGridFramePenColorButton->setShowNoColor( true );

mGridFrameFill1ColorButton->setColorDialogTitle( tr( "Select grid frame fill color" ) );
mGridFrameFill1ColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mGridFrameFill1ColorButton->setContext( "composer" );
mGridFrameFill1ColorButton->setNoColorString( tr( "Transparent fill" ) );
mGridFrameFill1ColorButton->setShowNoColor( true );

mGridFrameFill2ColorButton->setColorDialogTitle( tr( "Select grid frame fill color" ) );
mGridFrameFill2ColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mGridFrameFill2ColorButton->setContext( "composer" );
mGridFrameFill2ColorButton->setNoColorString( tr( "Transparent fill" ) );
mGridFrameFill2ColorButton->setShowNoColor( true );

//set initial state of frame style controls
toggleFrameControls( false );
@@ -55,12 +55,25 @@ QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scale

mFillColorButton->setColorDialogTitle( tr( "Select fill color" ) );
mFillColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mFillColorButton->setContext( "composer" );
mFillColorButton->setNoColorString( tr( "Transparent fill" ) );
mFillColorButton->setShowNoColor( true );

mFillColor2Button->setColorDialogTitle( tr( "Select alternate fill color" ) );
mFillColor2Button->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mFillColor2Button->setContext( "composer" );
mFillColor2Button->setNoColorString( tr( "Transparent fill" ) );
mFillColor2Button->setShowNoColor( true );

mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
mFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mFontColorButton->setContext( "composer" );

mStrokeColorButton->setColorDialogTitle( tr( "Select stroke color" ) );
mStrokeColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mStrokeColorButton->setContext( "composer" );
mStrokeColorButton->setNoColorString( tr( "Transparent stroke" ) );
mStrokeColorButton->setShowNoColor( true );

blockMemberSignals( false );
setGuiElements(); //set the GUI elements to the state of scaleBar
@@ -42,10 +42,13 @@ QgsComposerTableWidget::QgsComposerTableWidget( QgsComposerAttributeTable* table

mHeaderFontColorButton->setColorDialogTitle( tr( "Select header font color" ) );
mHeaderFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mHeaderFontColorButton->setContext( "composer" );
mContentFontColorButton->setColorDialogTitle( tr( "Select content font color" ) );
mContentFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mContentFontColorButton->setContext( "composer" );
mGridColorButton->setColorDialogTitle( tr( "Select grid color" ) );
mGridColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mGridColorButton->setContext( "composer" );

updateGuiElements();
on_mComposerMapComboBox_activated( mComposerMapComboBox->currentIndex() );
@@ -38,6 +38,7 @@ QgsColorSwatchGrid::QgsColorSwatchGrid( QgsColorScheme* scheme, QString context,
, mCurrentHoverBox( -1 )
, mFocused( false )
, mCurrentFocusBox( 0 )
, mPressedOnWidget( false )
{
//need to receive all mouse over events
setMouseTracking( true );
@@ -143,10 +144,16 @@ void QgsColorSwatchGrid::mousePressEvent( QMouseEvent *event )
mDrawBoxDepressed = true;
repaint();
}
mPressedOnWidget = true;
}

void QgsColorSwatchGrid::mouseReleaseEvent( QMouseEvent *event )
{
if ( ! mPressedOnWidget )
{
return;
}

int box = swatchForPosition( event->pos() );
if ( mDrawBoxDepressed && event->button() == Qt::LeftButton )
{
@@ -158,7 +165,7 @@ void QgsColorSwatchGrid::mouseReleaseEvent( QMouseEvent *event )
if ( box >= 0 && box < mColors.length() && event->button() == Qt::LeftButton )
{
//color clicked
emit colorChanged( mColors.at( mCurrentHoverBox ).first );
emit colorChanged( mColors.at( box ).first );
}
}

@@ -113,6 +113,8 @@ class GUI_EXPORT QgsColorSwatchGrid: public QWidget

int mWidth;

bool mPressedOnWidget;

/**Calculate height of widget based on number of colors
* @returns required height of widget in pixels
*/

0 comments on commit d8f2120

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