27 : mContent( other.mContent )
28 , mBackgroundColor( other.mBackgroundColor )
29 , mForegroundColor( other.mForegroundColor )
30 , mTextFormat( other.mTextFormat )
31 , mFormat( other.mFormat ? other.mFormat->clone() : nullptr )
32 , mHAlign( other.mHAlign )
33 , mVAlign( other.mVAlign )
40 mContent = other.mContent;
41 mBackgroundColor = other.mBackgroundColor;
42 mForegroundColor = other.mForegroundColor;
43 mTextFormat = other.mTextFormat;
44 mFormat.reset( other.mFormat ? other.mFormat->clone() :
nullptr );
45 mHAlign = other.mHAlign;
46 mVAlign = other.mVAlign;
57 mFormat.reset( format );
63 res.insert( QStringLiteral(
"content" ), mContent );
64 res.insert( QStringLiteral(
"background" ), mBackgroundColor );
65 res.insert( QStringLiteral(
"foreground" ), mForegroundColor );
68 res.insert( QStringLiteral(
"format_type" ), mFormat->id() );
69 res.insert( QStringLiteral(
"format" ), mFormat->configuration( context ) );
75 QDomElement textElem = mTextFormat.
writeXml( textDoc, context );
76 textDoc.appendChild( textElem );
77 res.insert( QStringLiteral(
"text_format" ), textDoc.toString() );
80 res.insert( QStringLiteral(
"halign" ),
static_cast< int >( mHAlign ) );
81 res.insert( QStringLiteral(
"valign" ),
static_cast< int >( mVAlign ) );
88 mContent =
properties.value( QStringLiteral(
"content" ) );
89 mBackgroundColor =
properties.value( QStringLiteral(
"background" ) ).value< QColor >();
90 mForegroundColor =
properties.value( QStringLiteral(
"foreground" ) ).value< QColor >();
94 const QString textXml =
properties.value( QStringLiteral(
"text_format" ) ).toString();
95 if ( !textXml.isEmpty() )
97 doc.setContent( textXml );
98 elem = doc.documentElement();
99 mTextFormat.
readXml( elem, context );
106 if (
properties.contains( QStringLiteral(
"format_type" ) ) )
110 properties.value( QStringLiteral(
"format" ) ).toMap(),
118 mHAlign =
static_cast< Qt::Alignment
>(
properties.value( QStringLiteral(
"halign" ), Qt::AlignLeft ).toInt() );
119 mVAlign =
static_cast< Qt::Alignment
>(
properties.value( QStringLiteral(
"valign" ), Qt::AlignVCenter ).toInt() );
static QgsNumericFormatRegistry * numericFormatRegistry()
Gets the registry of available numeric formats.
The class is used as a container of context for various read/write operations on other objects.
Encapsulates the contents and formatting of a single table cell.
void setHorizontalAlignment(Qt::Alignment alignment)
Sets the horizontal alignment for text in the cell.
Qt::Alignment horizontalAlignment() const
Returns the horizontal alignment for text in the cell.
QgsTableCell(const QVariant &content=QVariant())
Constructor for QgsTableCell, with the specified content.
void setVerticalAlignment(Qt::Alignment alignment)
Sets the vertical alignment for text in the cell.
Qt::Alignment verticalAlignment() const
Returns the vertical alignment for text in the cell.
void setProperties(const QVariantMap &properties, const QgsReadWriteContext &context)
Sets the properties for the cell.
QgsTableCell & operator=(const QgsTableCell &other)
QVariantMap properties(const QgsReadWriteContext &context) const
Returns the properties of the cell.
const QgsNumericFormat * numericFormat() const
Returns the numeric format used for numbers in the cell, or nullptr if no format is set.
void setNumericFormat(QgsNumericFormat *format)
Sets the numeric format used for numbers in the cell, or nullptr if no specific format is set.
Container for all settings relating to text rendering.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Read settings from a DOM element.
bool isValid() const
Returns true if the format is valid.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.