Commit 3403ba69 authored by Christoph Cullmann's avatar Christoph Cullmann

fix text vertical alignment

parent 8e2173bb
......@@ -52,15 +52,14 @@ void SPHtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
// draw area
QRect clip = options.widget->style()->subElementRect(QStyle::SE_ItemViewItemText, &options);
QFontMetrics metrics(options.font);
if (index.flags() == Qt::NoItemFlags) {
painter->setBrush(QBrush(QWidget().palette().color(QPalette::Base)));
painter->setPen(QWidget().palette().color(QPalette::Base));
painter->drawRect(QRect(clip.topLeft() - QPoint(20, metrics.descent()), clip.bottomRight()));
painter->translate(clip.topLeft() - QPoint(20, metrics.descent()));
painter->drawRect(QRect(clip.topLeft() - QPoint(20, 0), clip.bottomRight()));
painter->translate(clip.topLeft() - QPoint(20, 0));
}
else {
painter->translate(clip.topLeft() - QPoint(0, metrics.descent()));
painter->translate(clip.topLeft() - QPoint(0, 0));
}
QAbstractTextDocumentLayout::PaintContext pcontext;
doc.documentLayout()->draw(painter, pcontext);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment