[QGIS Commit] r13856 - in trunk/qgis: . src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jun 30 14:48:22 EDT 2010


Author: jef
Date: 2010-06-30 18:48:22 +0000 (Wed, 30 Jun 2010)
New Revision: 13856

Modified:
   trunk/qgis/CONTRIBUTORS
   trunk/qgis/src/app/qgslabeldialog.cpp
Log:
apply #2824 from Florian Hof

Modified: trunk/qgis/CONTRIBUTORS
===================================================================
--- trunk/qgis/CONTRIBUTORS	2010-06-30 18:35:36 UTC (rev 13855)
+++ trunk/qgis/CONTRIBUTORS	2010-06-30 18:48:22 UTC (rev 13856)
@@ -18,6 +18,7 @@
 Faunalia (http://www.faunalia.it)
 Fernando Pacheco
 Florian El Ahdab
+Florian Hof
 Frank Warmerdam
 Germán Carrillo
 Giuseppe Sucameli

Modified: trunk/qgis/src/app/qgslabeldialog.cpp
===================================================================
--- trunk/qgis/src/app/qgslabeldialog.cpp	2010-06-30 18:35:36 UTC (rev 13855)
+++ trunk/qgis/src/app/qgslabeldialog.cpp	2010-06-30 18:48:22 UTC (rev 13856)
@@ -287,19 +287,14 @@
 #else
   mFont = QFontDialog::getFont( &resultFlag, mFont, this );
 #endif
-  if ( resultFlag )
+  if ( !resultFlag )
+    return;
+
+  if ( mFont.pointSizeF() != fontSize )
   {
-    if ( mFont.pointSizeF() != fontSize )
-    {
-      // font is set to the font the user selected
-      spinFontSize->setValue( mFont.pointSizeF() );
-    }
+    // font is set to the font the user selected
+    spinFontSize->setValue( mFont.pointSizeF() );
   }
-  else
-  {
-    // the user cancelled the dialog; font is set to the initial
-    // value, in this case Helvetica [Cronyx], 10
-  }
   lblSample->setFont( mFont );
 }
 
@@ -307,7 +302,11 @@
 {
   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 );
@@ -317,7 +316,11 @@
 {
   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 );
@@ -326,13 +329,8 @@
 
 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()



More information about the QGIS-commit mailing list