Skip to content
Permalink
Browse files
Fix missing SVG previews for existing composer picture item
- Previews now load when picture is first selected and its properties are shown (unless already loaded)
- NOTE: the loading of SVGs per QListWidget per picture should be replaced with a model/view per composer, or something cached
- Combobox no longer over-expands width of dock widget when it contains long paths
  • Loading branch information
dakcarto committed Mar 3, 2013
1 parent 0141acd commit 34f3d50099c7e90e614fc68a5ebe37c9bd04cae0
Showing with 52 additions and 19 deletions.
  1. +16 −0 src/app/composer/qgscomposerpicturewidget.cpp
  2. +1 −0 src/app/composer/qgscomposerpicturewidget.h
  3. +35 −19 src/ui/qgscomposerpicturewidgetbase.ui
@@ -39,6 +39,7 @@ QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture
mainLayout->addWidget( itemPropertiesWidget );

setGuiElementValues();
mPreviewsLoadingLabel->hide();

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

@@ -487,5 +488,20 @@ void QgsComposerPictureWidget::showEvent( QShowEvent * event )
{
Q_UNUSED( event );
refreshMapComboBox();

if ( mPreviewListWidget->count() == 0 )
{
mPreviewListWidget->hide();
mPreviewsLoadingLabel->show();
addStandardDirectoriesToPreview();
mPreviewsLoadingLabel->hide();
mPreviewListWidget->show();
}
}

void QgsComposerPictureWidget::resizeEvent( QResizeEvent * event )
{
Q_UNUSED( event );
mSearchDirectoriesComboBox->setMinimumWidth( mPreviewListWidget->sizeHint().width() );
}

@@ -48,6 +48,7 @@ class QgsComposerPictureWidget: public QWidget, private Ui::QgsComposerPictureWi

protected:
void showEvent( QShowEvent * event );
void resizeEvent( QResizeEvent * event );

private slots:
/**Sets the GUI elements to the values of mPicture*/
@@ -68,25 +68,19 @@
<property name="collapsed" stdset="0">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Path</string>
</property>
<property name="buddy">
<cstring>mPictureLineEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Path</string>
</property>
<property name="buddy">
<cstring>mPictureLineEdit</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mPictureLineEdit"/>
</item>
@@ -132,6 +126,24 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="mPreviewsLoadingLabel">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(19, 133, 54);</string>
</property>
<property name="text">
<string>Loading SVG previews...</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="mPreviewListWidget">
<property name="showDropIndicator" stdset="0">
@@ -167,7 +179,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="mSearchDirectoriesComboBox"/>
<widget class="QComboBox" name="mSearchDirectoriesComboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">

0 comments on commit 34f3d50

Please sign in to comment.