[QGIS Commit] r11061 - in trunk/qgis/src: app ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Jul 13 16:23:55 EDT 2009


Author: jef
Date: 2009-07-13 16:23:55 -0400 (Mon, 13 Jul 2009)
New Revision: 11061

Modified:
   trunk/qgis/src/app/qgslabeldialog.cpp
   trunk/qgis/src/app/qgslabeldialog.h
   trunk/qgis/src/ui/qgslabeldialogbase.ui
Log:
implement #1769

Modified: trunk/qgis/src/app/qgslabeldialog.cpp
===================================================================
--- trunk/qgis/src/app/qgslabeldialog.cpp	2009-07-13 19:52:03 UTC (rev 11060)
+++ trunk/qgis/src/app/qgslabeldialog.cpp	2009-07-13 20:23:55 UTC (rev 11061)
@@ -152,7 +152,7 @@
   mFont.setFamily( myLabelAttributes->family() );
   if ( myLabelAttributes->sizeIsSet() )
   {
-    mFont.setPointSize( static_cast<int>( myLabelAttributes->size() ) );
+    mFont.setPointSizeF( myLabelAttributes->size() );
 
     int myTypeInt = myLabelAttributes->sizeType();
     if ( myTypeInt == QgsLabelAttributes::PointUnits )
@@ -166,10 +166,12 @@
   }
   else //defaults for when no size has been set
   {
-    mFont.setPointSize( static_cast<int>( myLabelAttributes->size() ) );
+    mFont.setPointSizeF( myLabelAttributes->size() );
     radioFontSizeUnitsPoints->setChecked( true );
   }
 
