15 #ifndef QGSPROJECTSTYLESETTINGS_H
16 #define QGSPROJECTSTYLESETTINGS_H
18 #include "qgis_core.h"
23 #include <QAbstractListModel>
24 #include <QSortFilterProxyModel>
143 bool readXml(
const QDomElement &element,
const QgsReadWriteContext &context, Qgis::ProjectReadFlags flags = Qgis::ProjectReadFlags() );
168 QList< QgsStyle * > styles()
const;
173 QgsStyle *styleAtPath(
const QString &path );
187 void addStyleDatabasePath(
const QString &path );
201 void setStyleDatabasePaths(
const QStringList &paths );
203 #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
269 std::unique_ptr< QgsSymbol > mDefaultMarkerSymbol;
270 std::unique_ptr< QgsSymbol > mDefaultLineSymbol;
271 std::unique_ptr< QgsSymbol > mDefaultFillSymbol;
272 std::unique_ptr< QgsColorRamp > mDefaultColorRamp;
275 bool mRandomizeDefaultSymbolColor =
true;
276 double mDefaultSymbolOpacity = 1.0;
279 QStringList mStyleDatabases;
280 QList< QPointer< QgsStyle > > mStyles;
284 void loadStyleAtPath(
const QString &path );
306 StyleRole = Qt::UserRole + 1,
315 int rowCount(
const QModelIndex &parent )
const override;
316 QVariant data(
const QModelIndex &index,
int role )
const override;
322 QgsStyle *styleFromIndex(
const QModelIndex &index )
const;
328 QModelIndex indexFromStyle(
QgsStyle *style )
const;
335 void setShowDefaultStyle(
bool show );
345 void styleDatabaseAboutToBeAdded(
const QString &path );
346 void styleDatabaseAboutToBeRemoved(
const QString &path );
347 void styleDatabaseAdded(
const QString &path );
348 void styleDatabaseRemoved(
const QString &path );
350 void setProjectStyle(
QgsStyle *style );
351 void projectStyleAboutToBeDestroyed();
352 void projectStyleDestroyed();
353 void projectStyleChanged();
357 bool mShowDefault =
false;
358 QPointer< QgsStyle > mProjectStyle;
378 FilterHideReadOnly = 1 << 0,
382 Q_DECLARE_FLAGS( Filters, Filter )
390 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
397 QgsProjectStyleDatabaseProxyModel::Filters filters()
const;
404 void setFilters( QgsProjectStyleDatabaseProxyModel::Filters filters );
408 QgsProjectStyleDatabaseProxyModel::Filters mFilters;
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.
bool showDefaultStyle() const
Returns true if the model includes the default style.
A proxy model for filtering QgsProjectStyleDatabaseModel.
Filter
Available filter flags for filtering the model.
Contains settings and properties relating to how a QgsProject should handle styling.
double defaultSymbolOpacity() const
Returns the default symbol opacity.
void projectStyleChanged()
Emitted when the style returned by projectStyle() is changed.
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.
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 setRandomizeDefaultSymbolColor(bool randomized)
Sets whether the default symbol fill color is randomized.
void styleDatabaseRemoved(const QString &path)
Emitted when a style database path is removed.
void setDefaultSymbolOpacity(double opacity)
Sets the default symbol opacity.
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,...
The class is used as a container of context for various read/write operations on other objects.
Abstract base class for all rendered symbols.
Container for all settings relating to text rendering.
#define SIP_IF_FEATURE(feature)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.