fixed elided label when size is too small to draw anything

This commit is contained in:
csoler 2020-02-18 11:07:41 +01:00
parent 09c5d93631
commit 61083ff77a
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 6 additions and 2 deletions

View File

@ -200,7 +200,8 @@ bool ElidedLabel::paintElidedLine(QPainter& painter,QString plainText,const QRec
iTransX = 0;
}
painter.drawText(QPoint(iTransX + cr.left(), y + fontMetrics.ascent() + cr.top()), elidedLastLine);
if(width+iTransX+cr.left() <= cr.right())
painter.drawText(QPoint(iTransX + cr.left(), y + fontMetrics.ascent() + cr.top()), elidedLastLine);
//Draw button to get ToolTip
if(drawRoundRect)

View File

@ -263,7 +263,10 @@ void GxsIdTreeItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
launchAsyncLoading();
}
QPixmap pix = icon.pixmap(r.size());
QRect pixmaprect(r);
pixmaprect.adjust(r.height(),0,0,0);
QPixmap pix = icon.pixmap(pixmaprect.size());
const QPoint p = QPoint(r.height()/2.0, (r.height() - pix.height())/2);
// draw pixmap at center of item