Skip to content

Commit 6b4ee2d

Browse files
author
timlinux
committedNov 14, 2010
Added apply button for label dialog for the lazy
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14659 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3893,7 +3893,7 @@ void QgisApp::labeling()
38933893
}
38943894
QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>( layer );
38953895

3896-
QgsLabelingGui labelGui( mLBL, vlayer, this );
3896+
QgsLabelingGui labelGui( mLBL, vlayer, mMapCanvas, this );
38973897

38983898
if ( labelGui.exec() )
38993899
{

‎src/app/qgslabelinggui.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "qgslabelinggui.h"
1919

20+
#include <qgsmapcanvas.h>
2021
#include <qgsvectorlayer.h>
2122
#include <qgsvectordataprovider.h>
2223
#include <qgsmaplayerregistry.h>
@@ -32,8 +33,8 @@
3233

3334

3435

35-
QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QWidget* parent )
36-
: QDialog( parent ), mLBL( lbl ), mLayer( layer )
36+
QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent )
37+
: QDialog( parent ), mLBL( lbl ), mLayer( layer ), mMapCanvas( mapCanvas )
3738
{
3839
setupUi( this );
3940

@@ -168,13 +169,26 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QWid
168169
radAroundCentroid, radPolygonHorizontal, radPolygonFree, radPolygonPerimeter // polygon
169170
};
170171
for ( unsigned int i = 0; i < sizeof( placementRadios ) / sizeof( QRadioButton* ); i++ )
172+
{
171173
connect( placementRadios[i], SIGNAL( toggled( bool ) ), this, SLOT( updateOptions() ) );
174+
}
175+
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
172176
}
173177

174178
QgsLabelingGui::~QgsLabelingGui()
175179
{
176180
}
177181

182+
void QgsLabelingGui::apply()
183+
{
184+
layerSettings().writeToLayer( mLayer );
185+
// trigger refresh
186+
if ( mMapCanvas )
187+
{
188+
mMapCanvas->refresh();
189+
}
190+
}
191+
178192
QgsPalLayerSettings QgsLabelingGui::layerSettings()
179193
{
180194
QgsPalLayerSettings lyr;

‎src/app/qgslabelinggui.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <ui_qgslabelingguibase.h>
2323

2424
class QgsVectorLayer;
25+
class QgsMapCanvas;
2526

2627
#include "qgspallabeling.h"
2728

@@ -30,12 +31,13 @@ class QgsLabelingGui : public QDialog, private Ui::QgsLabelingGuiBase
3031
Q_OBJECT
3132

3233
public:
33-
QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QWidget* parent );
34+
QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent );
3435
~QgsLabelingGui();
3536

3637
QgsPalLayerSettings layerSettings();
3738

3839
public slots:
40+
void apply();
3941
void changeTextColor();
4042
void changeTextFont();
4143
void showEngineConfigDialog();
@@ -62,6 +64,7 @@ class QgsLabelingGui : public QDialog, private Ui::QgsLabelingGuiBase
6264
private:
6365
QgsPalLabeling* mLBL;
6466
QgsVectorLayer* mLayer;
67+
QgsMapCanvas* mMapCanvas;
6568

6669
void disableDataDefinedAlignment();
6770
void enableDataDefinedAlignment();

‎src/ui/qgslabelingguibase.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@
10171017
<enum>Qt::Horizontal</enum>
10181018
</property>
10191019
<property name="standardButtons">
1020-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
1020+
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
10211021
</property>
10221022
</widget>
10231023
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.