15#ifndef QGSPROJECTSTYLESETTINGS_H
16#define QGSPROJECTSTYLESETTINGS_H
25#include <QAbstractListModel>
28#include <QSortFilterProxyModel>
110 void setRandomizeDefaultSymbolColor(
bool randomized );
120 void setDefaultSymbolOpacity(
double opacity );
132 void removeProjectStyle();
196 void setColorSpace(
const QColorSpace &colorSpace );
209 QColorSpace colorSpace()
const;
240 QList< QgsStyle * > styles()
const;
245 QgsStyle *styleAtPath(
const QString &path );
259 void addStyleDatabasePath(
const QString &path );
273 void setStyleDatabasePaths(
const QStringList &paths );
335 std::unique_ptr< QgsSymbol > mDefaultMarkerSymbol;
336 std::unique_ptr< QgsSymbol > mDefaultLineSymbol;
337 std::unique_ptr< QgsSymbol > mDefaultFillSymbol;
338 std::unique_ptr< QgsColorRamp > mDefaultColorRamp;
341 bool mRandomizeDefaultSymbolColor =
true;
342 double mDefaultSymbolOpacity = 1.0;
345 QStringList mStyleDatabases;
346 QList< QPointer< QgsStyle > > mStyles;
350 QColorSpace mColorSpace;
351 QString mIccProfileFilePath;
353 void loadStyleAtPath(
const QString &path );
396 int rowCount(
const QModelIndex &parent )
const override;
397 QVariant data(
const QModelIndex &index,
int role )
const override;
403 QgsStyle *styleFromIndex(
const QModelIndex &index )
const;
409 QModelIndex indexFromStyle(
QgsStyle *style )
const;
416 void setShowDefaultStyle(
bool show );
426 void styleDatabaseAboutToBeAdded(
const QString &path );
427 void styleDatabaseAboutToBeRemoved(
const QString &path );
428 void styleDatabaseAdded(
const QString &path );
429 void styleDatabaseRemoved(
const QString &path );
431 void setProjectStyle(
QgsStyle *style );
432 void projectStyleAboutToBeDestroyed();
433 void projectStyleDestroyed();
434 void projectStyleChanged();
438 bool mShowDefault =
false;
439 QPointer< QgsStyle > mProjectStyle;
458 FilterHideReadOnly = 1 << 0,
470 bool filterAcceptsRow(
int sourceRow, const QModelIndex &sourceParent ) const override;
QFlags< ProjectReadFlag > ProjectReadFlags
Project load flags.
ColorModel
Color model types.
Abstract base class for color ramps.
A model which contains entities from multiple QgsStyle databases.
List model representing the style databases associated with a QgsProject.
CustomRole
Custom model roles.
bool showDefaultStyle() const
Returns true if the model includes the default style.
QgsProjectStyleDatabaseModel(QgsProjectStyleSettings *settings, QObject *parent=nullptr)
Constructor for QgsProjectStyleDatabaseModel, showing the styles from the specified settings.
Filter
Available filter flags for filtering the model.
QgsProjectStyleDatabaseProxyModel::Filters filters() const
Returns the current filters used for filtering available style.
QFlags< Filter > Filters
Available filter flags for filtering the model.
void setFilters(QgsProjectStyleDatabaseProxyModel::Filters filters)
Sets the current filters used for filtering available styles.
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
QgsProjectStyleDatabaseProxyModel(QgsProjectStyleDatabaseModel *model, QObject *parent=nullptr)
Constructor for QgsProjectStyleDatabaseProxyModel, for the specified style database model.
Contains settings and properties relating to how a QgsProject should handle styling.
void setDefaultTextFormat(const QgsTextFormat &textFormat)
Sets the project default text format.
friend class TestQgsProjectProperties
QgsTextFormat defaultTextFormat() const
Returns the project default text format.
double defaultSymbolOpacity() const
Returns the default symbol opacity.
void projectStyleChanged()
Emitted when the style returned by projectStyle() is changed.
QgsColorRamp * defaultColorRamp() const
Returns the project default color ramp.
QgsSymbol * defaultSymbol(Qgis::SymbolType symbolType) const
Returns the project default symbol for a given type.
void setDefaultSymbol(Qgis::SymbolType symbolType, QgsSymbol *symbol)
Sets the project default symbol for a given type.
bool randomizeDefaultSymbolColor() const
Returns whether the default symbol fill color is randomized.
QStringList styleDatabasePaths() const
Returns a list of all style databases (file paths) associated with the project.
QgsProjectStyleSettings(QgsProject *project=nullptr)
Constructor for QgsProjectStyleSettings for the specified project.
void styleDatabaseAdded(const QString &path)
Emitted when a style database path is added.
void styleDatabaseAboutToBeRemoved(const QString &path)
Emitted when a style database path is about to be removed.
void setDefaultColorRamp(QgsColorRamp *colorRamp)
Sets the project default color ramp.
void styleDatabaseRemoved(const QString &path)
Emitted when a style database path is removed.
void styleDatabaseAboutToBeAdded(const QString &path)
Emitted when a style database path is about to be added.
void styleDatabasesChanged()
Emitted whenever the set of style databases associated with the project is changed.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
A container for the context for various read/write operations on objects.
A database of saved style entities, including symbols, color ramps, text formats and others.
Abstract base class for all rendered symbols.
Container for all settings relating to text rendering.
#define SIP_ENUM_BASETYPE(type)
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)