Commit ab8ba956 authored by Laurent Montel's avatar Laurent Montel 😁

Don't try to draw description if it"s empty

parent f8d9b028
Pipeline #34236 failed with stage
in 5 minutes and 49 seconds
......@@ -96,10 +96,12 @@ void StyleContactListDelegate::paint(QPainter *painter, const QStyleOptionViewIt
painter->drawText(nameTextRect, Qt::AlignLeft | Qt::AlignVCenter,
painter->fontMetrics().elidedText(name, Qt::ElideRight, nameTextRect.width()));
painter->setFont(QFont(option.font.family(), 8, -1, true));
const QString description = index.data(ContactInfoProxyModel::Roles::DescriptionRole).value<QString>();
if (!description.isEmpty()) {
painter->setFont(QFont(option.font.family(), 8, -1, true));
painter->drawText(descriptionTextRect, Qt::AlignLeft | Qt::AlignVCenter,
painter->fontMetrics().elidedText(description, Qt::ElideRight, descriptionTextRect.width()));
}
return;
}
QStyledItemDelegate::paint(painter, option, index);
......
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