┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/selectionmanager.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-09-22 19:12:09 +0000
committerPeter Penz <[email protected]>2010-09-22 19:12:09 +0000
commitabefc8663ac5c9dc15ad08408e224b3a3cef3b6f (patch)
tree92907c9753ab9ec2718e2eb78531a6c984ffb8cd /src/views/selectionmanager.cpp
parent5517e4cf10c8aee590b404072aebaffb55bafec3 (diff)
Add a small invisible margin to the selection toggle in case the item-height is nearly equal to the toggle-height. This prevents an accidental execution of application in the details-view with the default icon-size.
BUG: 169494 FIXED-IN: 4.6.0 svn path=/trunk/KDE/kdebase/apps/; revision=1178332
Diffstat (limited to 'src/views/selectionmanager.cpp')
-rw-r--r--src/views/selectionmanager.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/views/selectionmanager.cpp b/src/views/selectionmanager.cpp
index ac5f1c939..7353e5a39 100644
--- a/src/views/selectionmanager.cpp
+++ b/src/views/selectionmanager.cpp
@@ -94,27 +94,27 @@ void SelectionManager::slotEntered(const QModelIndex& index)
m_connected = true;
}
- // increase the size of the toggle for large items
- const int height = m_view->iconSize().height();
- if (height >= KIconLoader::SizeEnormous) {
- m_toggle->resize(KIconLoader::SizeMedium, KIconLoader::SizeMedium);
- } else if (height >= KIconLoader::SizeLarge) {
- m_toggle->resize(KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium);
- } else {
- m_toggle->resize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
+ // Increase the size of the toggle for large items
+ const int iconHeight = m_view->iconSize().height();
+
+ int toggleSize = KIconLoader::SizeSmall;
+ if (iconHeight >= KIconLoader::SizeEnormous) {
+ toggleSize = KIconLoader::SizeMedium;
+ } else if (iconHeight >= KIconLoader::SizeLarge) {
+ toggleSize = KIconLoader::SizeSmallMedium;
}
+ // Add a small invisible margin, if the item-height is nearly
+ // equal to the toggleSize (#169494).
const QRect rect = m_view->visualRect(index);
- int x = rect.left();
- int y = rect.top();
- if (height < KIconLoader::SizeSmallMedium) {
- // The height is nearly equal to the smallest toggle height.
- // Assure that the toggle is vertically centered instead
- // of aligned on the top and gets more horizontal gap.
- x += 2;
- y += (rect.height() - m_toggle->height()) / 2;
+ int margin = (rect.height() - toggleSize) / 2;
+ if (margin > 4) {
+ margin = 0;
}
- m_toggle->move(QPoint(x, y));
+ toggleSize += 2 * margin;
+ m_toggle->setMargin(margin);
+ m_toggle->resize(toggleSize, toggleSize);
+ m_toggle->move(rect.topLeft());
QItemSelectionModel* selModel = m_view->selectionModel();
m_toggle->setChecked(selModel->isSelected(index));