QFontMetrics::averageCharWidth() is quite slow and does not work
well on fonts with broken characters. In the
usecases required by Dolphin QFontMetrics::height() is a better
and faster alternative to get a font-dependent minimum width.
Thanks go to Christoph Feck for this hint!
qreal KItemListHeader::minimumRoleWidth() const
{
QFontMetricsF fontMetrics(font());
- return fontMetrics.averageCharWidth() * 8;
+ return fontMetrics.height() * 4;
}
#include "kitemlistheader_p.moc"
m_searchPath = url;
QFontMetrics metrics(m_fromHereButton->font());
- const int maxWidth = metrics.averageCharWidth() * 15;
+ const int maxWidth = metrics.height() * 8;
QString location = url.fileName();
if (location.isEmpty()) {