Skip to content

Commit

Permalink
apply #2824 from Florian Hof
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13856 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 30, 2010
1 parent 4a98036 commit 0b98873
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Diego Moreira
Faunalia (http://www.faunalia.it)
Fernando Pacheco
Florian El Ahdab
Florian Hof
Frank Warmerdam
Germán Carrillo
Giuseppe Sucameli
Expand Down
36 changes: 17 additions & 19 deletions src/app/qgslabeldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,13 @@ void QgsLabelDialog::changeFont( void )
#else
mFont = QFontDialog::getFont( &resultFlag, mFont, this );
#endif
if ( resultFlag )
{
if ( mFont.pointSizeF() != fontSize )
{
// font is set to the font the user selected
spinFontSize->setValue( mFont.pointSizeF() );
}
}
else
if ( !resultFlag )
return;

if ( mFont.pointSizeF() != fontSize )
{
// the user cancelled the dialog; font is set to the initial
// value, in this case Helvetica [Cronyx], 10
// font is set to the font the user selected
spinFontSize->setValue( mFont.pointSizeF() );
}
lblSample->setFont( mFont );
}
Expand All @@ -307,7 +302,11 @@ void QgsLabelDialog::changeFontColor( void )
{
QgsDebugMsg( "entering." );

mFontColor = QColorDialog::getColor( mFontColor );
QColor color = QColorDialog::getColor( mFontColor );
if ( !color.isValid() )
return;

mFontColor = color;
QPalette palette = lblSample->palette();
palette.setColor( lblSample->foregroundRole(), mFontColor );
lblSample->setPalette( palette );
Expand All @@ -317,7 +316,11 @@ void QgsLabelDialog::changeBufferColor( void )
{
QgsDebugMsg( "entering." );

mBufferColor = QColorDialog::getColor( mBufferColor );
QColor color = QColorDialog::getColor( mBufferColor );
if ( !color.isValid() )
return;

mBufferColor = color;
QPalette palette = lblSample->palette();
palette.setColor( lblSample->backgroundRole(), mBufferColor );
lblSample->setPalette( palette );
Expand All @@ -326,13 +329,8 @@ void QgsLabelDialog::changeBufferColor( void )

int QgsLabelDialog::itemNoForField( QString theFieldName, QStringList theFieldList )
{
int myItemInt = 0; for ( QStringList::Iterator it = theFieldList.begin(); it != theFieldList.end(); ++it )
{
if ( theFieldName == *it ) return myItemInt;
++myItemInt;
}
//if no matches assume first item in list is blank and return that
return 0;
return std::max( 0, theFieldList.indexOf( theFieldName ) );
}

QgsLabelDialog::~QgsLabelDialog()
Expand Down

0 comments on commit 0b98873

Please sign in to comment.