30
30
#include < QSettings>
31
31
#include < QSvgRenderer>
32
32
33
- QgsComposerPictureWidget::QgsComposerPictureWidget ( QgsComposerPicture* picture ): QWidget(), mPicture( picture ), mPreviewInitialized( false )
33
+ QgsComposerPictureWidget::QgsComposerPictureWidget ( QgsComposerPicture* picture ): QWidget(), mPicture( picture )
34
34
{
35
35
setupUi ( this );
36
36
@@ -44,8 +44,6 @@ QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture
44
44
45
45
mPreviewListWidget ->setIconSize ( QSize ( 30 , 30 ) );
46
46
47
- // add preview icons on demand in showEvent()
48
-
49
47
connect ( mPicture , SIGNAL ( itemChanged () ), this , SLOT ( setGuiElementValues () ) );
50
48
connect ( mPicture , SIGNAL ( rotationChanged ( double ) ), this , SLOT ( setGuiElementValues () ) );
51
49
}
@@ -261,17 +259,6 @@ void QgsComposerPictureWidget::on_mRotationFromComposerMapCheckBox_stateChanged(
261
259
mPicture ->endCommand ();
262
260
}
263
261
264
- void QgsComposerPictureWidget::showEvent ( QShowEvent * event )
265
- {
266
- refreshMapComboBox ();
267
- if ( !mPreviewInitialized )
268
- {
269
- addStandardDirectoriesToPreview ();
270
- mPreviewInitialized = true ;
271
- }
272
- QWidget::showEvent ( event );
273
- }
274
-
275
262
void QgsComposerPictureWidget::on_mComposerMapComboBox_activated ( const QString & text )
276
263
{
277
264
if ( !mPicture || text.isEmpty () || !mPicture ->useRotationMap () )
@@ -481,6 +468,8 @@ int QgsComposerPictureWidget::addDirectoryToPreview( const QString& path )
481
468
482
469
void QgsComposerPictureWidget::addStandardDirectoriesToPreview ()
483
470
{
471
+ mPreviewListWidget ->clear ();
472
+
484
473
// list all directories in $prefix/share/qgis/svg
485
474
QStringList svgPaths = QgsApplication::svgPaths ();
486
475
for ( int i = 0 ; i < svgPaths.size (); i++ )
@@ -536,3 +525,10 @@ bool QgsComposerPictureWidget::testImageFile( const QString& filename ) const
536
525
QString formatName = QString ( QImageReader::imageFormat ( filename ) );
537
526
return !formatName.isEmpty (); // file is in a supported pixel format
538
527
}
528
+
529
+ void QgsComposerPictureWidget::showEvent ( QShowEvent * event )
530
+ {
531
+ Q_UNUSED ( event );
532
+ refreshMapComboBox ();
533
+ }
534
+
0 commit comments