Skip to content

Commit

Permalink
Further improvements in the speed when opening symbol properties dial…
Browse files Browse the repository at this point in the history
…og (symbology-ng)

git-svn-id: http://svn.osgeo.org/qgis/trunk@14499 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 3, 2010
1 parent 1e7da44 commit 34e9fc5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ QgsSvgMarkerSymbolLayerV2Widget::QgsSvgMarkerSymbolLayerV2Widget( QWidget* paren

#include <QTime>
#include <QAbstractListModel>
#include <QPixmapCache>

class QgsSvgListModel : public QAbstractListModel
{
Expand All @@ -458,16 +459,22 @@ class QgsSvgListModel : public QAbstractListModel

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;
}
Expand Down
6 changes: 6 additions & 0 deletions src/ui/symbollayer/widget_svgfill.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
6 changes: 6 additions & 0 deletions src/ui/symbollayer/widget_svgmarker.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit 34e9fc5

Please sign in to comment.