[QGIS Commit] r14499 - in trunk/qgis/src: gui/symbology-ng ui/symbollayer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Nov 3 17:11:02 EDT 2010


Author: wonder
Date: 2010-11-03 14:11:02 -0700 (Wed, 03 Nov 2010)
New Revision: 14499

Modified:
   trunk/qgis/src/gui/symbology-ng/qgssymbollayerv2widget.cpp
   trunk/qgis/src/ui/symbollayer/widget_svgfill.ui
   trunk/qgis/src/ui/symbollayer/widget_svgmarker.ui
Log:
Further improvements in the speed when opening symbol properties dialog (symbology-ng)


Modified: trunk/qgis/src/gui/symbology-ng/qgssymbollayerv2widget.cpp
===================================================================
--- trunk/qgis/src/gui/symbology-ng/qgssymbollayerv2widget.cpp	2010-11-03 21:04:12 UTC (rev 14498)
+++ trunk/qgis/src/gui/symbology-ng/qgssymbollayerv2widget.cpp	2010-11-03 21:11:02 UTC (rev 14499)
@@ -438,6 +438,7 @@
 
 #include <QTime>
 #include <QAbstractListModel>
+#include <QPixmapCache>
 
 class QgsSvgListModel : public QAbstractListModel
 {
@@ -458,17 +459,23 @@
 
       if ( role == Qt::DecorationRole ) // icon
       {
-        QSvgRenderer renderer;
-        QPainter painter;
 
-        // render SVG file
-        renderer.load( entry );
-        QPixmap pixmap( QSize( 24, 24 ) );
-        pixmap.fill();
-        painter.begin( &pixmap );
-        renderer.render( &painter );
-        painter.end();
+        QPixmap pixmap;
+        if ( !QPixmapCache::find( entry, pixmap ) )
+        {
+          // render SVG file
+          QSvgRenderer renderer;
+          QPainter painter;
+          renderer.load( entry );
+          pixmap = QPixmap( QSize( 24, 24 ) );
+          pixmap.fill();
+          painter.begin( &pixmap );
+          renderer.render( &painter );
+          painter.end();
 
+          QPixmapCache::insert( entry, pixmap );
+        }
+
         return pixmap;
       }
       else if ( role == Qt::UserRole || role == Qt::ToolTipRole )

Modified: trunk/qgis/src/ui/symbollayer/widget_svgfill.ui
===================================================================
--- trunk/qgis/src/ui/symbollayer/widget_svgfill.ui	2010-11-03 21:04:12 UTC (rev 14498)
+++ trunk/qgis/src/ui/symbollayer/widget_svgfill.ui	2010-11-03 21:11:02 UTC (rev 14499)
@@ -55,9 +55,15 @@
      <property name="flow">
       <enum>QListView::LeftToRight</enum>
      </property>
+     <property name="layoutMode">
+      <enum>QListView::Batched</enum>
+     </property>
      <property name="viewMode">
       <enum>QListView::IconMode</enum>
      </property>
+     <property name="uniformItemSizes">
+      <bool>true</bool>
+     </property>
     </widget>
    </item>
    <item row="3" column="0">

Modified: trunk/qgis/src/ui/symbollayer/widget_svgmarker.ui
===================================================================
--- trunk/qgis/src/ui/symbollayer/widget_svgmarker.ui	2010-11-03 21:04:12 UTC (rev 14498)
+++ trunk/qgis/src/ui/symbollayer/widget_svgmarker.ui	2010-11-03 21:11:02 UTC (rev 14499)
@@ -141,6 +141,9 @@
      <property name="movement">
       <enum>QListView::Static</enum>
      </property>
+     <property name="layoutMode">
+      <enum>QListView::Batched</enum>
+     </property>
      <property name="spacing">
       <number>2</number>
      </property>
@@ -153,6 +156,9 @@
      <property name="viewMode">
       <enum>QListView::IconMode</enum>
      </property>
+     <property name="uniformItemSizes">
+      <bool>true</bool>
+     </property>
      <property name="wordWrap">
       <bool>true</bool>
      </property>



More information about the QGIS-commit mailing list