+  spinFontSize->setValue( myLabelAttributes->size() );
+
   if ( myLabelAttributes->boldIsSet() )
   {
     mFont.setBold( myLabelAttributes->bold() );
@@ -200,8 +202,8 @@
     {
       radioOffsetUnitsMap->setChecked( true );
     }
-    spinXOffset->setValue( static_cast<int>( myLabelAttributes->xOffset() ) );
-    spinYOffset->setValue( static_cast<int>( myLabelAttributes->yOffset() ) );
+    spinXOffset->setValue( myLabelAttributes->xOffset() );
+    spinYOffset->setValue( myLabelAttributes->yOffset() );
   }
   else //defaults for when no offset is defined
   {
@@ -247,7 +249,7 @@
     {
       radioBufferUnitsMap->setChecked( true );
     }
-    spinBufferSize->setValue( static_cast<int>( myLabelAttributes->bufferSize() ) );
+    spinBufferSize->setValue( myLabelAttributes->bufferSize() );
   }
   else //defaults for when no offset is defined
   {
@@ -259,7 +261,7 @@
   chkUseBuffer->setChecked( myLabelAttributes->bufferEnabled() );
 
   //NOTE: do we need this line too? TS
-  spinBufferSize->setValue( static_cast<int>( myLabelAttributes->bufferSize() ) );
+  spinBufferSize->setValue( myLabelAttributes->bufferSize() );
   //TODO - transparency attributes for buffers
 
   listWidget->setItemSelected( listWidget->item( 0 ), true );
@@ -271,11 +273,16 @@
 {
   QgsDebugMsg( "entering." );
 
+  qreal fontSize = mFont.pointSizeF();
   bool resultFlag;
   mFont = QFontDialog::getFont( &resultFlag, mFont, this );
   if ( resultFlag )
   {
-    // font is set to the font the user selected
+    if ( mFont.pointSizeF() != fontSize )
+    {
+      // font is set to the font the user selected
+      spinFontSize->setValue( mFont.pointSizeF() );
+    }
   }
   else
   {
@@ -341,7 +348,7 @@
   {
     myTypeInt = QgsLabelAttributes::MapUnits;
   }
-  myLabelAttributes->setSize( mFont.pointSize(), myTypeInt );
+  myLabelAttributes->setSize( mFont.pointSizeF(), myTypeInt );
   myLabelAttributes->setBold( mFont.bold() );
   myLabelAttributes->setItalic( mFont.italic() );
   myLabelAttributes->setUnderline( mFont.underline() );

Modified: trunk/qgis/src/app/qgslabeldialog.h
===================================================================
--- trunk/qgis/src/app/qgslabeldialog.h	2009-07-13 19:52:03 UTC (rev 11060)
+++ trunk/qgis/src/app/qgslabeldialog.h	2009-07-13 20:23:55 UTC (rev 11061)
@@ -74,8 +74,10 @@
 
     void on_cboLabelField_activated( int ) {emit labelSourceSet(); }
 
+    void on_spinFontSize_valueChanged( double d ) { mFont.setPointSizeF( d ); lblSample->setFont( mFont ); }
+
   signals:
-    /* emitted when anitem in label source list is chosen */
+    /* emitted when an item in label source list is chosen */
     void labelSourceSet();
 
   protected:

Modified: trunk/qgis/src/ui/qgslabeldialogbase.ui
===================================================================
--- trunk/qgis/src/ui/qgslabeldialogbase.ui	2009-07-13 19:52:03 UTC (rev 11060)
+++ trunk/qgis/src/ui/qgslabeldialogbase.ui	2009-07-13 20:23:55 UTC (rev 11061)
@@ -180,11 +180,8 @@
          </item>
          <item row="0" column="1" >
           <widget class="QLabel" name="textLabel5_2_2_3_2" >
-           <property name="enabled" >
-            <bool>false</bool>
-           </property>
            <property name="text" >
-            <string>Font transparency</string>
+            <string>Font size</string>
            </property>
            <property name="alignment" >
             <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@@ -192,10 +189,7 @@
           </widget>
          </item>
          <item row="0" column="2" >
-          <widget class="QSpinBox" name="spinFontTransparency" >
-           <property name="enabled" >
-            <bool>false</bool>
-           </property>
+          <widget class="QDoubleSpinBox" name="spinFontSize" >
            <property name="sizePolicy" >
             <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
              <horstretch>0</horstretch>
@@ -208,12 +202,6 @@
              <height>0</height>
             </size>
            </property>
-           <property name="suffix" >
-            <string>%</string>
-           </property>
-           <property name="maximum" >
-            <number>100</number>
-           </property>
            <property name="value" >
             <number>0</number>
            </property>
@@ -469,7 +457,7 @@
         </widget>
        </item>
        <item row="1" column="1" >
-        <widget class="QSpinBox" name="spinBufferSize" />
+        <widget class="QDoubleSpinBox" name="spinBufferSize" />
        </item>
        <item row="2" column="0" >
         <widget class="QLabel" name="textLabel5_2_2_3" >
@@ -575,7 +563,7 @@
         </widget>
        </item>
        <item row="0" column="1" >
-        <widget class="QSpinBox" name="spinXOffset" >
+        <widget class="QDoubleSpinBox" name="spinXOffset" >
          <property name="minimum" >
           <number>-99</number>
          </property>
@@ -589,7 +577,7 @@
         </widget>
        </item>
        <item row="1" column="1" >
-        <widget class="QSpinBox" name="spinYOffset" >
+        <widget class="QDoubleSpinBox" name="spinYOffset" >
          <property name="minimum" >
           <number>-99</number>
          </property>
@@ -1055,7 +1043,7 @@
   <tabstop>leDefaultLabel</tabstop>
   <tabstop>btnDefaultFont</tabstop>
   <tabstop>pbnDefaultFontColor</tabstop>
-  <tabstop>spinFontTransparency</tabstop>
+  <tabstop>spinFontSize</tabstop>
   <tabstop>radioFontSizeUnitsPoints</tabstop>
   <tabstop>radioFontSizeUnitsMap</tabstop>
   <tabstop>spinAngle</tabstop>



More information about the QGIS-commit mailing list