25using namespace Qt::StringLiterals;
32 : mContent( other.mContent )
33 , mBackgroundColor( other.mBackgroundColor )
34 , mForegroundColor( other.mForegroundColor )
35 , mTextFormat( other.mTextFormat )
36 , mFormat( other.mFormat ? other.mFormat->clone() : nullptr )
37 , mHAlign( other.mHAlign )
38 , mVAlign( other.mVAlign )
39 , mRowSpan( other.mRowSpan )
40 , mColumnSpan( other.mColumnSpan )
50 mContent = other.mContent;
51 mBackgroundColor = other.mBackgroundColor;
52 mForegroundColor = other.mForegroundColor;
53 mTextFormat = other.mTextFormat;
54 mFormat.reset( other.mFormat ? other.mFormat->clone() :
nullptr );
55 mHAlign = other.mHAlign;
56 mVAlign = other.mVAlign;
57 mRowSpan = other.mRowSpan;
58 mColumnSpan = other.mColumnSpan;
69 mFormat.reset( format );
75 res.insert( u
"content"_s, mContent );
76 res.insert( u
"background"_s, mBackgroundColor );
77 res.insert( u
"foreground"_s, mForegroundColor );
80 res.insert( u
"format_type"_s, mFormat->id() );
81 res.insert( u
"format"_s, mFormat->configuration( context ) );
84 if ( mTextFormat.isValid() )
87 const QDomElement textElem = mTextFormat.writeXml( textDoc, context );
88 textDoc.appendChild( textElem );
89 res.insert( u
"text_format"_s, textDoc.toString() );
92 res.insert( u
"halign"_s,
static_cast< int >( mHAlign ) );
93 res.insert( u
"valign"_s,
static_cast< int >( mVAlign ) );
95 res.insert( u
"row_span"_s, mRowSpan );
96 if ( mColumnSpan > 1 )
97 res.insert( u
"column_span"_s, mColumnSpan );
105 mBackgroundColor =
properties.value( u
"background"_s ).value< QColor >();
106 mForegroundColor =
properties.value( u
"foreground"_s ).value< QColor >();
110 const QString textXml =
properties.value( u
"text_format"_s ).toString();
111 if ( !textXml.isEmpty() )
113 doc.setContent( textXml );
114 elem = doc.documentElement();
115 mTextFormat.readXml( elem, context );
122 if (
properties.contains( u
"format_type"_s ) )
134 mHAlign =
static_cast< Qt::Alignment
>(
properties.value( u
"halign"_s, Qt::AlignLeft ).toInt() );
135 mVAlign =
static_cast< Qt::Alignment
>(
properties.value( u
"valign"_s, Qt::AlignVCenter ).toInt() );
137 mRowSpan =
properties.value( u
"row_span"_s, 1 ).toInt();
138 mColumnSpan =
properties.value( u
"column_span"_s, 1 ).toInt();
static QgsNumericFormatRegistry * numericFormatRegistry()
Gets the registry of available numeric formats.
A container for the context for various read/write operations on objects.
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.
int columnSpan() const
Returns the column span for the cell.
void setSpan(int rowSpan, int columnSpan)
Sets the row and column span for 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.
QVariant content() const
Returns the cell's content.
void setProperties(const QVariantMap &properties, const QgsReadWriteContext &context)
Sets the properties for the cell.
QgsTableCell & operator=(const QgsTableCell &other)
int rowSpan() const
Returns the row span for the cell.
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.