Skip to content
Permalink
Browse files

Fix random sort order of symbols in Symbol Export dialog

Fixes #20572

(cherry picked from commit 987310f)
  • Loading branch information
nyalldawson committed May 23, 2020
1 parent 99ccdeb commit 394e4d5a80152dae8252432337f3572de5645b36
@@ -66,6 +66,7 @@ QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget
mGroupSelectionDlg = nullptr;
mTempFile = nullptr;

QgsStyle *dialogStyle = nullptr;
if ( mDialogMode == Import )
{
setWindowTitle( tr( "Import Item(s)" ) );
@@ -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
{
@@ -115,13 +115,16 @@ QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget

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

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

double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 10;
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,
@@ -30,7 +30,7 @@
class QgsStyle;
class QgsStyleGroupSelectionDialog;
class QgsTemporaryCursorOverride;
class QgsStyleModel;
class QgsStyleProxyModel;
class QTemporaryFile;

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

0 comments on commit 394e4d5

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