28 : mContent( other.mContent )
29 , mBackgroundColor( other.mBackgroundColor )
30 , mForegroundColor( other.mForegroundColor )
31 , mTextFormat( other.mTextFormat )
32 , mFormat( other.mFormat ? other.mFormat->clone() : nullptr )
33 , mHAlign( other.mHAlign )
34 , mVAlign( other.mVAlign )
35 , mRowSpan( other.mRowSpan )
36 , mColumnSpan( other.mColumnSpan )
46 mContent = other.mContent;
47 mBackgroundColor = other.mBackgroundColor;
48 mForegroundColor = other.mForegroundColor;
49 mTextFormat = other.mTextFormat;
50 mFormat.reset( other.mFormat ? other.mFormat->clone() :
nullptr );
51 mHAlign = other.mHAlign;
52 mVAlign = other.mVAlign;
53 mRowSpan = other.mRowSpan;
54 mColumnSpan = other.mColumnSpan;
65 mFormat.reset( format );
71 res.insert( QStringLiteral(
"content" ), mContent );
72 res.insert( QStringLiteral(
"background" ), mBackgroundColor );
73 res.insert( QStringLiteral(
"foreground" ), mForegroundColor );
76 res.insert( QStringLiteral(
"format_type" ), mFormat->id() );
77 res.insert( QStringLiteral(
"format" ), mFormat->configuration( context ) );
80 if ( mTextFormat.isValid() )
83 const QDomElement textElem = mTextFormat.writeXml( textDoc, context );
84 textDoc.appendChild( textElem );
85 res.insert( QStringLiteral(
"text_format" ), textDoc.toString() );
88 res.insert( QStringLiteral(
"halign" ),
static_cast< int >( mHAlign ) );
89 res.insert( QStringLiteral(
"valign" ),
static_cast< int >( mVAlign ) );
91 res.insert( QStringLiteral(
"row_span" ), mRowSpan );
92 if ( mColumnSpan > 1 )
93 res.insert( QStringLiteral(
"column_span" ), mColumnSpan );
100 mContent =
properties.value( QStringLiteral(
"content" ) );
101 mBackgroundColor =
properties.value( QStringLiteral(
"background" ) ).value< QColor >();
102 mForegroundColor =
properties.value( QStringLiteral(
"foreground" ) ).value< QColor >();
106 const QString textXml =
properties.value( QStringLiteral(
"text_format" ) ).toString();
107 if ( !textXml.isEmpty() )
109 doc.setContent( textXml );
110 elem = doc.documentElement();
111 mTextFormat.readXml( elem, context );
118 if (
properties.contains( QStringLiteral(
"format_type" ) ) )
122 properties.value( QStringLiteral(
"format" ) ).toMap(),
130 mHAlign =
static_cast< Qt::Alignment
>(
properties.value( QStringLiteral(
"halign" ), Qt::AlignLeft ).toInt() );
131 mVAlign =
static_cast< Qt::Alignment
>(
properties.value( QStringLiteral(
"valign" ), Qt::AlignVCenter ).toInt() );
133 mRowSpan =
properties.value( QStringLiteral(
"row_span" ), 1 ).toInt();
134 mColumnSpan =
properties.value( QStringLiteral(
"column_span" ), 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.