mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Use QFontMetrics::height() instead of averageCharWidth()
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!
This commit is contained in:
parent
b1f6a546aa
commit
16d4f059c3
2 changed files with 2 additions and 2 deletions
|
@ -337,7 +337,7 @@ bool KItemListHeader::isAboveRoleGrip(const QPointF& pos, int roleIndex) const
|
|||
qreal KItemListHeader::minimumRoleWidth() const
|
||||
{
|
||||
QFontMetricsF fontMetrics(font());
|
||||
return fontMetrics.averageCharWidth() * 8;
|
||||
return fontMetrics.height() * 4;
|
||||
}
|
||||
|
||||
#include "kitemlistheader_p.moc"
|
||||
|
|
|
@ -91,7 +91,7 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
|
|||
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()) {
|
||||
|
|
Loading…
Reference in a new issue