[QGIS-trac] [Quantum GIS] #1117: Reload SVG Symbology Directory

Quantum GIS qgis at qgis.org
Thu May 29 06:01:45 EDT 2008


#1117: Reload SVG Symbology Directory
-----------------------------------------------+----------------------------
   Reporter:  otternase                        |              Owner:  nobody       
       Type:  enhancement                      |             Status:  new          
   Priority:  minor: annoyance or enhancement  |          Milestone:  Version 0.9.1
  Component:  Build/Install                    |            Version:  HEAD         
   Keywords:  QgsMarkerCatalogue Update        |   Platform_version:               
   Platform:  Linux                            |           Must_fix:  No           
Status_info:  0                                |  
-----------------------------------------------+----------------------------
 Environment: qgis 0.9.1 Ubuntu 7.10

 Problem:

 Qgis is loading the catalogue of available SVGs for symbology only on
 startup, so if after starting Qgis a new SVG is created or a SVG is
 deleted, the catalogue is not updated accordingly and the new SVG is not
 available in the Symbologydialog. As my plugin is creating new SVGs on
 runtime, which I want to be available in the Dialog, I tried this:

 Suggestion:
 I changed qgsmarkercatalogue.cpp like this:

 -------------------------------------------------------------
 @@ -36,8 +36,13 @@

  QgsMarkerCatalogue::QgsMarkerCatalogue()
  {
 -  // Init list
 + updateMarkerCatalogue();
 +}

 +void QgsMarkerCatalogue::updateMarkerCatalogue()
 +{
 +  // Init list
 +  mList.clear();
    // Hardcoded markers
    mList.append ( "hard:circle" );
    mList.append ( "hard:rectangle" );
 @@ -69,6 +74,7 @@
    }
  }

 +
  QStringList QgsMarkerCatalogue::list()
  {
    return mList;
 -------------------------------------------------------------

 and qgsmarkercatalogue.h accordingly:

 -------------------------------------------------------------
 @@ -53,6 +53,8 @@
      /** Returns a pixmap given a filename of a svg marker
       *  NOTE: this method needs to be public static for
 QgsMarkerDialog::visualizeMarkers */
      static void svgMarker (QPainter * thepPainter, QString name, int size
 );
 +
 +    void updateMarkerCatalogue();
  private:

      /**Constructor*/
 -------------------------------------------------------------

 Now every time my plugin is constructing a new SVG, I call the
 updateMarkerCatalogue() like this

 -------------------------------------------------------------
         QgsMarkerCatalogue
 *markerCatalogue=QgsMarkerCatalogue::instance();
         markerCatalogue->updateMarkerCatalogue();
 -------------------------------------------------------------

 Tested in above named environment and it worked fine.

 If this change is accepted there would probably even be the opportunity to
 do this MarkerCatalogue Update every time the Symbology Dialog is opened
 automatically???

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1117>
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