Changeset View
Changeset View
Standalone View
Standalone View
src/statusbar/dolphinstatusbar.cpp
Show First 20 Lines • Show All 317 Lines • ▼ Show 20 Line(s) | |||||
318 | } | 318 | } | ||
319 | 319 | | |||
320 | void DolphinStatusBar::updateLabelText() | 320 | void DolphinStatusBar::updateLabelText() | ||
321 | { | 321 | { | ||
322 | const QString text = m_text.isEmpty() ? m_defaultText : m_text; | 322 | const QString text = m_text.isEmpty() ? m_defaultText : m_text; | ||
323 | 323 | | |||
324 | // Set status bar text and elide it if too long | 324 | // Set status bar text and elide it if too long | ||
325 | QFontMetrics fontMetrics(m_label->font()); | 325 | QFontMetrics fontMetrics(m_label->font()); | ||
326 | const QString elidedText = fontMetrics.elidedText(text, Qt::ElideRight, m_label->width()); | 326 | const QString elidedText = fontMetrics.elidedText(text, Qt::ElideMiddle, m_label->width()); | ||
327 | m_label->setText(elidedText); | 327 | m_label->setText(elidedText); | ||
328 | 328 | | |||
329 | // If the text has been elided, set the original text as tooltip | 329 | // If the text has been elided, set the original text as tooltip | ||
330 | if (text != elidedText) { | 330 | if (text != elidedText) { | ||
331 | m_label->setToolTip(Qt::convertFromPlainText(text)); | 331 | m_label->setToolTip(Qt::convertFromPlainText(text)); | ||
332 | } else { | 332 | } else { | ||
333 | m_label->setToolTip(QString()); | 333 | m_label->setToolTip(QString()); | ||
334 | } | 334 | } | ||
Show All 26 Lines |