Skip to content
Permalink
Browse files

Show composer picture preview icons on demand

  • Loading branch information
mhugent committed May 31, 2011
1 parent d6cb997 commit c8dd58791f366121e4a4db7a1589e7f7a3b9276e
Showing with 10 additions and 3 deletions.
  1. +8 −3 src/app/composer/qgscomposerpicturewidget.cpp
  2. +2 −0 src/app/composer/qgscomposerpicturewidget.h
@@ -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 );

@@ -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() ) );
}
@@ -263,6 +263,11 @@ void QgsComposerPictureWidget::on_mRotationFromComposerMapCheckBox_stateChanged(
void QgsComposerPictureWidget::showEvent( QShowEvent * event )
{
refreshMapComboBox();
if ( !mPreviewInitialized )
{
addStandardDirectoriesToPreview();
mPreviewInitialized = true;
}
QWidget::showEvent( event );
}

@@ -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*/

0 comments on commit c8dd587

Please sign in to comment.
You can’t perform that action at this time.