From: Peter Penz Date: Thu, 27 Oct 2011 20:34:33 +0000 (+0200) Subject: Fix minor visual issues in the view-engine X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/f63daef339dde16c7ef598f6fdaa5d2191da4685 Fix minor visual issues in the view-engine - Increasing the window-size should not result in increasing the size from previously invisible items - Rename group 'Numerics' to '0 - 9' - Fix "damaged" icons when changing the view-sizes or changing the view-mode --- diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index f6039b7a5..5f659a1f6 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -694,7 +694,7 @@ void KFileItemListWidget::updateAdditionalInfoTextColor() // is not used as this might lead to unreadable text for some color schemes. Instead // the text color is slightly mixed with the background color. const QColor c1 = textColor(); - const QColor c2 = styleOption().palette.background().color(); + const QColor c2 = styleOption().palette.base().color(); const int p1 = 70; const int p2 = 100 - p1; m_additionalInfoTextColor = QColor((c1.red() * p1 + c2.red() * p2) / 100, diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 5ccca5a94..272654872 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -1190,13 +1190,15 @@ QList > KFileItemModel::nameRoleGroups() const newGroupValue = newFirstChar; isLetter = true; } else if (newFirstChar >= QLatin1Char('0') && newFirstChar <= QLatin1Char('9')) { - // Apply group 'Numerics' for any name that starts with a digit - newGroupValue = i18nc("@title:group", "Numerics"); + // Apply group '0 - 9' for any name that starts with a digit + newGroupValue = i18nc("@title:group Groups that start with a digit", "0 - 9"); isLetter = false; } else { if (isLetter) { // If the current group is 'A' - 'Z' check whether a locale character // fits into the existing group. + // TODO: This does not work in the case if e.g. the group 'O' starts with + // an umlaut 'O' -> provide unit-test to document this known issue const QChar prevChar(firstChar.unicode() - ushort(1)); const QChar nextChar(firstChar.unicode() + ushort(1)); const QString currChar(newFirstChar); diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 84b844084..478bf6260 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -1423,8 +1423,9 @@ void KItemListView::prepareLayoutForIncreasedItemCount(const QSizeF& size, SizeT for (int i = minFirst; i <= maxLast; ++i) { if (!m_visibleItems.contains(i)) { KItemListWidget* widget = createWidget(i); - const QPointF pos = m_layouter->itemRect(i).topLeft(); - widget->setPos(pos); + const QRectF itemRect = m_layouter->itemRect(i); + widget->setPos(itemRect.topLeft()); + widget->resize(itemRect.size()); } } setLayouterSize(size, sizeType); diff --git a/src/kitemviews/kpixmapmodifier.cpp b/src/kitemviews/kpixmapmodifier.cpp index 07c5286d7..f6838c032 100644 --- a/src/kitemviews/kpixmapmodifier.cpp +++ b/src/kitemviews/kpixmapmodifier.cpp @@ -327,13 +327,19 @@ namespace { void KPixmapModifier::scale(QPixmap& pixmap, const QSize& scaledSize) { + if (scaledSize.isEmpty()) { + pixmap = QPixmap(); + return; + } + #if defined(Q_WS_X11) && defined(HAVE_XRENDER) // Assume that the texture size limit is 2048x2048 if ((pixmap.width() <= 2048) && (pixmap.height() <= 2048) && pixmap.x11PictureHandle()) { + const QPixmap unscaledPixmap = pixmap.copy(); // Make a deep copy for XRender QSize scaledPixmapSize = pixmap.size(); scaledPixmapSize.scale(scaledSize, Qt::KeepAspectRatio); - const qreal factor = scaledPixmapSize.width() / qreal(pixmap.width()); + const qreal factor = scaledPixmapSize.width() / qreal(unscaledPixmap.width()); XTransform xform = {{ { XDoubleToFixed(1 / factor), 0, 0 }, @@ -348,11 +354,11 @@ void KPixmapModifier::scale(QPixmap& pixmap, const QSize& scaledSize) XRenderPictureAttributes attr; attr.repeat = RepeatPad; - XRenderChangePicture(dpy, pixmap.x11PictureHandle(), CPRepeat, &attr); + XRenderChangePicture(dpy, unscaledPixmap.x11PictureHandle(), CPRepeat, &attr); - XRenderSetPictureFilter(dpy, pixmap.x11PictureHandle(), FilterBilinear, 0, 0); - XRenderSetPictureTransform(dpy, pixmap.x11PictureHandle(), &xform); - XRenderComposite(dpy, PictOpOver, pixmap.x11PictureHandle(), None, scaledPixmap.x11PictureHandle(), + XRenderSetPictureFilter(dpy, unscaledPixmap.x11PictureHandle(), FilterBilinear, 0, 0); + XRenderSetPictureTransform(dpy, unscaledPixmap.x11PictureHandle(), &xform); + XRenderComposite(dpy, PictOpOver, unscaledPixmap.x11PictureHandle(), None, scaledPixmap.x11PictureHandle(), 0, 0, 0, 0, 0, 0, scaledPixmap.width(), scaledPixmap.height()); pixmap = scaledPixmap; } else {