782
|
1 |
--- qt-x11-free-3.3.8/src/iconview/qiconview.cpp.orig 2007-02-02 19:31:07.000000000 +0530
|
|
2 |
+++ qt-x11-free-3.3.8/src/iconview/qiconview.cpp 2008-01-08 21:10:14.443365125 +0530
|
|
3 |
@@ -236,6 +236,7 @@
|
|
4 |
QPoint dragStartPos;
|
|
5 |
QFontMetrics *fm;
|
|
6 |
int minLeftBearing, minRightBearing;
|
|
7 |
+ int rubberStartX, rubberStartY;
|
|
8 |
|
|
9 |
uint mousePressed :1;
|
|
10 |
uint cleared :1;
|
|
11 |
@@ -255,6 +256,7 @@
|
|
12 |
uint firstSizeHint : 1;
|
|
13 |
uint showTips :1;
|
|
14 |
uint pressedSelected :1;
|
|
15 |
+ uint canStartRubber :1;
|
|
16 |
uint dragging :1;
|
|
17 |
uint drawActiveSelection :1;
|
|
18 |
uint inMenuMode :1;
|
|
19 |
@@ -2754,6 +2756,7 @@
|
|
20 |
d->currentItem = 0;
|
|
21 |
d->highlightedItem = 0;
|
|
22 |
d->rubber = 0;
|
|
23 |
+ d->canStartRubber = FALSE;
|
|
24 |
d->scrollTimer = 0;
|
|
25 |
d->startDragItem = 0;
|
|
26 |
d->tmpCurrentItem = 0;
|
|
27 |
@@ -4513,29 +4516,19 @@
|
|
28 |
|
|
29 |
setCurrentItem( item );
|
|
30 |
|
|
31 |
+ d->canStartRubber = FALSE;
|
|
32 |
if ( e->button() == LeftButton ) {
|
|
33 |
if ( !item && ( d->selectionMode == Multi ||
|
|
34 |
d->selectionMode == Extended ) ) {
|
|
35 |
- d->tmpCurrentItem = d->currentItem;
|
|
36 |
- d->currentItem = 0;
|
|
37 |
- repaintItem( d->tmpCurrentItem );
|
|
38 |
- if ( d->rubber )
|
|
39 |
- delete d->rubber;
|
|
40 |
- d->rubber = 0;
|
|
41 |
- d->rubber = new QRect( e->x(), e->y(), 0, 0 );
|
|
42 |
- d->selectedItems.clear();
|
|
43 |
- if ( ( e->state() & ControlButton ) == ControlButton ) {
|
|
44 |
- for ( QIconViewItem *i = firstItem(); i; i = i->nextItem() )
|
|
45 |
- if ( i->isSelected() )
|
|
46 |
- d->selectedItems.insert( i, i );
|
|
47 |
- }
|
|
48 |
+ d->canStartRubber = TRUE;
|
|
49 |
+ d->rubberStartX = e->x();
|
|
50 |
+ d->rubberStartY = e->y();
|
|
51 |
}
|
|
52 |
-
|
|
53 |
d->mousePressed = TRUE;
|
|
54 |
}
|
|
55 |
|
|
56 |
emit_signals:
|
|
57 |
- if ( !d->rubber ) {
|
|
58 |
+ if ( !d->canStartRubber ) {
|
|
59 |
emit mouseButtonPressed( e->button(), item, e->globalPos() );
|
|
60 |
emit pressed( item );
|
|
61 |
emit pressed( item, e->globalPos() );
|
|
62 |
@@ -4579,6 +4572,7 @@
|
|
63 |
d->mousePressed = FALSE;
|
|
64 |
d->startDragItem = 0;
|
|
65 |
|
|
66 |
+ d->canStartRubber = FALSE;
|
|
67 |
if ( d->rubber ) {
|
|
68 |
QPainter p;
|
|
69 |
p.begin( viewport() );
|
|
70 |
@@ -4668,7 +4662,22 @@
|
|
71 |
if ( d->tmpCurrentItem )
|
|
72 |
repaintItem( d->tmpCurrentItem );
|
|
73 |
}
|
|
74 |
- } else if ( d->mousePressed && !d->currentItem && d->rubber ) {
|
|
75 |
+ } else if ( d->mousePressed && ((!d->currentItem && d->rubber) || d->canStartRubber) ) {
|
|
76 |
+ if ( d->canStartRubber ) {
|
|
77 |
+ d->canStartRubber = FALSE;
|
|
78 |
+ d->tmpCurrentItem = d->currentItem;
|
|
79 |
+ d->currentItem = 0;
|
|
80 |
+ repaintItem( d->tmpCurrentItem );
|
|
81 |
+ delete d->rubber;
|
|
82 |
+ d->rubber = new QRect( d->rubberStartX, d->rubberStartY, 0, 0 );
|
|
83 |
+ d->selectedItems.clear();
|
|
84 |
+ if ( ( e->state() & ControlButton ) == ControlButton ||
|
|
85 |
+ ( e->state() & ShiftButton ) == ShiftButton ) {
|
|
86 |
+ for ( QIconViewItem *i = firstItem(); i; i = i->nextItem() )
|
|
87 |
+ if ( i->isSelected() )
|
|
88 |
+ d->selectedItems.insert( i, i );
|
|
89 |
+ }
|
|
90 |
+ }
|
|
91 |
doAutoScroll();
|
|
92 |
}
|
|
93 |
}
|