mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-03 01:23:49 +00:00
91 lines
3.4 KiB
Diff
91 lines
3.4 KiB
Diff
qt-bugs@ issue : 23919
|
|
applied: no
|
|
author: Pascal Létourneau <pletourn@globetrotter.net>
|
|
|
|
This patch modifies the behavior of the rubber selection.
|
|
Now Shift-rubber behaves like the old Ctrl-rubber.
|
|
And now Ctrl-rubber toggles the state of the icons.
|
|
This is more consistant with other iconview (Nautilus, Win Explorer, ...)
|
|
and with Qt itself (Ctrl-click toggle the state of an icon).
|
|
|
|
Index: src/iconview/qiconview.cpp
|
|
===================================================================
|
|
RCS file: /home/kde/qt-copy/src/iconview/qiconview.cpp,v
|
|
retrieving revision 1.48
|
|
diff -u -3 -p -r1.48 qiconview.cpp
|
|
--- src/iconview/qiconview.cpp 23 Jun 2003 11:48:21 -0000 1.48
|
|
+++ src/iconview/qiconview.cpp 1 Jul 2003 16:36:17 -0000
|
|
@@ -257,7 +257,8 @@ public:
|
|
uint dragging :1;
|
|
uint drawActiveSelection :1;
|
|
uint inMenuMode :1;
|
|
-
|
|
+ uint controlPressed :1;
|
|
+
|
|
QIconViewToolTip *toolTip;
|
|
QPixmapCache maskCache;
|
|
QPtrDict<QIconViewItem> selectedItems;
|
|
@@ -2726,6 +2727,7 @@ QIconView::QIconView( QWidget *parent, c
|
|
d->lastItem = 0;
|
|
d->count = 0;
|
|
d->mousePressed = FALSE;
|
|
+ d->controlPressed = FALSE;
|
|
d->selectionMode = Single;
|
|
d->currentItem = 0;
|
|
d->highlightedItem = 0;
|
|
@@ -3288,9 +3290,18 @@ void QIconView::doAutoScroll()
|
|
alreadyIntersected = TRUE;
|
|
QIconViewItem *item = c->items.first();
|
|
for ( ; item; item = c->items.next() ) {
|
|
- if ( d->selectedItems.find( item ) )
|
|
- continue;
|
|
- if ( !item->intersects( nr ) ) {
|
|
+ if ( d->selectedItems.find( item ) ) {
|
|
+ if ( item->intersects( nr ) && item->isSelected() && d->controlPressed ) {
|
|
+ item->setSelected( FALSE );
|
|
+ changed = TRUE;
|
|
+ rr = rr.unite( item->rect() );
|
|
+ } else if ( !item->intersects( nr ) && !item->isSelected() && d->controlPressed ) {
|
|
+ item->setSelected( TRUE, TRUE );
|
|
+ changed = TRUE;
|
|
+ rr = rr.unite( item->rect() );
|
|
+ } else
|
|
+ continue;
|
|
+ } else if ( !item->intersects( nr ) ) {
|
|
if ( item->isSelected() ) {
|
|
item->setSelected( FALSE );
|
|
changed = TRUE;
|
|
@@ -4480,7 +4491,7 @@ void QIconView::contentsMousePressEventE
|
|
}
|
|
}
|
|
} else if ( ( d->selectionMode != Single || e->button() == RightButton )
|
|
- && !( e->state() & ControlButton ) )
|
|
+ && !( e->state() & ControlButton ) && !( e->state() & ShiftButton ) )
|
|
selectAll( FALSE );
|
|
|
|
setCurrentItem( item );
|
|
@@ -4491,12 +4502,11 @@ void QIconView::contentsMousePressEventE
|
|
d->tmpCurrentItem = d->currentItem;
|
|
d->currentItem = 0;
|
|
repaintItem( d->tmpCurrentItem );
|
|
- if ( d->rubber )
|
|
- delete d->rubber;
|
|
- d->rubber = 0;
|
|
+ delete d->rubber;
|
|
d->rubber = new QRect( e->x(), e->y(), 0, 0 );
|
|
d->selectedItems.clear();
|
|
- if ( ( e->state() & ControlButton ) == ControlButton ) {
|
|
+ if ( ( e->state() & ControlButton ) == ControlButton ||
|
|
+ ( e->state() & ShiftButton ) == ShiftButton ) {
|
|
for ( QIconViewItem *i = firstItem(); i; i = i->nextItem() )
|
|
if ( i->isSelected() )
|
|
d->selectedItems.insert( i, i );
|
|
@@ -4504,6 +4514,7 @@ void QIconView::contentsMousePressEventE
|
|
}
|
|
|
|
d->mousePressed = TRUE;
|
|
+ d->controlPressed = ( ( e->state() & ControlButton ) == ControlButton );
|
|
}
|
|
|
|
emit_signals:
|