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
This commit is contained in:
Peter Penz 2011-10-27 22:34:33 +02:00
parent 528262a6be
commit f63daef339
4 changed files with 19 additions and 10 deletions

View file

@ -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,

View file

@ -1190,13 +1190,15 @@ QList<QPair<int, QVariant> > 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);

View file

@ -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);

View file

@ -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 {