19#include "moc_qgsstylesavedialog.cpp"
40 defaultTags.sort( Qt::CaseInsensitive );
41 mTags->addItems( defaultTags );
43 QList<QgsStyle::StyleEntity> possibleEntities;
47 this->setWindowTitle( tr(
"Save New Symbol" ) );
52 this->setWindowTitle( tr(
"Save New Color Ramp" ) );
57 this->setWindowTitle( tr(
"Save New Text Format" ) );
62 this->setWindowTitle( tr(
"Save New Label Settings" ) );
67 this->setWindowTitle( tr(
"Save New Legend Patch Shape" ) );
72 this->setWindowTitle( tr(
"Save New 3D Symbol" ) );
85 if ( styleProxyModel->rowCount( QModelIndex() ) == 0 )
87 mLabelDestination->hide();
88 mComboBoxDestination->hide();
93 mComboBoxDestination->setModel( styleProxyModel );
96 if ( possibleEntities.size() < 2 )
108 mComboSaveAs->addItem( tr(
"Symbol" ), e );
136 mComboSaveAs->setCurrentIndex( 0 );
142 return mName->text();
147 mTags->setCurrentText(
tags );
152 return mTags->currentText();
157 return mFavorite->isChecked();
162 if ( mComboSaveAs->count() > 0 )
170 if (
QgsStyle *style = qobject_cast<QgsStyle *>( mComboBoxDestination->model()->data( mComboBoxDestination->model()->index( mComboBoxDestination->currentIndex(), 0, QModelIndex() ),
static_cast<int>(
QgsProjectStyleDatabaseModel::CustomRole::Style ) ).value<QObject *>() ) )
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
List model representing the style databases associated with a QgsProject.
void setShowDefaultStyle(bool show)
Sets whether the default style should also be included in the model.
A proxy model for filtering QgsProjectStyleDatabaseModel.
@ FilterHideReadOnly
Hide read-only style databases.
void setFilters(QgsProjectStyleDatabaseProxyModel::Filters filters)
Sets the current filters used for filtering available styles.
static QgsProject * instance()
Returns the QgsProject singleton instance.
bool isFavorite() const
Returns true if the favorite is checked for the symbol.
QString name() const
Returns the entered name for the new symbol.
QgsStyle::StyleEntity selectedType() const
Returns the type of style entity to save.
void setDefaultTags(const QString &tags)
Sets the default tags for the newly created item.
QgsStyleSaveDialog(QWidget *parent=nullptr, QgsStyle::StyleEntity type=QgsStyle::SymbolEntity)
Constructor for QgsSymbolSaveDialog.
QString tags() const
Returns any tags entered for the new symbol (as a comma separated value list).
QgsStyle * destinationStyle()
Returns the destination style database.
QStringList tags() const
Returns a list of all tags in the style database.
StyleEntity
Enum for Entities involved in a style.
@ LabelSettingsEntity
Label settings.
@ TextFormatEntity
Text formats.
@ SmartgroupEntity
Smart groups.
@ Symbol3DEntity
3D symbol entity
@ ColorrampEntity
Color ramps.
@ LegendPatchShapeEntity
Legend patch shape.
static QgsStyle * defaultStyle(bool initialize=true)
Returns the default application-wide style.