I just upgraded to Qgis 2.4 and there were problems with style file:

  • When I load style file for Qgis <= 2.2, the color of features is right but when I edit them, the value map (value - description pair) is lost.
  • The value map I created for layers in Qgis 2.4 is not kept in .qml style file when I choose 'save style' as 'Qgis layer style file'.

Is this a bug in Qgis 2.4?


Sample files: http://www.mediafire.com/download/bbk02sj3jl9iwtc/test_data.7z

For line layer line.shp with 3 attributes: id, name, type - I have style file 2_2_line_style.qml generated from Qgis 2.2 which have following lines:

    <edittype labelontop="0" editable="0" type="0" name="id"/>
    <edittype labelontop="0" editable="1" type="0" name="name"/>
    <edittype labelontop="0" editable="1" type="3" name="type">
      <valuepair key="first type" value="1"/>
      <valuepair key="second type" value="2"/>
      <valuepair key="third type" value="3"/>

In Qgis 2.2, when I load that line layer with that style and add more lines, there will be a pop up window that allows me to enter values with a drop down list:

enter image description here

But in Qgis 2.4, when I load the same layer with the style file and add (create new) features, the drop down list is gone:

enter image description here

More over, in Qgis 2.4, when I set the value map for that line layer manually, I can get the drop down list but when I save the style as .qml and inspect the file, there isn't any key - value line like the 2.2 style file.

enter image description here

2 Answers 2


My apologies for the off-the-record answer. For me it seems you have found a bug :-)

I can reproduce your problem and did not find a solution/explanation for it...

enter image description here


Strange, but I don't think it's a bug. In QGIS 2.4 I loaded a vector layer, applied a style by loading a .qml saved in QGIS 2.2, and there were no issues. I made a small change in the value map, saved it as a new .qml and loading it again went smoothly.

If you mention '... when I edit them', do you mean you select another color range from the dropdown menu? Because that's perfectly possible without losing your value-description settings. Just don't click 'Classify' because that will mess up your value map according to the classification mode you selected. But I guess you know all that...

Opening a .qml file in Notepad, you normally should see your value map at the top. Something like:

  <range symbol="0" lower="0.000000" upper="12000.000000" label="No data"/>
  <range symbol="1" lower="12000.000000" upper="16000.000000" label="12000 - 16000"/>
  <range symbol="2" lower="16000.000000" upper="21000.000000" label="16000 - 21000"/>
  <range symbol="3" lower="21000.000000" upper="25000.000000" label="21000 - 25000"/>
  <range symbol="4" lower="25000.000000" upper="29000.000000" label="25000 - 29000"/>

After your comment, this will probably help you further.

IF I understand what you're doing, you try to edit the values map under the Fields tab, and there you find a column called 'Edit Widget'.

enter image description here

I did not dig out that functionality yet, but assuming you just want to apply a style on a vector layer (nice colors and dito labels), open the Properties window of the vector layer you like to apply a style on, and do as follows.

  • If you already have a .qml file, you can load it through 'Load Style ...' (A).
  • Check out that the name of the attribute/field (stored in the .qml file) corresponds with an existing attribute in the table of your vector layer. If not, just select from the dropdown menu the column/field/attribute you like to show in your map with your style (B). In the .qml file, you can find the attribute's name in the 3th line:

    <renderer-v2 attr="FIELD_OF_INTEREST" symbollevels="1" type="graduatedSymbol">
  • If you're still happy with the style you loaded, fine! If not, edit the number of classes, choose a color ramp and a classification mode. If you're not satisfied with the lower and upper values of the generated classes, double-click in the area depicted with the red rectangle (C).

  • A small window opens allowing you to adapt the lower and upper values to your wishes (D).
  • Finally, you can edit the description of your classes (E). In this example you see the value map of a numerical field, but in case of, for example, a land use map, your value can be an integer code and the description the name of the corresponding land use.
  • Click 'OK' to apply the configured style (maybe you can save your style first with 'Save Style').

enter image description here

enter image description here

All done, you'll notice that the applied changes (color and value map) will appear as a legend.

enter image description here

  • when opening the qml in notepad, I see the value map, but when loading into qgis the edit widget under the fields tab remains unchanged.
    – user25976
    Commented Jul 11, 2014 at 23:46
  • Reading your comment, and more exactly the anchor points 'fields tab' and 'edit widget', I think I know what your problem is. I'll edit my answer.
    – kadéem
    Commented Jul 14, 2014 at 14:16

I managed to retrieve the value map by saving the QGIS layer stack file (*.qml). When I reloaded the vector layer, I simply load the qml file and voila... value map appears... No problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.