[QGIS-trac] Re: [Quantum GIS] #1162: missing possibility to use QML Style for more than one layer

Quantum GIS qgis at qgis.org
Mon Sep 1 23:07:42 EDT 2008


#1162: missing possibility to use QML Style for more than one layer
--------------------------------------------------------------+-------------
        Reporter:  bjpfei                                     |         Owner:  nobody       
            Type:  bug                                        |        Status:  new          
        Priority:  critical: causes crash or data corruption  |     Milestone:  Version 1.0.0
       Component:  Symbology                                  |       Version:  HEAD         
      Resolution:                                             |      Keywords:               
Platform_version:                                             |      Platform:  All          
        Must_fix:  Yes                                        |   Status_info:  1            
--------------------------------------------------------------+-------------
Comment (by ollie):

 Replying to [comment:3 hdus]:
 > Replying to [comment:2 timlinux]:
 > > Can you confirm if this bug is still an issue using svn trunk? For me
 it works fine in svn trunk.
 > >
 > > Regarding the field number instead of field name issue, you should
 file a separate bug for that since its a 'feature' of how layer properties
 are serialised - qml files make use of the standard QGIS serialisation
 routines to do their thing.
 > >
 > > Regards
 > >
 > > Tim
 >
 > The fix looks to be half done.
 >
 > 1. Load a polygon layer with community borders. [[BR]]
 > 2. Create and save a unique values style QML based on community
 names.[[BR]]
 > 3. Load an other layer containing an attribute community names. [[BR]]
 > 4. Load the prior defined QML to the new layer. [[BR]]
 > 5. The legend name of the new layer is changed to the name of the first
 layer. [[BR]]
 > 6. Classification in map canvas is performed correctly but the legend is
 not updated.[[BR]]
 > 7. Toggle the visibility of the new layer off and on, the layer
 disappears from map canvas.[[BR]]
 >
 > What could be a way to handle this issue? Perhaps a solution could be as
 follows:
 >
 > When I load a QML Style to a layer QGIS have to check whether this QML
 is associated to the layer or not. This information is known from the
 connection parameters. If the layer is not associated don't change the
 layer name and ask the user to choose an appropriate attribute of the
 given attributes. The user is responsible for the correctness of the
 choosen attribute. Maybe this could be an appropriate approach?

 Just to add a "Me too", I can confirm that this is indeed the case -
 applying a QML style file to a different layer does now work - but as soon
 as the layer (or any other layer) is toggled off/on, all the layers using
 QML style files that weren't originally created for them disappear from
 the canvas, apparently permanently.

 In point 5, I think the reason for this is that the display name (for the
 legend) defaults to the layer name and this gets saved down with the QML
 style file creation - so gets reapplied to a different layer. This feels
 to me like "functioning as intended" - I would actually want the layer
 name to be picked up from the QML, for my legend.

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1162#comment:4>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list