Skip to content

Commit

Permalink
Show composer picture preview icons on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed May 31, 2011
1 parent d6cb997 commit c8dd587
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/composer/qgscomposerpicturewidget.cpp
Expand Up @@ -30,7 +30,7 @@
#include <QSettings>
#include <QSvgRenderer>

QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QWidget(), mPicture( picture )
QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QWidget(), mPicture( picture ), mPreviewInitialized( false )
{
setupUi( this );

Expand All @@ -44,8 +44,8 @@ QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture

mPreviewListWidget->setIconSize( QSize( 30, 30 ) );

//add preview icons
addStandardDirectoriesToPreview();
//add preview icons on demand in showEvent()

connect( mPicture, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
connect( mPicture, SIGNAL( rotationChanged( double ) ), this, SLOT( setGuiElementValues() ) );
}
Expand Down Expand Up @@ -263,6 +263,11 @@ void QgsComposerPictureWidget::on_mRotationFromComposerMapCheckBox_stateChanged(
void QgsComposerPictureWidget::showEvent( QShowEvent * event )
{
refreshMapComboBox();
if ( !mPreviewInitialized )
{
addStandardDirectoriesToPreview();
mPreviewInitialized = true;
}
QWidget::showEvent( event );
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/composer/qgscomposerpicturewidget.h
Expand Up @@ -54,6 +54,8 @@ class QgsComposerPictureWidget: public QWidget, private Ui::QgsComposerPictureWi

private:
QgsComposerPicture* mPicture;
bool mPreviewInitialized;

/**Add the icons of a directory to the preview. Returns 0 in case of success*/
int addDirectoryToPreview( const QString& path );
/**Add the icons of the standard directories to the preview*/
Expand Down

0 comments on commit c8dd587

Please sign in to comment.