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 )
34 , mRowSpan( other.mRowSpan )
35 , mColumnSpan( other.mColumnSpan )
42 mContent = other.mContent;
43 mBackgroundColor = other.mBackgroundColor;
44 mForegroundColor = other.mForegroundColor;
45 mTextFormat = other.mTextFormat;
46 mFormat.reset( other.mFormat ? other.mFormat->clone() : nullptr );
47 mHAlign = other.mHAlign;
48 mVAlign = other.mVAlign;
49 mRowSpan = other.mRowSpan;
50 mColumnSpan = other.mColumnSpan;
61 mFormat.reset( format );
67 res.insert( QStringLiteral(
"content" ), mContent );
68 res.insert( QStringLiteral(
"background" ), mBackgroundColor );
69 res.insert( QStringLiteral(
"foreground" ), mForegroundColor );
72 res.insert( QStringLiteral(
"format_type" ), mFormat->id() );
73 res.insert( QStringLiteral(
"format" ), mFormat->configuration( context ) );
79 const QDomElement textElem = mTextFormat.
writeXml( textDoc, context );
80 textDoc.appendChild( textElem );
81 res.insert( QStringLiteral(
"text_format" ), textDoc.toString() );
84 res.insert( QStringLiteral(
"halign" ),
static_cast< int >( mHAlign ) );
85 res.insert( QStringLiteral(
"valign" ),
static_cast< int >( mVAlign ) );
87 res.insert( QStringLiteral(
"row_span" ), mRowSpan );
88 if ( mColumnSpan > 1 )
89 res.insert( QStringLiteral(
"column_span" ), mColumnSpan );
96 mContent =
properties.value( QStringLiteral(
"content" ) );
97 mBackgroundColor =
properties.value( QStringLiteral(
"background" ) ).value< QColor >();
98 mForegroundColor =
properties.value( QStringLiteral(
"foreground" ) ).value< QColor >();
102 const QString textXml =
properties.value( QStringLiteral(
"text_format" ) ).toString();
103 if ( !textXml.isEmpty() )
105 doc.setContent( textXml );
106 elem = doc.documentElement();
107 mTextFormat.
readXml( elem, context );
114 if (
properties.contains( QStringLiteral(
"format_type" ) ) )
118 properties.value( QStringLiteral(
"format" ) ).toMap(),
126 mHAlign =
static_cast< Qt::Alignment
>(
properties.value( QStringLiteral(
"halign" ), Qt::AlignLeft ).toInt() );
127 mVAlign =
static_cast< Qt::Alignment
>(
properties.value( QStringLiteral(
"valign" ), Qt::AlignVCenter ).toInt() );
129 mRowSpan =
properties.value( QStringLiteral(
"row_span" ), 1 ).toInt();
130 mColumnSpan =
properties.value( QStringLiteral(
"column_span" ), 1 ).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.
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.
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.
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.