Bug report #13667

rule based labelling is not saved in qml style files

Added by Saber Razmjooei about 9 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:Sebastian Dietrich
Category:Labelling
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:21701

Description

Rule-based labeling information of a layer doesn't get saved when exporting the style.
To reproduce:
- Load a vector layer
- Set a lebel
- Save the style as qml
- Close the layer and re-open it
- Try to apply the saved qml

The label is always set to No labels for me. (2.12 cd9d645)


Related issues

Related to QGIS Application - Bug report #14441: Labeling settings not properly restored after save style ... Closed 2016-03-08

Associated revisions

Revision ab83b825
Added by Sebastian Dietrich almost 9 years ago

Refresh the label style widget when loading a new style (fixes #13667)
the QgsLabelingWidget is triggered to reload its settings when
- loading a style file
- loading a style from a database
- loading the default style

Revision 04caab24
Added by Nyall Dawson almost 9 years ago

Merge pull request #2542 from SebDieBln/RefreshStyleWidgetOnLoadStyle

Refresh the label style widget when loading a new style (fixes #13667)

History

#1 Updated by Saber Razmjooei about 9 years ago

  • Category set to Labelling
  • Target version set to Version 2.12

#2 Updated by Saber Razmjooei about 9 years ago

  • Subject changed from Rule-based labeling can't be saved with styles to Labeling can't be saved with styles (qml)

#3 Updated by Saber Razmjooei about 9 years ago

Seems to be related to the introduction of combo box for the new labeling.
If I do:

iface.activeLayer().loadNamedStyle('/path/to/my_style.qml')

And refresh my canvas the labels will be applied. But if I do it through load style...it doesn't work.

#4 Updated by Saber Razmjooei about 9 years ago

  • Subject changed from Labeling can't be saved with styles (qml) to Labeling is igonred when applying styles (qml)

#5 Updated by Steven Bernard about 9 years ago

I have a similar issue where old qml style files, which have rule-based labelling in, no longer work when I try to apply them in 2.12. As mentioned this is likely because of the new dropdown menu. Isn't there a simple way to map the old .qml rule-based label style to the rule-based labelling dropdown menu option in 2.12?

#6 Updated by Giovanni Manghi about 9 years ago

  • Subject changed from Labeling is igonred when applying styles (qml) to rule based labelling is not saved in qml style files
  • Target version deleted (Version 2.12)

#7 Updated by Harry Clarke almost 9 years ago

  • Target version set to Future Release - High Priority

Can this be fixed please as it is causing me problems, and workaround a lot of extra work

#8 Updated by Sebastian Dietrich almost 9 years ago

See PR 2542 for an early present from Santa Claus ;-)

workaround a lot of extra work

Also note the following easy workaround, in case the PR takes a while to be merged or you are not able/willing to update to the nightly build:
  • Open the layer properties dialog
  • Load the style
  • Cancel the dialog

=> The style is applied to the layer, but is not yet visible.

To actually see it refresh the canvas, e.g. using the Refresh tool or by simply panning/zooming.

#9 Updated by Sebastian Dietrich almost 9 years ago

  • Assignee set to Sebastian Dietrich
  • % Done changed from 0 to 100
  • Pull Request or Patch supplied changed from No to Yes

#10 Updated by Nyall Dawson almost 9 years ago

  • Status changed from Open to Closed

#11 Updated by R. R. over 8 years ago

  • Status changed from Closed to Reopened

Labeling information is still missing when loading a .qml file in QGIS 2.14.

#12 Updated by Sebastian Dietrich over 8 years ago

  • Status changed from Reopened to Feedback

I can not reproduce. Are you loading styles saved in an older version of QGIS?
Please attach a QML file that does not load correctly in 2.14.

#13 Updated by R. R. over 8 years ago

  • Status changed from Feedback to Closed

Please see bug report #14441 for further details.

Also available in: Atom PDF