Skip to content

Commit bfe2f9f

Browse files
Emilio Loijef-n
Emilio Loi
authored andcommittedMay 9, 2013
[FEATURE] Load and Save SLD & QML styles to DB
Replaced last occurence of "on database" with "in database" Solved an issue loading the default style adding a layer Work done for ARPA Piemonte - Dipartimento Tematico Geologia e Dissesto
1 parent 6c51965 commit bfe2f9f

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed
 

‎src/core/qgsvectorlayer.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -3816,6 +3816,10 @@ void QgsVectorLayer::saveStyleToDatabase( QString name, QString description,
38163816

38173817

38183818

3819+
QString QgsVectorLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
3820+
{
3821+
return loadNamedStyle( theURI, theResultFlag, false );
3822+
}
38193823

38203824
QString QgsVectorLayer::loadNamedStyle( const QString theURI, bool &theResultFlag , bool loadFromLocalDB )
38213825
{

‎src/core/qgsvectorlayer.h

+21-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <QSet>
2323
#include <QList>
2424
#include <QStringList>
25+
#include <QVector>
2526

2627
#include "qgis.h"
2728
#include "qgsmaplayer.h"
@@ -712,16 +713,29 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
712713
* @param msgError
713714
* @return the number of styles related to current layer
714715
*/
715-
virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
716-
QStringList &descriptions, QString &msgError );
716+
virtual int listStylesInDatabase( QVector<QString> &ids, QVector<QString> &names,
717+
QVector<QString> &descriptions, QString &msgError );
717718

718719
/**
719720
* Will return the named style corresponding to style id provided
720721
*/
721722
virtual QString getStyleFromDatabase( QString styleId, QString &msgError );
722723

723-
virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag, bool loadFromLocalDb = false );
724-
virtual bool applyNamedStyle( QString namedStyle , QString errorMsg );
724+
/**
725+
* Load a named style from file/local db/datasource db
726+
* @param theURI the URI of the style or the URI of the layer
727+
* @param theResultFlag will be set to true if a named style is correctly loaded
728+
* @param loadFromLocalDb if true forces to load from local db instead of datasource one
729+
*/
730+
virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag, bool loadFromLocalDb );
731+
732+
/**
733+
* Calls loadNamedStyle( theURI, theResultFlag, false );
734+
* Retained for backward compatibility
735+
*/
736+
virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag );
737+
738+
virtual bool applyNamedStyle(QString namedStyle , QString errorMsg);
725739

726740
/** convert a saved attribute editor element into a AttributeEditor structure as it's used internally.
727741
* @param elem the DOM element
@@ -1267,15 +1281,15 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
12671281
signals:
12681282

12691283
/**
1270-
* This signal is emitted when selection was changed
1284+
* This signal is emited when selection was changed
12711285
*
12721286
* @param selected Newly selected feature ids
12731287
* @param deselected Ids of all features which have previously been selected but are not any more
12741288
* @param clearAndSelect In case this is set to true, the old selection was dismissed and the new selection corresponds to selected
12751289
*/
12761290
void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect );
12771291

1278-
/** This signal is emitted when selection was changed */
1292+
/** This signal is emited when selection was changed */
12791293
void selectionChanged();
12801294

12811295
/** This signal is emitted when modifications has been done on layer */
@@ -1284,7 +1298,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
12841298
/** Is emitted, when editing on this layer has started*/
12851299
void editingStarted();
12861300

1287-
/** Is emitted, when edited changes successfully have been written to the data provider */
1301+
/** Is emitted, when edited changes succesfully have been written to the data provider */
12881302
void editingStopped();
12891303

12901304
/** Is emitted, before changes are commited to the data provider */

‎src/ui/qgssavetodbdialog.ui

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>355</width>
10-
<height>235</height>
10+
<height>246</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -94,7 +94,7 @@
9494
<item row="2" column="0" rowspan="2" colspan="2">
9595
<widget class="QLabel" name="label">
9696
<property name="text">
97-
<string>Optionally pick an input form for attribute editing (QT Creator UI format), it will be stored on the db</string>
97+
<string>Optionally pick an input form for attribute editing (QT Creator UI format), it will be stored in the db</string>
9898
</property>
9999
<property name="textFormat">
100100
<enum>Qt::PlainText</enum>

0 commit comments

Comments
 (0)
Please sign in to comment.