31 QDomElement bgColorElem = doc.createElement( QStringLiteral(
"backgroundColor" ) );
32 bgColorElem.setAttribute( QStringLiteral(
"red" ), QString::number( mBackgroundColor.red() ) );
33 bgColorElem.setAttribute( QStringLiteral(
"green" ), QString::number( mBackgroundColor.green() ) );
34 bgColorElem.setAttribute( QStringLiteral(
"blue" ), QString::number( mBackgroundColor.blue() ) );
35 bgColorElem.setAttribute( QStringLiteral(
"alpha" ), QString::number( mBackgroundColor.alpha() ) );
36 columnElem.appendChild( bgColorElem );
38 columnElem.setAttribute( QStringLiteral(
"hAlignment" ), mHAlignment );
39 columnElem.setAttribute( QStringLiteral(
"vAlignment" ), mVAlignment );
41 columnElem.setAttribute( QStringLiteral(
"heading" ), mHeading );
42 columnElem.setAttribute( QStringLiteral(
"attribute" ), mAttribute );
44 columnElem.setAttribute( QStringLiteral(
"sortByRank" ), QString::number( mSortByRank ) );
45 columnElem.setAttribute( QStringLiteral(
"sortOrder" ), QString::number( mSortOrder ) );
47 columnElem.setAttribute( QStringLiteral(
"width" ), QString::number( mWidth ) );
54 mHAlignment =
static_cast< Qt::AlignmentFlag
>( columnElem.attribute( QStringLiteral(
"hAlignment" ), QString::number( Qt::AlignLeft ) ).toInt() );
55 mVAlignment =
static_cast< Qt::AlignmentFlag
>( columnElem.attribute( QStringLiteral(
"vAlignment" ), QString::number( Qt::AlignVCenter ) ).toInt() );
56 mHeading = columnElem.attribute( QStringLiteral(
"heading" ), QString() );
57 mAttribute = columnElem.attribute( QStringLiteral(
"attribute" ), QString() );
58 mSortByRank = columnElem.attribute( QStringLiteral(
"sortByRank" ), QStringLiteral(
"0" ) ).toInt();
59 mSortOrder =
static_cast< Qt::SortOrder
>( columnElem.attribute( QStringLiteral(
"sortOrder" ), QString::number( Qt::AscendingOrder ) ).toInt() );
60 mWidth = columnElem.attribute( QStringLiteral(
"width" ), QStringLiteral(
"0.0" ) ).toDouble();
62 const QDomNodeList bgColorList = columnElem.elementsByTagName( QStringLiteral(
"backgroundColor" ) );
63 if ( !bgColorList.isEmpty() )
65 const QDomElement bgColorElem = bgColorList.at( 0 ).toElement();
66 bool redOk, greenOk, blueOk, alphaOk;
67 int bgRed, bgGreen, bgBlue, bgAlpha;
68 bgRed = bgColorElem.attribute( QStringLiteral(
"red" ) ).toDouble( &redOk );
69 bgGreen = bgColorElem.attribute( QStringLiteral(
"green" ) ).toDouble( &greenOk );
70 bgBlue = bgColorElem.attribute( QStringLiteral(
"blue" ) ).toDouble( &blueOk );
71 bgAlpha = bgColorElem.attribute( QStringLiteral(
"alpha" ) ).toDouble( &alphaOk );
72 if ( redOk && greenOk && blueOk && alphaOk )
74 mBackgroundColor = QColor( bgRed, bgGreen, bgBlue, bgAlpha );