QGIS API Documentation 4.1.0-Master (3b8ef1f72a3)
Loading...
Searching...
No Matches
qgssymbolconverter.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssymbolconverter.h
3 -----------------
4 begin : February 2026
5 copyright : (C) 2026 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSSYMBOLCONVERTER_H
19#define QGSSYMBOLCONVERTER_H
20
21#include "qgis.h"
22#include "qgis_core.h"
23#include "qgsreadwritecontext.h"
24
25class QgsSymbol;
26
35{
36 public:
43
48
55 QStringList errors() const { return mErrors; }
56
63 void pushError( const QString &error ) { mErrors << error; }
64
71 QStringList warnings() const { return mWarnings; }
72
79 void pushWarning( const QString &warning ) { mWarnings << warning; }
80
86 Qgis::SymbolType typeHint() const { return mTypeHint; }
87
95 void setTypeHint( Qgis::SymbolType hint ) { mTypeHint = hint; }
96
97 private:
98#ifdef SIP_RUN
100#endif
101
102 QgsReadWriteContext &mRwContext;
103 QStringList mErrors;
104 QStringList mWarnings;
106};
107
122{
123 public:
125
130
138 virtual QString name() const = 0;
139
148 virtual QString formatName() const = 0;
149
164 virtual QVariant toVariant( const QgsSymbol *symbol, QgsSymbolConverterContext &context ) const = 0 SIP_THROW( QgsNotSupportedException );
165
179 virtual std::unique_ptr< QgsSymbol > createSymbol( const QVariant &variant, QgsSymbolConverterContext &context ) const = 0 SIP_THROW( QgsNotSupportedException );
180};
181
182#endif //QGSSYMBOLCONVERTER_H
QFlags< SymbolConverterCapability > SymbolConverterCapabilities
Symbol converter capabilities.
Definition qgis.h:824
SymbolType
Symbol types.
Definition qgis.h:636
@ Hybrid
Hybrid symbol.
Definition qgis.h:640
An abstract base class for converting between QgsSymbol objects and QVariant representations.
virtual ~QgsAbstractSymbolConverter()
virtual Qgis::SymbolConverterCapabilities capabilities() const =0
Returns the capabilities of the converter.
virtual QString name() const =0
Returns the unique name for the converter.
virtual QString formatName() const =0
Returns a translated, user-friendly name for the converter's data format.
virtual QVariant toVariant(const QgsSymbol *symbol, QgsSymbolConverterContext &context) const =0
Converts a symbol into a QVariant representation.
virtual std::unique_ptr< QgsSymbol > createSymbol(const QVariant &variant, QgsSymbolConverterContext &context) const =0
Creates a new QgsSymbol from a QVariant representation.
Custom exception class which is raised when an operation is not supported.
A container for the context for various read/write operations on objects.
Represents the context in which a QgsSymbolConverter conversion occurs.
Qgis::SymbolType typeHint() const
Returns the symbol type hint, or Qgis::SymbolType::Hybrid if unknown.
QgsSymbolConverterContext(QgsReadWriteContext &rwContext)
Constructor for QgsSymbolConverterContext.
void setTypeHint(Qgis::SymbolType hint)
Sets the symbol type hint.
QStringList warnings() const
Returns a list of warnings which occurred during the conversion.
void pushWarning(const QString &warning)
Pushes a warning message generated during the conversion.
QgsReadWriteContext & readWriteContext()
Returns the read-write context associated with the context.
void pushError(const QString &error)
Pushes a error message generated during the conversion.
QStringList errors() const
Returns a list of errors which occurred during the conversion.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:227
#define SIP_THROW(name,...)
Definition qgis_sip.h:210