]> cloud.milkyroute.net Git - dolphin.git/commitdiff
dolphin: Escape text in statusbar tooltip
authorFabio D'Urso <fabiodurso@hotmail.it>
Thu, 1 Aug 2013 12:17:26 +0000 (14:17 +0200)
committerFabio D'Urso <fabiodurso@hotmail.it>
Mon, 5 Aug 2013 00:12:09 +0000 (02:12 +0200)
This fixes the same issue as 4450f8449af91e491636728a4669e2a9e27b49fa,
but for the status bar's tooltip text.

BUG: 323170
FIXED-IN: 4.11.0
REVIEW: 111836

src/statusbar/dolphinstatusbar.cpp

index 14891917208ed4ef665c5f79e27d93694a8d8b48..bff95664204b6941ee1da1a33b7d195c7572c4fe 100644 (file)
@@ -34,6 +34,7 @@
 #include <QHBoxLayout>
 #include <QLabel>
 #include <QProgressBar>
+#include <QTextDocument>
 #include <QToolButton>
 #include <QTime>
 #include <QTimer>
@@ -324,10 +325,17 @@ void DolphinStatusBar::updateLabelText()
 {
     const QString text = m_text.isEmpty() ? m_defaultText : m_text;
 
+    // Set status bar text and elide it if too long
     QFontMetrics fontMetrics(m_label->font());
     const QString elidedText = fontMetrics.elidedText(text, Qt::ElideRight, m_label->width());
     m_label->setText(elidedText);
-    m_label->setToolTip(text == elidedText ? QString() : text);
+
+    // If the text has been elided, set the original text as tooltip
+    if (text != elidedText) {
+        m_label->setToolTip(Qt::convertFromPlainText(text));
+    } else {
+        m_label->setToolTip(QString());
+    }
 }
 
 void DolphinStatusBar::slotResetToDefaultText()