┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-11-18 22:04:26 +0100
committerPeter Penz <[email protected]>2011-11-18 22:05:32 +0100
commitba0c58c2213de28db158ae81318d9c328952fdec (patch)
tree88654d97ddb8bdc8a3f17ff7a27a27bdea00f9f7
parentfdab9ee644c57d2039dd7bc6dfc3fbd8a75d13fa (diff)
Fix wrong position of selection-toggle
When switching between view-modes the selection-toggle sometimes had a wrong position.
-rw-r--r--src/kitemviews/kfileitemlistwidget.cpp14
-rw-r--r--src/kitemviews/kfileitemlistwidget.h2
2 files changed, 2 insertions, 14 deletions
diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp
index a4c18e404..5a522f410 100644
--- a/src/kitemviews/kfileitemlistwidget.cpp
+++ b/src/kitemviews/kfileitemlistwidget.cpp
@@ -58,8 +58,7 @@ KFileItemListWidget::KFileItemListWidget(QGraphicsItem* parent) :
m_expansionArea(),
m_customTextColor(),
m_additionalInfoTextColor(),
- m_overlay(),
- m_selectionTogglePos()
+ m_overlay()
{
for (int i = 0; i < TextIdCount; ++i) {
m_text[i].setTextFormat(Qt::PlainText);
@@ -186,7 +185,7 @@ QRectF KFileItemListWidget::selectionToggleRect() const
toggleSize = KIconLoader::SizeSmallMedium;
}
- QPointF pos = m_selectionTogglePos;
+ QPointF pos = iconRect().topLeft();
// If the selection toggle has a very small distance to the
// widget borders, the size of the selection toggle will get
@@ -429,10 +428,6 @@ void KFileItemListWidget::updatePixmapCache()
}
if (updatePixmap) {
- // The selection toggle should always be applied to the top/left
- // of the pixmap
- m_selectionTogglePos = QPointF(-option.margin, -option.margin);
-
m_pixmap = values["iconPixmap"].value<QPixmap>();
if (m_pixmap.isNull()) {
// Use the icon that fits to the MIME-type
@@ -470,7 +465,6 @@ void KFileItemListWidget::updatePixmapCache()
y = (iconHeight - m_pixmap.height()) / 2; // Center vertically
painter.drawPixmap(x, y, m_pixmap);
}
- m_selectionTogglePos += QPointF(x, y);
m_pixmap = squarePixmap;
} else {
@@ -493,10 +487,6 @@ void KFileItemListWidget::updatePixmapCache()
}
m_pixmapPos.setY(option.margin);
- if (updatePixmap) {
- m_selectionTogglePos += m_pixmapPos;
- }
-
// Center the hover rectangle horizontally and align it on bottom
const qreal x = m_pixmapPos.x() + (m_scaledPixmapSize.width() - m_hoverPixmapRect.width()) / 2.0;
const qreal y = m_pixmapPos.y() + m_scaledPixmapSize.height() - m_hoverPixmapRect.height();
diff --git a/src/kitemviews/kfileitemlistwidget.h b/src/kitemviews/kfileitemlistwidget.h
index 7c7ecf883..3e47b567b 100644
--- a/src/kitemviews/kfileitemlistwidget.h
+++ b/src/kitemviews/kfileitemlistwidget.h
@@ -144,8 +144,6 @@ private:
QColor m_additionalInfoTextColor;
QPixmap m_overlay;
-
- QPointF m_selectionTogglePos;
};
#endif