diff options
| author | Frank Reininghaus <[email protected]> | 2014-08-12 09:23:24 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2014-08-12 09:23:24 +0200 |
| commit | 4b70446c17dff6646c11966670bcbe145d07c685 (patch) | |
| tree | cb27da78c14dfb8338c089883b240fbfc0a356f5 /src | |
| parent | 38381bc6a2999b1d8a0b8a6e2b8d703faa0944d9 (diff) | |
| parent | bf1ac8ee9b2edcf9e90f74bae7f392c1b3c318b2 (diff) | |
Merge branch 'KDE/4.14'
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphintabpage.cpp | 4 | ||||
| -rw-r--r-- | src/kitemviews/kstandarditemlistwidget.cpp | 24 | ||||
| -rw-r--r-- | src/views/dolphinview.cpp | 4 |
3 files changed, 23 insertions, 9 deletions
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index d1184a9f2..23e33c958 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -187,6 +187,10 @@ QByteArray DolphinTabPage::saveState() const void DolphinTabPage::restoreState(const QByteArray& state) { + if (state.isEmpty()) { + return; + } + QByteArray sd = state; QDataStream stream(&sd, QIODevice::ReadOnly); diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index 998acc066..6407efc22 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -1136,14 +1136,24 @@ void KStandardItemListWidget::updateIconsLayoutTextCache() const int textLength = line.textStart() + line.textLength(); if (textLength < nameText.length()) { // Elide the last line of the text - QString lastTextLine = nameText.mid(line.textStart()); - lastTextLine = m_customizedFontMetrics.elidedText(lastTextLine, - Qt::ElideRight, - maxWidth); - const QString elidedText = nameText.left(line.textStart()) + lastTextLine; - nameTextInfo->staticText.setText(elidedText); + qreal elidingWidth = maxWidth; + qreal lastLineWidth; + do { + QString lastTextLine = nameText.mid(line.textStart()); + lastTextLine = m_customizedFontMetrics.elidedText(lastTextLine, + Qt::ElideRight, + elidingWidth); + const QString elidedText = nameText.left(line.textStart()) + lastTextLine; + nameTextInfo->staticText.setText(elidedText); + + lastLineWidth = m_customizedFontMetrics.boundingRect(lastTextLine).width(); + + // We do the text eliding in a loop with decreasing width (1 px / iteration) + // to avoid problems related to different width calculation code paths + // within Qt. (see bug 337104) + elidingWidth -= 1.0; + } while (lastLineWidth > maxWidth); - const qreal lastLineWidth = m_customizedFontMetrics.boundingRect(lastTextLine).width(); nameWidth = qMax(nameWidth, lastLineWidth); } break; diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index c1f585da9..02b8815e0 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1289,11 +1289,11 @@ void DolphinView::updateViewState() m_view->scrollToItem(currentIndex); m_scrollToCurrentItem = false; } - - m_currentItemUrl = KUrl(); } else { selectionManager->setCurrentItem(0); } + + m_currentItemUrl = KUrl(); } if (!m_restoredContentsPosition.isNull()) { |
