mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Show composer picture preview icons on demand
This commit is contained in:
parent
d6cb997c8e
commit
c8dd58791f
@ -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*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user