@@ -43,8 +43,8 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
43
43
}
44
44
45
45
// getFeatureAttributes
46
- QList<QgsAttributeMap > attributeList;
47
- if ( !getFeatureAttributeMap ( attributeList ) )
46
+ QList<QgsAttributes > attributeList;
47
+ if ( !getFeatureAttributes ( attributeList ) )
48
48
{
49
49
return ;
50
50
}
@@ -56,6 +56,7 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
56
56
adaptItemFrame ( maxColumnWidthMap, attributeList );
57
57
58
58
drawBackground ( painter );
59
+ painter->setPen ( Qt::SolidLine );
59
60
60
61
// now draw the text
61
62
double currentX = mGridStrokeWidth ;
@@ -76,18 +77,16 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
76
77
currentY += mGridStrokeWidth ;
77
78
78
79
// draw the attribute values
79
- QList<QgsAttributeMap >::const_iterator attIt = attributeList.begin ();
80
+ QList<QgsAttributes >::const_iterator attIt = attributeList.begin ();
80
81
for ( ; attIt != attributeList.end (); ++attIt )
81
82
{
82
83
currentY += fontAscentMillimeters ( mContentFont );
83
84
currentY += mLineTextDistance ;
84
85
85
- QgsAttributeMap currentAttributeMap = *attIt;
86
- QgsAttributeMap::const_iterator attMapIt = currentAttributeMap.find ( columnIt.key () );
87
- if ( attMapIt != currentAttributeMap.constEnd () )
88
- {
89
- drawText ( painter, currentX, currentY, attMapIt.value ().toString (), mContentFont );
90
- }
86
+ QgsAttributes currentAttributeMap = *attIt;
87
+ int debug = columnIt.key ();
88
+ QString str = currentAttributeMap.at ( columnIt.key () ).toString ();
89
+ drawText ( painter, currentX, currentY, str, mContentFont );
91
90
currentY += mLineTextDistance ;
92
91
currentY += mGridStrokeWidth ;
93
92
}
@@ -118,8 +117,8 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
118
117
119
118
void QgsComposerTable::adjustFrameToSize ()
120
119
{
121
- QList<QgsAttributeMap > attributes;
122
- if ( !getFeatureAttributeMap ( attributes ) )
120
+ QList<QgsAttributes > attributes;
121
+ if ( !getFeatureAttributes ( attributes ) )
123
122
{
124
123
return ;
125
124
}
@@ -174,7 +173,7 @@ bool QgsComposerTable::tableReadXML( const QDomElement& itemElem, const QDomDocu
174
173
return true ;
175
174
}
176
175
177
- bool QgsComposerTable::calculateMaxColumnWidths ( QMap<int , double >& maxWidthMap, const QList<QgsAttributeMap >& attributeList ) const
176
+ bool QgsComposerTable::calculateMaxColumnWidths ( QMap<int , double >& maxWidthMap, const QList<QgsAttributes >& attributeList ) const
178
177
{
179
178
maxWidthMap.clear ();
180
179
QMap<int , QString> headerMap = getHeaderLabels ();
@@ -185,21 +184,19 @@ bool QgsComposerTable::calculateMaxColumnWidths( QMap<int, double>& maxWidthMap,
185
184
}
186
185
187
186
// go through all the attributes and adapt the max width values
188
- QList<QgsAttributeMap >::const_iterator attIt = attributeList.constBegin ();
187
+ QList<QgsAttributes >::const_iterator attIt = attributeList.constBegin ();
189
188
190
189
QgsAttributeMap currentAttributeMap;
191
190
double currentAttributeTextWidth;
192
191
193
192
for ( ; attIt != attributeList.constEnd (); ++attIt )
194
193
{
195
- currentAttributeMap = *attIt;
196
- QgsAttributeMap::const_iterator attMapIt = currentAttributeMap.constBegin ();
197
- for ( ; attMapIt != currentAttributeMap.constEnd (); ++attMapIt )
194
+ for ( int i = 0 ; i < attIt->size (); ++i )
198
195
{
199
- currentAttributeTextWidth = textWidthMillimeters ( mContentFont , attMapIt. value ( ).toString () );
200
- if ( currentAttributeTextWidth > maxWidthMap[attMapIt. key () ] )
196
+ currentAttributeTextWidth = textWidthMillimeters ( mContentFont , attIt-> at ( i ).toString () );
197
+ if ( currentAttributeTextWidth > maxWidthMap[i ] )
201
198
{
202
- maxWidthMap[attMapIt. key () ] = currentAttributeTextWidth;
199
+ maxWidthMap[i ] = currentAttributeTextWidth;
203
200
}
204
201
}
205
202
}
@@ -210,7 +207,7 @@ bool QgsComposerTable::calculateMaxColumnWidths( QMap<int, double>& maxWidthMap,
210
207
211
208
212
209
213
- void QgsComposerTable::adaptItemFrame ( const QMap<int , double >& maxWidthMap, const QList<QgsAttributeMap >& attributeList )
210
+ void QgsComposerTable::adaptItemFrame ( const QMap<int , double >& maxWidthMap, const QList<QgsAttributes >& attributeList )
214
211
{
215
212
// calculate height
216
213
double totalHeight = fontAscentMillimeters ( mHeaderFont ) + attributeList.size () * fontAscentMillimeters ( mContentFont )
0 commit comments