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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Nov 14 16:33:34 EST 2010


Author: timlinux
Date: 2010-11-14 13:33:34 -0800 (Sun, 14 Nov 2010)
New Revision: 14659

Modified:
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgslabelinggui.cpp
   trunk/qgis/src/app/qgslabelinggui.h
   trunk/qgis/src/ui/qgslabelingguibase.ui
Log:
Added apply button for label dialog for the lazy

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2010-11-14 21:33:26 UTC (rev 14658)
+++ trunk/qgis/src/app/qgisapp.cpp	2010-11-14 21:33:34 UTC (rev 14659)
@@ -3893,7 +3893,7 @@
   }
   QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>( layer );
 
-  QgsLabelingGui labelGui( mLBL, vlayer, this );
+  QgsLabelingGui labelGui( mLBL, vlayer, mMapCanvas, this );
 
   if ( labelGui.exec() )
   {

Modified: trunk/qgis/src/app/qgslabelinggui.cpp
===================================================================
--- trunk/qgis/src/app/qgslabelinggui.cpp	2010-11-14 21:33:26 UTC (rev 14658)
+++ trunk/qgis/src/app/qgslabelinggui.cpp	2010-11-14 21:33:34 UTC (rev 14659)
@@ -17,6 +17,7 @@
 
 #include "qgslabelinggui.h"
 
+#include <qgsmapcanvas.h>
 #include <qgsvectorlayer.h>
 #include <qgsvectordataprovider.h>
 #include <qgsmaplayerregistry.h>
@@ -32,8 +33,8 @@
 
 
 
-QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QWidget* parent )
-    : QDialog( parent ), mLBL( lbl ), mLayer( layer )
+QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent )
+    : QDialog( parent ), mLBL( lbl ), mLayer( layer ), mMapCanvas( mapCanvas )
 {
   setupUi( this );
 
@@ -168,13 +169,26 @@
     radAroundCentroid, radPolygonHorizontal, radPolygonFree, radPolygonPerimeter // polygon
   };
   for ( unsigned int i = 0; i < sizeof( placementRadios ) / sizeof( QRadioButton* ); i++ )
+  {
     connect( placementRadios[i], SIGNAL( toggled( bool ) ), this, SLOT( updateOptions() ) );
+  }
+  connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
 }
 
 QgsLabelingGui::~QgsLabelingGui()
 {
 }
 
+void QgsLabelingGui::apply()
+{
+  layerSettings().writeToLayer( mLayer );
+  // trigger refresh
+  if ( mMapCanvas )
+  {
+    mMapCanvas->refresh();
+  }
+}
+
 QgsPalLayerSettings QgsLabelingGui::layerSettings()
 {
   QgsPalLayerSettings lyr;

Modified: trunk/qgis/src/app/qgslabelinggui.h
===================================================================
--- trunk/qgis/src/app/qgslabelinggui.h	2010-11-14 21:33:26 UTC (rev 14658)
+++ trunk/qgis/src/app/qgslabelinggui.h	2010-11-14 21:33:34 UTC (rev 14659)
@@ -22,6 +22,7 @@
 #include <ui_qgslabelingguibase.h>
 
 class QgsVectorLayer;
+class QgsMapCanvas;
 
 #include "qgspallabeling.h"
 
@@ -30,12 +31,13 @@
     Q_OBJECT
 
   public:
-    QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QWidget* parent );
+    QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent );
     ~QgsLabelingGui();
 
     QgsPalLayerSettings layerSettings();
 
   public slots:
+    void apply();
     void changeTextColor();
     void changeTextFont();
     void showEngineConfigDialog();
@@ -62,6 +64,7 @@
   private:
     QgsPalLabeling* mLBL;
     QgsVectorLayer* mLayer;
+    QgsMapCanvas* mMapCanvas;
 
     void disableDataDefinedAlignment();
     void enableDataDefinedAlignment();

Modified: trunk/qgis/src/ui/qgslabelingguibase.ui
===================================================================
--- trunk/qgis/src/ui/qgslabelingguibase.ui	2010-11-14 21:33:26 UTC (rev 14658)
+++ trunk/qgis/src/ui/qgslabelingguibase.ui	2010-11-14 21:33:34 UTC (rev 14659)
@@ -1017,7 +1017,7 @@
       <enum>Qt::Horizontal</enum>
      </property>
      <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+      <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
      </property>
     </widget>
    </item>



More information about the QGIS-commit mailing list