Changeset View
Changeset View
Standalone View
Standalone View
krusader/GUI/kcmdline.cpp
Context not available. | |||||
88 | { | 88 | { | ||
---|---|---|---|---|---|
89 | QString pathNameLabel = _path; | 89 | QString pathNameLabel = _path; | ||
90 | QFontMetrics fm(_pathLabel->fontMetrics()); | 90 | QFontMetrics fm(_pathLabel->fontMetrics()); | ||
91 | #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) | ||||
92 | int textWidth = fm.horizontalAdvance(_path); | ||||
93 | #else | ||||
91 | int textWidth = fm.width(_path); | 94 | int textWidth = fm.width(_path); | ||
95 | #endif | ||||
92 | int maxWidth = (width() + _pathLabel->width()) * 2 / 5; | 96 | int maxWidth = (width() + _pathLabel->width()) * 2 / 5; | ||
93 | int letters = _path.length() / 2; | 97 | int letters = _path.length() / 2; | ||
94 | 98 | | |||
95 | while (letters && textWidth > maxWidth) { | 99 | while (letters && textWidth > maxWidth) { | ||
96 | pathNameLabel = _path.left(letters) + "..." + _path.right(letters); | 100 | pathNameLabel = _path.left(letters) + "..." + _path.right(letters); | ||
97 | letters--; | 101 | letters--; | ||
102 | #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) | ||||
103 | textWidth = fm.horizontalAdvance(pathNameLabel); | ||||
104 | #else | ||||
98 | textWidth = fm.width(pathNameLabel); | 105 | textWidth = fm.width(pathNameLabel); | ||
106 | #endif | ||||
99 | } | 107 | } | ||
100 | 108 | | |||
101 | _pathLabel->setText(pathNameLabel + "> "); | 109 | _pathLabel->setText(pathNameLabel + "> "); | ||
Context not available. |