QGIS API Documentation 4.1.0-Master (64dc32379c2)
Loading...
Searching...
No Matches
qgsfixedgradientbackgroundsettings.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsfixedgradientbackgroundsettings.cpp
3 --------------------------------------
4 Date : April 2026
5 Copyright : (C) 2026 by Dominik Cindrić
6 Email : viper dot miniq at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
18#include "qgscolorutils.h"
19#include "qgsreadwritecontext.h"
20
21#include <QDomElement>
22#include <QString>
23
24using namespace Qt::StringLiterals;
25
30
31
32void QgsFixedGradientBackgroundSettings::readXml( const QDomElement &element, const QgsReadWriteContext & )
33{
34 mTopColor = QgsColorUtils::colorFromString( element.attribute( u"top-color"_s ) );
35 mBottomColor = QgsColorUtils::colorFromString( element.attribute( u"bottom-color"_s ) );
36}
37
38void QgsFixedGradientBackgroundSettings::writeXml( QDomElement &element, const QgsReadWriteContext & ) const
39{
40 element.setAttribute( u"top-color"_s, QgsColorUtils::colorToString( mTopColor ) );
41 element.setAttribute( u"bottom-color"_s, QgsColorUtils::colorToString( mBottomColor ) );
42}
static QColor colorFromString(const QString &string)
Decodes a string into a color value.
static QString colorToString(const QColor &color)
Encodes a color into a string value.
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const override
Writes settings to a DOM element.
void readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads settings from a DOM element.
QgsFixedGradientBackgroundSettings * clone() const override
Returns a deep copy of this background settings object.
A container for the context for various read/write operations on objects.