Skip to content

Commit

Permalink
Added apply button for label dialog for the lazy
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14659 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Nov 14, 2010
1 parent 177a510 commit 6b4ee2d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -3893,7 +3893,7 @@ void QgisApp::labeling()
}
QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>( layer );

QgsLabelingGui labelGui( mLBL, vlayer, this );
QgsLabelingGui labelGui( mLBL, vlayer, mMapCanvas, this );

if ( labelGui.exec() )
{
Expand Down
18 changes: 16 additions & 2 deletions src/app/qgslabelinggui.cpp
Expand Up @@ -17,6 +17,7 @@

#include "qgslabelinggui.h"

#include <qgsmapcanvas.h>
#include <qgsvectorlayer.h>
#include <qgsvectordataprovider.h>
#include <qgsmaplayerregistry.h>
Expand All @@ -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 );

Expand Down Expand Up @@ -168,13 +169,26 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QWid
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;
Expand Down
5 changes: 4 additions & 1 deletion src/app/qgslabelinggui.h
Expand Up @@ -22,6 +22,7 @@
#include <ui_qgslabelingguibase.h>

class QgsVectorLayer;
class QgsMapCanvas;

#include "qgspallabeling.h"

Expand All @@ -30,12 +31,13 @@ class QgsLabelingGui : public QDialog, private Ui::QgsLabelingGuiBase
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();
Expand All @@ -62,6 +64,7 @@ class QgsLabelingGui : public QDialog, private Ui::QgsLabelingGuiBase
private:
QgsPalLabeling* mLBL;
QgsVectorLayer* mLayer;
QgsMapCanvas* mMapCanvas;

void disableDataDefinedAlignment();
void enableDataDefinedAlignment();
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgslabelingguibase.ui
Expand Up @@ -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>
Expand Down

0 comments on commit 6b4ee2d

Please sign in to comment.