@@ -54,7 +54,7 @@ TableHeaderView::TableHeaderView(QWidget *parent) : QHeaderView(Qt::Horizontal,
54
54
55
55
// Height of the header
56
56
QFontMetrics fm (this ->font ());
57
- _height = ( fm.height () + MARGIN ) * 2 ;
57
+ _height = fm.height () * 2 ;
58
58
}
59
59
60
60
TableHeaderView::~TableHeaderView ()
@@ -203,7 +203,7 @@ void TableHeaderView::paintSection(QPainter *painter, const QRect &rect, int log
203
203
textRect.setWidth (textRect.width () - 2 * MARGIN);
204
204
if (iconRect.width () > 0 )
205
205
textRect.setWidth (textRect.width () - iconRect.width () - MARGIN);
206
- textRect.translate (MARGIN, MARGIN );
206
+ textRect.translate (MARGIN, 0 );
207
207
208
208
// Adapt the text
209
209
QString adaptedText = text;
@@ -213,8 +213,6 @@ void TableHeaderView::paintSection(QPainter *painter, const QRect &rect, int log
213
213
lengthLine1--;
214
214
if (lengthLine1 < text.length ())
215
215
adaptedText = text.left (lengthLine1) + " \n " + fm.elidedText (text.mid (lengthLine1), Qt::ElideRight, textRect.width ());
216
- else
217
- textRect.translate (0 , fm.height () / 2 );
218
216
219
217
// First draw the cell without text or icon for the background and border
220
218
this ->model ()->setHeaderData (logicalIndex, this ->orientation (), " " , Qt::DisplayRole);
@@ -228,7 +226,7 @@ void TableHeaderView::paintSection(QPainter *painter, const QRect &rect, int log
228
226
if (foregroundBrush.canConvert <QBrush>())
229
227
painter->setPen (foregroundBrush.value <QBrush>().color ());
230
228
painter->setClipRect (rect);
231
- painter->drawText (textRect, Qt::AlignHCenter , adaptedText);
229
+ painter->drawText (textRect, Qt::AlignCenter , adaptedText);
232
230
233
231
// Finally draw the icon on the right and vertically centered
234
232
int iconHeight = iconRect.height ();
0 commit comments