Skip to content

Commit

Permalink
Fix random sort order of symbols in Symbol Export dialog
Browse files Browse the repository at this point in the history
Fixes #20572
  • Loading branch information
nyalldawson committed May 23, 2020
1 parent 3961fa2 commit 987310f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/gui/symbology/qgsstyleexportimportdialog.cpp
Expand Up @@ -66,6 +66,7 @@ QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget
mGroupSelectionDlg = nullptr;
mTempFile = nullptr;

QgsStyle *dialogStyle = nullptr;
if ( mDialogMode == Import )
{
setWindowTitle( tr( "Import Item(s)" ) );
Expand All @@ -91,8 +92,7 @@ QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget
label->setText( tr( "Select items to import" ) );
buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Import" ) );

mModel = new QgsStyleModel( mTempStyle.get(), this );
listItems->setModel( mModel );
dialogStyle = mTempStyle.get();
}
else
{
Expand All @@ -115,7 +115,7 @@ QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget

buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Export" ) );

mModel = new QgsStyleModel( mStyle, this );
dialogStyle = mStyle;
}

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
Expand All @@ -125,7 +125,10 @@ QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget
#endif
listItems->setIconSize( QSize( static_cast< int >( iconSize ), static_cast< int >( iconSize * 0.9 ) ) ); // ~100, 90 on low dpi

mModel = new QgsStyleProxyModel( dialogStyle, this );

mModel->addDesiredIconSize( listItems->iconSize() );

listItems->setModel( mModel );

connect( listItems->selectionModel(), &QItemSelectionModel::selectionChanged,
Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology/qgsstyleexportimportdialog.h
Expand Up @@ -30,7 +30,7 @@
class QgsStyle;
class QgsStyleGroupSelectionDialog;
class QgsTemporaryCursorOverride;
class QgsStyleModel;
class QgsStyleProxyModel;
class QTemporaryFile;

/**
Expand Down Expand Up @@ -148,7 +148,7 @@ class GUI_EXPORT QgsStyleExportImportDialog : public QDialog, private Ui::QgsSty
QString mFileName;
Mode mDialogMode;

QgsStyleModel *mModel = nullptr;
QgsStyleProxyModel *mModel = nullptr;

QgsStyle *mStyle = nullptr;
std::unique_ptr< QgsStyle > mTempStyle;
Expand Down

0 comments on commit 987310f

Please sign in to comment.