21 mBackgroundColor( Qt::transparent ),
22 mHAlignment( Qt::AlignLeft ),
24 mSortOrder( Qt::AscendingOrder )
37 QDomElement bgColorElem = doc.createElement(
"backgroundColor" );
38 bgColorElem.setAttribute(
"red", QString::number(
mBackgroundColor.red() ) );
39 bgColorElem.setAttribute(
"green", QString::number(
mBackgroundColor.green() ) );
40 bgColorElem.setAttribute(
"blue", QString::number(
mBackgroundColor.blue() ) );
41 bgColorElem.setAttribute(
"alpha", QString::number(
mBackgroundColor.alpha() ) );
42 columnElem.appendChild( bgColorElem );
44 columnElem.setAttribute(
"hAlignment",
mHAlignment );
46 columnElem.setAttribute(
"heading",
mHeading );
47 columnElem.setAttribute(
"attribute",
mAttribute );
49 columnElem.setAttribute(
"sortByRank", QString::number(
mSortByRank ) );
50 columnElem.setAttribute(
"sortOrder", QString::number(
mSortOrder ) );
57 mHAlignment = ( Qt::AlignmentFlag )columnElem.attribute(
"hAlignment", QString::number( Qt::AlignLeft ) ).toInt();
58 mHeading = columnElem.attribute(
"heading",
"" );
59 mAttribute = columnElem.attribute(
"attribute",
"" );
60 mSortByRank = columnElem.attribute(
"sortByRank",
"0" ).toInt();
61 mSortOrder = ( Qt::SortOrder )columnElem.attribute(
"sortOrder", QString::number( Qt::AscendingOrder ) ).toInt();
63 QDomNodeList bgColorList = columnElem.elementsByTagName(
"backgroundColor" );
64 if ( bgColorList.size() > 0 )
66 QDomElement bgColorElem = bgColorList.at( 0 ).toElement();
67 bool redOk, greenOk, blueOk, alphaOk;
68 int bgRed, bgGreen, bgBlue, bgAlpha;
69 bgRed = bgColorElem.attribute(
"red" ).toDouble( &redOk );
70 bgGreen = bgColorElem.attribute(
"green" ).toDouble( &greenOk );
71 bgBlue = bgColorElem.attribute(
"blue" ).toDouble( &blueOk );
72 bgAlpha = bgColorElem.attribute(
"alpha" ).toDouble( &alphaOk );
73 if ( redOk && greenOk && blueOk && alphaOk )
virtual ~QgsComposerTableColumn()
virtual bool writeXML(QDomElement &columnElem, QDomDocument &doc) const
Writes the column's properties to xml for storage.
void setAttribute(QString attribute)
Sets the attribute name or expression used for the column's values.
void setHeading(QString heading)
Sets the heading for a column, which is the value displayed in the columns header cell...
QgsComposerTableColumn * clone()
Creates a duplicate column which is a deep copy of this column.
void setHAlignment(Qt::AlignmentFlag alignment)
Sets the horizontal alignment for a column, which controls the alignment used for drawing column valu...
Stores properties of a column in a QgsComposerTable.
void setSortOrder(Qt::SortOrder sortOrder)
Sets the sort order for the column.
Qt::AlignmentFlag mHAlignment
virtual bool readXML(const QDomElement &columnElem)
Reads the column's properties from xml.
void setSortByRank(int sortByRank)
Sets the sort rank for the column.