parent
281dce280d
commit
af4dffbc52
@ -1,2 +1,4 @@
|
||||
*~
|
||||
_build*
|
||||
.osc
|
||||
.metadata
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,180 +0,0 @@
|
||||
--- src/kernel/qdnd_x11.cpp
|
||||
+++ src/kernel/qdnd_x11.cpp
|
||||
@@ -49,13 +49,15 @@
|
||||
#include "qdragobject.h"
|
||||
#include "qobjectlist.h"
|
||||
#include "qcursor.h"
|
||||
+#include "qbitmap.h"
|
||||
+#include "qpainter.h"
|
||||
|
||||
#include "qt_x11_p.h"
|
||||
|
||||
// conflict resolution
|
||||
|
||||
-// unused, may be used again later: const int XKeyPress = KeyPress;
|
||||
-// unused, may be used again later: const int XKeyRelease = KeyRelease;
|
||||
+const int XKeyPress = KeyPress;
|
||||
+const int XKeyRelease = KeyRelease;
|
||||
#undef KeyPress
|
||||
#undef KeyRelease
|
||||
|
||||
@@ -252,20 +254,47 @@
|
||||
public:
|
||||
QShapedPixmapWidget(int screen = -1) :
|
||||
QWidget(QApplication::desktop()->screen( screen ),
|
||||
- 0, WStyle_Customize | WStyle_Tool | WStyle_NoBorder | WX11BypassWM )
|
||||
+ 0, WStyle_Customize | WStyle_Tool | WStyle_NoBorder | WX11BypassWM ), oldpmser( 0 ), oldbmser( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
- void setPixmap(QPixmap pm)
|
||||
+ void setPixmap(QPixmap pm, QPoint hot)
|
||||
{
|
||||
- if ( pm.mask() ) {
|
||||
+ int bmser = pm.mask() ? pm.mask()->serialNumber() : 0;
|
||||
+ if( oldpmser == pm.serialNumber() && oldbmser == bmser
|
||||
+ && oldhot == hot )
|
||||
+ return;
|
||||
+ oldpmser = pm.serialNumber();
|
||||
+ oldbmser = bmser;
|
||||
+ oldhot = hot;
|
||||
+ bool hotspot_in = !(hot.x() < 0 || hot.y() < 0 || hot.x() >= pm.width() || hot.y() >= pm.height());
|
||||
+// if the pixmap has hotspot in its area, make a "hole" in it at that position
|
||||
+// this will allow XTranslateCoordinates() to find directly the window below the cursor instead
|
||||
+// of finding this pixmap, and therefore there won't be needed any (slow) search for the window
|
||||
+// using findRealWindow()
|
||||
+ if( hotspot_in ) {
|
||||
+ QBitmap mask = pm.mask() ? *pm.mask() : QBitmap( pm.width(), pm.height());
|
||||
+ if( !pm.mask())
|
||||
+ mask.fill( Qt::color1 );
|
||||
+ QPainter p( &mask );
|
||||
+ p.setPen( Qt::color0 );
|
||||
+ p.drawPoint( hot.x(), hot.y());
|
||||
+ p.end();
|
||||
+ pm.setMask( mask );
|
||||
+ setMask( mask );
|
||||
+ } else if ( pm.mask() ) {
|
||||
setMask( *pm.mask() );
|
||||
} else {
|
||||
clearMask();
|
||||
}
|
||||
resize(pm.width(),pm.height());
|
||||
setErasePixmap(pm);
|
||||
+ erase();
|
||||
}
|
||||
+private:
|
||||
+ int oldpmser;
|
||||
+ int oldbmser;
|
||||
+ QPoint oldhot;
|
||||
};
|
||||
|
||||
static QShapedPixmapWidget * qt_xdnd_deco = 0;
|
||||
@@ -862,6 +891,45 @@
|
||||
move( QCursor::pos() );
|
||||
}
|
||||
|
||||
+static bool qt_xdnd_was_move = false;
|
||||
+static bool qt_xdnd_found = false;
|
||||
+// check whole incoming X queue for move events
|
||||
+// checking whole queue is done by always returning False in the predicate
|
||||
+// if there's another move event in the queue, and there's not a mouse button
|
||||
+// or keyboard or ClientMessage event before it, the current move event
|
||||
+// may be safely discarded
|
||||
+// this helps avoiding being overloaded by being flooded from many events
|
||||
+// from the XServer
|
||||
+static
|
||||
+Bool qt_xdnd_predicate( Display*, XEvent* ev, XPointer )
|
||||
+{
|
||||
+ if( qt_xdnd_found )
|
||||
+ return False;
|
||||
+ if( ev->type == MotionNotify )
|
||||
+ {
|
||||
+ qt_xdnd_was_move = true;
|
||||
+ qt_xdnd_found = true;
|
||||
+ }
|
||||
+ if( ev->type == ButtonPress || ev->type == ButtonRelease
|
||||
+ || ev->type == XKeyPress || ev->type == XKeyRelease
|
||||
+ || ev->type == ClientMessage )
|
||||
+ {
|
||||
+ qt_xdnd_was_move = false;
|
||||
+ qt_xdnd_found = true;
|
||||
+ }
|
||||
+ return False;
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+bool qt_xdnd_another_movement()
|
||||
+{
|
||||
+ qt_xdnd_was_move = false;
|
||||
+ qt_xdnd_found = false;
|
||||
+ XEvent dummy;
|
||||
+ XCheckIfEvent( qt_xdisplay(), &dummy, qt_xdnd_predicate, NULL );
|
||||
+ return qt_xdnd_was_move;
|
||||
+}
|
||||
+
|
||||
bool QDragManager::eventFilter( QObject * o, QEvent * e)
|
||||
{
|
||||
if ( beingCancelled ) {
|
||||
@@ -884,8 +952,10 @@
|
||||
|
||||
if ( e->type() == QEvent::MouseMove ) {
|
||||
QMouseEvent* me = (QMouseEvent *)e;
|
||||
- updateMode(me->stateAfter());
|
||||
- move( me->globalPos() );
|
||||
+ if( !qt_xdnd_another_movement()) {
|
||||
+ updateMode(me->stateAfter());
|
||||
+ move( me->globalPos() );
|
||||
+ }
|
||||
return TRUE;
|
||||
} else if ( e->type() == QEvent::MouseButtonRelease ) {
|
||||
qApp->removeEventFilter( this );
|
||||
@@ -1126,7 +1196,7 @@
|
||||
qt_xdnd_deco->grabMouse();
|
||||
}
|
||||
}
|
||||
- updatePixmap();
|
||||
+ updatePixmap( globalPos );
|
||||
|
||||
if ( qt_xdnd_source_sameanswer.contains( globalPos ) &&
|
||||
qt_xdnd_source_sameanswer.isValid() ) {
|
||||
@@ -1717,7 +1787,7 @@
|
||||
// qt_xdnd_source_object persists until we get an xdnd_finish message
|
||||
}
|
||||
|
||||
-void QDragManager::updatePixmap()
|
||||
+void QDragManager::updatePixmap( const QPoint& cursorPos )
|
||||
{
|
||||
if ( qt_xdnd_deco ) {
|
||||
QPixmap pm;
|
||||
@@ -1732,9 +1802,8 @@
|
||||
defaultPm = new QPixmap(default_pm);
|
||||
pm = *defaultPm;
|
||||
}
|
||||
- qt_xdnd_deco->setPixmap(pm);
|
||||
- qt_xdnd_deco->move(QCursor::pos()-pm_hot);
|
||||
- qt_xdnd_deco->repaint(FALSE);
|
||||
+ qt_xdnd_deco->setPixmap(pm, pm_hot);
|
||||
+ qt_xdnd_deco->move(cursorPos-pm_hot);
|
||||
//if ( willDrop ) {
|
||||
qt_xdnd_deco->show();
|
||||
//} else {
|
||||
@@ -1743,4 +1812,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
+void QDragManager::updatePixmap()
|
||||
+{
|
||||
+ updatePixmap( QCursor::pos());
|
||||
+}
|
||||
+
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
--- src/kernel/qdragobject.h
|
||||
+++ src/kernel/qdragobject.h
|
||||
@@ -245,6 +245,7 @@
|
||||
void move( const QPoint & );
|
||||
void drop();
|
||||
void updatePixmap();
|
||||
+ void updatePixmap( const QPoint& cursorPos );
|
||||
|
||||
private:
|
||||
QDragObject * object;
|
@ -1,162 +0,0 @@
|
||||
--- src/kernel/qapplication_x11.cpp
|
||||
+++ src/kernel/qapplication_x11.cpp
|
||||
@@ -3972,7 +3972,7 @@
|
||||
// Keyboard event translation
|
||||
//
|
||||
|
||||
-static int translateButtonState( int s )
|
||||
+int qt_x11_translateButtonState( int s )
|
||||
{
|
||||
int bst = 0;
|
||||
if ( s & Button1Mask )
|
||||
@@ -4038,7 +4038,7 @@
|
||||
pos.ry() = lastMotion.y;
|
||||
globalPos.rx() = lastMotion.x_root;
|
||||
globalPos.ry() = lastMotion.y_root;
|
||||
- state = translateButtonState( lastMotion.state );
|
||||
+ state = qt_x11_translateButtonState( lastMotion.state );
|
||||
if ( qt_button_down && (state & (LeftButton |
|
||||
MidButton |
|
||||
RightButton ) ) == 0 )
|
||||
@@ -4062,7 +4062,7 @@
|
||||
pos.ry() = xevent->xcrossing.y;
|
||||
globalPos.rx() = xevent->xcrossing.x_root;
|
||||
globalPos.ry() = xevent->xcrossing.y_root;
|
||||
- state = translateButtonState( xevent->xcrossing.state );
|
||||
+ state = qt_x11_translateButtonState( xevent->xcrossing.state );
|
||||
if ( qt_button_down && (state & (LeftButton |
|
||||
MidButton |
|
||||
RightButton ) ) == 0 )
|
||||
@@ -4074,7 +4074,7 @@
|
||||
pos.ry() = event->xbutton.y;
|
||||
globalPos.rx() = event->xbutton.x_root;
|
||||
globalPos.ry() = event->xbutton.y_root;
|
||||
- state = translateButtonState( event->xbutton.state );
|
||||
+ state = qt_x11_translateButtonState( event->xbutton.state );
|
||||
switch ( event->xbutton.button ) {
|
||||
case Button1: button = LeftButton; break;
|
||||
case Button2: button = MidButton; break;
|
||||
@@ -5020,7 +5020,7 @@
|
||||
XKeyEvent xkeyevent = event->xkey;
|
||||
|
||||
// save the modifier state, we will use the keystate uint later by passing
|
||||
- // it to translateButtonState
|
||||
+ // it to qt_x11_translateButtonState
|
||||
uint keystate = event->xkey.state;
|
||||
// remove the modifiers where mode_switch exists... HPUX machines seem
|
||||
// to have alt *AND* mode_switch both in Mod1Mask, which causes
|
||||
@@ -5134,7 +5134,7 @@
|
||||
}
|
||||
#endif // !QT_NO_XIM
|
||||
|
||||
- state = translateButtonState( keystate );
|
||||
+ state = qt_x11_translateButtonState( keystate );
|
||||
|
||||
static int directionKeyEvent = 0;
|
||||
if ( qt_use_rtl_extensions && type == QEvent::KeyRelease ) {
|
||||
--- src/kernel/qdnd_x11.cpp
|
||||
+++ src/kernel/qdnd_x11.cpp
|
||||
@@ -115,6 +115,8 @@
|
||||
Atom qt_xdnd_type_list;
|
||||
const int qt_xdnd_version = 4;
|
||||
|
||||
+extern int qt_x11_translateButtonState( int s );
|
||||
+
|
||||
// Actions
|
||||
//
|
||||
// The Xdnd spec allows for user-defined actions. This could be implemented
|
||||
@@ -199,6 +201,8 @@
|
||||
static int qt_xdnd_current_screen = -1;
|
||||
// state of dragging... true if dragging, false if not
|
||||
bool qt_xdnd_dragging = FALSE;
|
||||
+// need to check state of keyboard modifiers
|
||||
+static bool need_modifiers_check = FALSE;
|
||||
|
||||
// dict of payload data, sorted by type atom
|
||||
static QIntDict<QByteArray> * qt_xdnd_target_data = 0;
|
||||
@@ -887,8 +891,20 @@
|
||||
|
||||
void QDragManager::timerEvent( QTimerEvent* e )
|
||||
{
|
||||
- if ( e->timerId() == heartbeat && qt_xdnd_source_sameanswer.isNull() )
|
||||
- move( QCursor::pos() );
|
||||
+ if ( e->timerId() == heartbeat ) {
|
||||
+ if( need_modifiers_check ) {
|
||||
+ Window root, child;
|
||||
+ int root_x, root_y, win_x, win_y;
|
||||
+ unsigned int mask;
|
||||
+ XQueryPointer( qt_xdisplay(), qt_xrootwin( qt_xdnd_current_screen ),
|
||||
+ &root, &child, &root_x, &root_y, &win_x, &win_y, &mask );
|
||||
+ if( updateMode( (ButtonState)qt_x11_translateButtonState( mask )))
|
||||
+ qt_xdnd_source_sameanswer = QRect(); // force move
|
||||
+ }
|
||||
+ need_modifiers_check = TRUE;
|
||||
+ if( qt_xdnd_source_sameanswer.isNull() )
|
||||
+ move( QCursor::pos() );
|
||||
+ }
|
||||
}
|
||||
|
||||
static bool qt_xdnd_was_move = false;
|
||||
@@ -956,6 +972,7 @@
|
||||
updateMode(me->stateAfter());
|
||||
move( me->globalPos() );
|
||||
}
|
||||
+ need_modifiers_check = FALSE;
|
||||
return TRUE;
|
||||
} else if ( e->type() == QEvent::MouseButtonRelease ) {
|
||||
qApp->removeEventFilter( this );
|
||||
@@ -994,9 +1011,11 @@
|
||||
beingCancelled = FALSE;
|
||||
qApp->exit_loop();
|
||||
} else {
|
||||
- updateMode(ke->stateAfter());
|
||||
- qt_xdnd_source_sameanswer = QRect(); // force move
|
||||
- move( QCursor::pos() );
|
||||
+ if( updateMode(ke->stateAfter())) {
|
||||
+ qt_xdnd_source_sameanswer = QRect(); // force move
|
||||
+ move( QCursor::pos() );
|
||||
+ }
|
||||
+ need_modifiers_check = FALSE;
|
||||
}
|
||||
return TRUE; // Eat all key events
|
||||
}
|
||||
@@ -1023,10 +1042,10 @@
|
||||
|
||||
|
||||
static Qt::ButtonState oldstate;
|
||||
-void QDragManager::updateMode( ButtonState newstate )
|
||||
+bool QDragManager::updateMode( ButtonState newstate )
|
||||
{
|
||||
if ( newstate == oldstate )
|
||||
- return;
|
||||
+ return false;
|
||||
const int both = ShiftButton|ControlButton;
|
||||
if ( (newstate & both) == both ) {
|
||||
global_requested_action = QDropEvent::Link;
|
||||
@@ -1050,6 +1069,7 @@
|
||||
}
|
||||
}
|
||||
oldstate = newstate;
|
||||
+ return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1754,6 +1774,7 @@
|
||||
qt_xdnd_source_sameanswer = QRect();
|
||||
move(QCursor::pos());
|
||||
heartbeat = startTimer(200);
|
||||
+ need_modifiers_check = FALSE;
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
qApp->setOverrideCursor( arrowCursor );
|
||||
--- src/kernel/qdragobject.h
|
||||
+++ src/kernel/qdragobject.h
|
||||
@@ -249,7 +249,7 @@
|
||||
|
||||
private:
|
||||
QDragObject * object;
|
||||
- void updateMode( ButtonState newstate );
|
||||
+ bool updateMode( ButtonState newstate );
|
||||
void updateCursor();
|
||||
#if defined(Q_WS_X11)
|
||||
void createCursors();
|
@ -1,384 +0,0 @@
|
||||
qt-bugs@ issue : 11790 (part of)
|
||||
applied: no
|
||||
author: Lubos Lunak <l.lunak@kde.org>
|
||||
|
||||
See 0005-qpixmap_mitshm.patch for details.
|
||||
|
||||
|
||||
--- src/kernel/qpixmap_x11.cpp
|
||||
+++ src/kernel/qpixmap_x11.cpp
|
||||
@@ -1123,9 +1123,6 @@ bool QPixmap::convertFromImage( const QI
|
||||
return FALSE;
|
||||
int bppc = xi->bits_per_pixel;
|
||||
|
||||
- if ( bppc > 8 && xi->byte_order == LSBFirst )
|
||||
- bppc++;
|
||||
-
|
||||
bool contig_bits = n_bits(red_mask) == rbits &&
|
||||
n_bits(green_mask) == gbits &&
|
||||
n_bits(blue_mask) == bbits;
|
||||
@@ -1174,32 +1171,70 @@ bool QPixmap::convertFromImage( const QI
|
||||
}
|
||||
init=TRUE;
|
||||
}
|
||||
+
|
||||
+ enum { BPP8,
|
||||
+ BPP16_8_3_M3, BPP16_7_2_M3, BPP16_MSB, BPP16_LSB,
|
||||
+ BPP24_MSB, BPP24_LSB,
|
||||
+ BPP32_16_8_0, BPP32_MSB, BPP32_LSB
|
||||
+ } mode = BPP8;
|
||||
|
||||
- for ( uint y=0; y<h; y++ ) {
|
||||
- uchar* src = image.scanLine( y );
|
||||
- uchar* dst = newbits + xi->bytes_per_line*y;
|
||||
- QRgb* p = (QRgb *)src;
|
||||
+ if ( bppc > 8 && xi->byte_order == LSBFirst )
|
||||
+ bppc++;
|
||||
|
||||
-#define GET_RGB \
|
||||
- int r = qRed ( *p ); \
|
||||
- int g = qGreen( *p ); \
|
||||
- int b = qBlue ( *p++ ); \
|
||||
- r = red_shift > 0 \
|
||||
- ? r << red_shift : r >> -red_shift; \
|
||||
- g = green_shift > 0 \
|
||||
- ? g << green_shift : g >> -green_shift; \
|
||||
- b = blue_shift > 0 \
|
||||
- ? b << blue_shift : b >> -blue_shift;
|
||||
+ int wordsize;
|
||||
+ bool bigendian;
|
||||
+ qSysInfo( &wordsize, &bigendian );
|
||||
+ bool same_msb_lsb = ( xi->byte_order == MSBFirst ) == ( bigendian );
|
||||
+
|
||||
+ if( bppc == 8 ) // 8 bit
|
||||
+ mode = BPP8;
|
||||
+ else if( bppc == 16 || bppc == 17 ) { // 16 bit MSB/LSB
|
||||
+ if( red_shift == 8 && green_shift == 3 && blue_shift == -3
|
||||
+ && !d8 && same_msb_lsb )
|
||||
+ mode = BPP16_8_3_M3;
|
||||
+ else if( red_shift == 7 && green_shift == 2 && blue_shift == -3
|
||||
+ && !d8 && same_msb_lsb )
|
||||
+ mode = BPP16_7_2_M3;
|
||||
+ else
|
||||
+ mode = bppc == 17 ? BPP16_LSB : BPP16_MSB;
|
||||
+ } else if( bppc == 24 || bppc == 25 ) { // 24 bit MSB/LSB
|
||||
+ mode = bppc == 25 ? BPP24_LSB : BPP24_MSB;
|
||||
+ } else if( bppc == 32 || bppc == 33 ) { // 32 bit MSB/LSB
|
||||
+ if( red_shift == 16 && green_shift == 8 && blue_shift == 0
|
||||
+ && !d8 && same_msb_lsb )
|
||||
+ mode = BPP32_16_8_0;
|
||||
+ else
|
||||
+ mode = bppc == 33 ? BPP32_LSB : BPP32_MSB;
|
||||
+ } else
|
||||
+ qFatal("Logic error 3");
|
||||
|
||||
#define GET_PIXEL \
|
||||
int pixel; \
|
||||
if ( d8 ) pixel = pix[*src++]; \
|
||||
else { \
|
||||
- GET_RGB \
|
||||
- pixel = (b & blue_mask)|(g & green_mask) | (r & red_mask) \
|
||||
+ int r = qRed ( *p ); \
|
||||
+ int g = qGreen( *p ); \
|
||||
+ int b = qBlue ( *p++ ); \
|
||||
+ r = red_shift > 0 \
|
||||
+ ? r << red_shift : r >> -red_shift; \
|
||||
+ g = green_shift > 0 \
|
||||
+ ? g << green_shift : g >> -green_shift; \
|
||||
+ b = blue_shift > 0 \
|
||||
+ ? b << blue_shift : b >> -blue_shift; \
|
||||
+ pixel = (r & red_mask)|(g & green_mask) | (b & blue_mask) \
|
||||
| ~(blue_mask | green_mask | red_mask); \
|
||||
}
|
||||
|
||||
+// optimized case - no d8 case, shift only once instead of twice, mask only once instead of twice,
|
||||
+// use direct values instead of variables, and use only one statement
|
||||
+// (*p >> 16), (*p >> 8 ) and (*p) are qRed(),qGreen() and qBlue() without masking
|
||||
+// shifts have to be passed including the shift operator (e.g. '>>3'), because of the direction
|
||||
+#define GET_PIXEL_OPT(red_shift,green_shift,blue_shift,red_mask,green_mask,blue_mask) \
|
||||
+ int pixel = ((( *p >> 16 ) red_shift ) & red_mask ) \
|
||||
+ | ((( *p >> 8 ) green_shift ) & green_mask ) \
|
||||
+ | ((( *p ) blue_shift ) & blue_mask ); \
|
||||
+ ++p;
|
||||
+
|
||||
#define GET_PIXEL_DITHER_TC \
|
||||
int r = qRed ( *p ); \
|
||||
int g = qGreen( *p ); \
|
||||
@@ -1220,91 +1255,177 @@ bool QPixmap::convertFromImage( const QI
|
||||
? g << green_shift : g >> -green_shift; \
|
||||
b = blue_shift > 0 \
|
||||
? b << blue_shift : b >> -blue_shift; \
|
||||
- int pixel = (b & blue_mask)|(g & green_mask) | (r & red_mask);
|
||||
+ int pixel = (r & red_mask)|(g & green_mask) | (b & blue_mask);
|
||||
|
||||
- if ( dither_tc ) {
|
||||
- uint x;
|
||||
- switch ( bppc ) {
|
||||
- case 16: // 16 bit MSB
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- GET_PIXEL_DITHER_TC
|
||||
- *dst++ = (pixel >> 8);
|
||||
- *dst++ = pixel;
|
||||
- }
|
||||
+// again, optimized case
|
||||
+// can't be optimized that much :(
|
||||
+#define GET_PIXEL_DITHER_TC_OPT(red_shift,green_shift,blue_shift,red_mask,green_mask,blue_mask, \
|
||||
+ rbits,gbits,bbits) \
|
||||
+ const int thres = D[x%16][y%16]; \
|
||||
+ int r = qRed ( *p ); \
|
||||
+ if ( r <= (255-(1<<(8-rbits))) && ((r<<rbits) & 255) \
|
||||
+ > thres) \
|
||||
+ r += (1<<(8-rbits)); \
|
||||
+ int g = qGreen( *p ); \
|
||||
+ if ( g <= (255-(1<<(8-gbits))) && ((g<<gbits) & 255) \
|
||||
+ > thres) \
|
||||
+ g += (1<<(8-gbits)); \
|
||||
+ int b = qBlue ( *p++ ); \
|
||||
+ if ( b <= (255-(1<<(8-bbits))) && ((b<<bbits) & 255) \
|
||||
+ > thres) \
|
||||
+ b += (1<<(8-bbits)); \
|
||||
+ int pixel = (( r red_shift ) & red_mask ) \
|
||||
+ | (( g green_shift ) & green_mask ) \
|
||||
+ | (( b blue_shift ) & blue_mask );
|
||||
+
|
||||
+#define CYCLE(body) \
|
||||
+ for ( uint y=0; y<h; y++ ) { \
|
||||
+ uchar* src = image.scanLine( y ); \
|
||||
+ uchar* dst = newbits + xi->bytes_per_line*y; \
|
||||
+ QRgb* p = (QRgb *)src; \
|
||||
+ body \
|
||||
+ }
|
||||
+
|
||||
+ if ( dither_tc ) {
|
||||
+ switch ( mode ) {
|
||||
+ case BPP16_8_3_M3:
|
||||
+ CYCLE(
|
||||
+ Q_INT16* dst16 = (Q_INT16*)dst;
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL_DITHER_TC_OPT(<<8,<<3,>>3,0xf800,0x7e0,0x1f,5,6,5)
|
||||
+ *dst16++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
- case 17: // 16 bit LSB
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- GET_PIXEL_DITHER_TC
|
||||
- *dst++ = pixel;
|
||||
- *dst++ = pixel >> 8;
|
||||
- }
|
||||
+ case BPP16_7_2_M3:
|
||||
+ CYCLE(
|
||||
+ Q_INT16* dst16 = (Q_INT16*)dst;
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL_DITHER_TC_OPT(<<7,<<2,>>3,0x7c00,0x3e0,0x1f,5,5,5)
|
||||
+ *dst16++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
+ break;
|
||||
+ case BPP16_MSB: // 16 bit MSB
|
||||
+ CYCLE(
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL_DITHER_TC
|
||||
+ *dst++ = (pixel >> 8);
|
||||
+ *dst++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
+ break;
|
||||
+ case BPP16_LSB: // 16 bit LSB
|
||||
+ CYCLE(
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL_DITHER_TC
|
||||
+ *dst++ = pixel;
|
||||
+ *dst++ = pixel >> 8;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
default:
|
||||
qFatal("Logic error");
|
||||
}
|
||||
- } else {
|
||||
- uint x;
|
||||
- switch ( bppc ) {
|
||||
- case 8: // 8 bit
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- int pixel = pix[*src++];
|
||||
- *dst++ = pixel;
|
||||
- }
|
||||
+ } else {
|
||||
+ switch ( mode ) {
|
||||
+ case BPP8: // 8 bit
|
||||
+ CYCLE(
|
||||
+ Q_UNUSED(p);
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ int pixel = pix[*src++];
|
||||
+ *dst++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
- case 16: // 16 bit MSB
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- GET_PIXEL
|
||||
- *dst++ = (pixel >> 8);
|
||||
- *dst++ = pixel;
|
||||
- }
|
||||
+ case BPP16_8_3_M3:
|
||||
+ CYCLE(
|
||||
+ Q_INT16* dst16 = (Q_INT16*)dst;
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL_OPT(<<8,<<3,>>3,0xf800,0x7e0,0x1f)
|
||||
+ *dst16++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
- case 17: // 16 bit LSB
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- GET_PIXEL
|
||||
- *dst++ = pixel;
|
||||
- *dst++ = pixel >> 8;
|
||||
- }
|
||||
+ case BPP16_7_2_M3:
|
||||
+ CYCLE(
|
||||
+ Q_INT16* dst16 = (Q_INT16*)dst;
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL_OPT(<<7,<<2,>>3,0x7c00,0x3e0,0x1f)
|
||||
+ *dst16++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
- case 24: // 24 bit MSB
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- GET_PIXEL
|
||||
- *dst++ = pixel >> 16;
|
||||
- *dst++ = pixel >> 8;
|
||||
- *dst++ = pixel;
|
||||
- }
|
||||
+ case BPP16_MSB: // 16 bit MSB
|
||||
+ CYCLE(
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL
|
||||
+ *dst++ = (pixel >> 8);
|
||||
+ *dst++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
- case 25: // 24 bit LSB
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- GET_PIXEL
|
||||
- *dst++ = pixel;
|
||||
- *dst++ = pixel >> 8;
|
||||
- *dst++ = pixel >> 16;
|
||||
- }
|
||||
+ case BPP16_LSB: // 16 bit LSB
|
||||
+ CYCLE(
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL
|
||||
+ *dst++ = pixel;
|
||||
+ *dst++ = pixel >> 8;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
- case 32: // 32 bit MSB
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- GET_PIXEL
|
||||
- *dst++ = pixel >> 24;
|
||||
- *dst++ = pixel >> 16;
|
||||
- *dst++ = pixel >> 8;
|
||||
- *dst++ = pixel;
|
||||
- }
|
||||
+ case BPP24_MSB: // 24 bit MSB
|
||||
+ CYCLE(
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL
|
||||
+ *dst++ = pixel >> 16;
|
||||
+ *dst++ = pixel >> 8;
|
||||
+ *dst++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
- case 33: // 32 bit LSB
|
||||
- for ( x=0; x<w; x++ ) {
|
||||
- GET_PIXEL
|
||||
- *dst++ = pixel;
|
||||
- *dst++ = pixel >> 8;
|
||||
- *dst++ = pixel >> 16;
|
||||
- *dst++ = pixel >> 24;
|
||||
- }
|
||||
+ case BPP24_LSB: // 24 bit LSB
|
||||
+ CYCLE(
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL
|
||||
+ *dst++ = pixel;
|
||||
+ *dst++ = pixel >> 8;
|
||||
+ *dst++ = pixel >> 16;
|
||||
+ }
|
||||
+ )
|
||||
break;
|
||||
- default:
|
||||
- qFatal("Logic error 2");
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- xi->data = (char *)newbits;
|
||||
+ case BPP32_16_8_0:
|
||||
+ CYCLE(
|
||||
+ memcpy( dst, p, w * 4 );
|
||||
+ )
|
||||
+ break;
|
||||
+ case BPP32_MSB: // 32 bit MSB
|
||||
+ CYCLE(
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL
|
||||
+ *dst++ = pixel >> 24;
|
||||
+ *dst++ = pixel >> 16;
|
||||
+ *dst++ = pixel >> 8;
|
||||
+ *dst++ = pixel;
|
||||
+ }
|
||||
+ )
|
||||
+ break;
|
||||
+ case BPP32_LSB: // 32 bit LSB
|
||||
+ CYCLE(
|
||||
+ for ( uint x=0; x<w; x++ ) {
|
||||
+ GET_PIXEL
|
||||
+ *dst++ = pixel;
|
||||
+ *dst++ = pixel >> 8;
|
||||
+ *dst++ = pixel >> 16;
|
||||
+ *dst++ = pixel >> 24;
|
||||
+ }
|
||||
+ )
|
||||
+ break;
|
||||
+ default:
|
||||
+ qFatal("Logic error 2");
|
||||
+ }
|
||||
+ }
|
||||
+ xi->data = (char *)newbits;
|
||||
}
|
||||
|
||||
if ( d == 8 && !trucol ) { // 8 bit pixmap
|
||||
@@ -1554,15 +1675,24 @@ bool QPixmap::convertFromImage( const QI
|
||||
|
||||
if (image.depth() == 32) {
|
||||
const int *iptr = (const int *) image.bits();
|
||||
- int max = w * h;
|
||||
- while (max--)
|
||||
- *aptr++ = *iptr++ >> 24; // squirt
|
||||
+ if( axi->bytes_per_line == (int)w ) {
|
||||
+ int max = w * h;
|
||||
+ while (max--)
|
||||
+ *aptr++ = *iptr++ >> 24; // squirt
|
||||
+ } else {
|
||||
+ for (uint i = 0; i < h; ++i ) {
|
||||
+ for (uint j = 0; j < w; ++j )
|
||||
+ *aptr++ = *iptr++ >> 24; // squirt
|
||||
+ aptr += ( axi->bytes_per_line - w );
|
||||
+ }
|
||||
+ }
|
||||
} else if (image.depth() == 8) {
|
||||
const QRgb * const rgb = image.colorTable();
|
||||
for (uint y = 0; y < h; ++y) {
|
||||
const uchar *iptr = image.scanLine(y);
|
||||
for (uint x = 0; x < w; ++x)
|
||||
*aptr++ = qAlpha(rgb[*iptr++]);
|
||||
+ aptr += ( axi->bytes_per_line - w );
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
--- src/kernel/qdragobject.cpp
|
||||
+++ src/kernel/qdragobject.cpp
|
||||
@@ -893,6 +893,16 @@
|
||||
{
|
||||
if(!e)
|
||||
return FALSE;
|
||||
+
|
||||
+ // when subtype is not specified, try text/plain first, otherwise this may read
|
||||
+ // things like text/x-moz-url even though better targets are available
|
||||
+ if( subtype.isNull()) {
|
||||
+ QCString subtmp = "plain";
|
||||
+ if( decode( e, str, subtmp )) {
|
||||
+ subtype = subtmp;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if ( e->cacheType == QMimeSource::Text ) {
|
||||
str = *e->cache.txt.str;
|
@ -1,23 +0,0 @@
|
||||
qt-bugs@ issue: N46882
|
||||
bugs.kde.org number: 77545
|
||||
applied: no
|
||||
author: Stephan Binner <binner@kde.org>
|
||||
|
||||
Fix wrong K menu width for the case of enabled side pixmap and a menu title
|
||||
(like "Recently Used Applications") being longer than every other entry.
|
||||
|
||||
Solution: Respect PanelKMenu::setMaximumSize() as up to Qt 3.2.3
|
||||
|
||||
Index: src/widgets/qpopupmenu.cpp
|
||||
================================================================================
|
||||
--- src/widgets/qpopupmenu.cpp
|
||||
+++ src/widgets/qpopupmenu.cpp
|
||||
@@ -2530,7 +2530,7 @@
|
||||
constPolish();
|
||||
QPopupMenu* that = (QPopupMenu*) this;
|
||||
//We do not need a resize here, just the sizeHint..
|
||||
- return that->updateSize(FALSE, FALSE).expandedTo( QApplication::globalStrut() );
|
||||
+ return that->updateSize(FALSE).expandedTo( QApplication::globalStrut() );
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
<services>
|
||||
<service name="download_files"><param name="enforceupstream">yes</param><param name="enforcelocal">yes</param><param name="recompress">yes</param></service>
|
||||
<service name="download_files"><param name="recompress">yes</param></service>
|
||||
</services>
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,339 +0,0 @@
|
||||
--- src/iconview/qiconview.cpp
|
||||
+++ src/iconview/qiconview.cpp
|
||||
@@ -261,6 +261,7 @@
|
||||
|
||||
QIconViewToolTip *toolTip;
|
||||
QPixmapCache maskCache;
|
||||
+ QPixmap *backrubber;
|
||||
QPtrDict<QIconViewItem> selectedItems;
|
||||
|
||||
struct ItemContainer {
|
||||
@@ -1975,14 +1976,27 @@
|
||||
if ( picture() ) {
|
||||
QPicture *pic = picture();
|
||||
if ( isSelected() ) {
|
||||
- p->fillRect( pixmapRect( FALSE ), QBrush( cg.highlight(), QBrush::Dense4Pattern) );
|
||||
+ p->setBrush( QBrush( cg.highlight(), QBrush::Dense4Pattern ) );
|
||||
+ p->setPen( QPen( cg.highlight(), QBrush::Dense4Pattern ) );
|
||||
+ p->drawRoundRect( pixmapRect( FALSE ),
|
||||
+ 1000 / pixmapRect( FALSE ).width(),
|
||||
+ 1000 / pixmapRect( FALSE ).height() );
|
||||
}
|
||||
p->drawPicture( x()-pic->boundingRect().x(), y()-pic->boundingRect().y(), *pic );
|
||||
if ( isSelected() ) {
|
||||
- p->fillRect( textRect( FALSE ), cg.highlight() );
|
||||
+ p->setBrush( QBrush( cg.highlight() ) );
|
||||
+ p->setPen( QPen( cg.highlight() ) );
|
||||
+ p->drawRoundRect( textRect( FALSE ),
|
||||
+ 1000 / textRect( FALSE ).width(),
|
||||
+ 1000 / textRect( FALSE ).height() );
|
||||
p->setPen( QPen( cg.highlightedText() ) );
|
||||
- } else if ( view->d->itemTextBrush != NoBrush )
|
||||
- p->fillRect( textRect( FALSE ), view->d->itemTextBrush );
|
||||
+ } else if ( view->d->itemTextBrush != NoBrush ) {
|
||||
+ p->setBrush( view->d->itemTextBrush );
|
||||
+ p->setPen( QPen( view->d->itemTextBrush.color() ) );
|
||||
+ p->drawRoundRect( textRect( FALSE ),
|
||||
+ 1000 / textRect( FALSE ).width(),
|
||||
+ 1000 / textRect( FALSE ).height() );
|
||||
+ }
|
||||
|
||||
int align = view->itemTextPos() == QIconView::Bottom ? AlignHCenter : AlignAuto;
|
||||
if ( view->d->wordWrapIconText )
|
||||
@@ -2040,10 +2054,19 @@
|
||||
|
||||
p->save();
|
||||
if ( isSelected() ) {
|
||||
- p->fillRect( textRect( FALSE ), cg.highlight() );
|
||||
+ p->setBrush( QBrush( cg.highlight() ) );
|
||||
+ p->setPen( QPen( cg.highlight() ) );
|
||||
+ p->drawRoundRect( textRect( FALSE ),
|
||||
+ 1000 / textRect( FALSE ).width(),
|
||||
+ 1000 / textRect( FALSE ).height() );
|
||||
p->setPen( QPen( cg.highlightedText() ) );
|
||||
- } else if ( view->d->itemTextBrush != NoBrush )
|
||||
- p->fillRect( textRect( FALSE ), view->d->itemTextBrush );
|
||||
+ } else if ( view->d->itemTextBrush != NoBrush ) {
|
||||
+ p->setBrush( view->d->itemTextBrush );
|
||||
+ p->setPen( QPen( view->d->itemTextBrush.color() ) );
|
||||
+ p->drawRoundRect( textRect( FALSE ),
|
||||
+ 1000 / textRect( FALSE ).width(),
|
||||
+ 1000 / textRect( FALSE ).height() );
|
||||
+ }
|
||||
|
||||
int align = AlignHCenter;
|
||||
if ( view->d->wordWrapIconText )
|
||||
@@ -2059,31 +2082,13 @@
|
||||
/*!
|
||||
Paints the focus rectangle of the item using the painter \a p and
|
||||
the color group \a cg.
|
||||
+
|
||||
+ The default implementation does nothing; subclasses may
|
||||
+ reimplement this function.
|
||||
*/
|
||||
|
||||
-void QIconViewItem::paintFocus( QPainter *p, const QColorGroup &cg )
|
||||
+void QIconViewItem::paintFocus( QPainter *, const QColorGroup & )
|
||||
{
|
||||
- if ( !view )
|
||||
- return;
|
||||
-
|
||||
- view->style().drawPrimitive(QStyle::PE_FocusRect, p,
|
||||
- QRect( textRect( FALSE ).x(), textRect( FALSE ).y(),
|
||||
- textRect( FALSE ).width(),
|
||||
- textRect( FALSE ).height() ), cg,
|
||||
- (isSelected() ?
|
||||
- QStyle::Style_FocusAtBorder :
|
||||
- QStyle::Style_Default),
|
||||
- QStyleOption(isSelected() ? cg.highlight() : cg.base()));
|
||||
-
|
||||
- if ( this != view->d->currentItem ) {
|
||||
- view->style().drawPrimitive(QStyle::PE_FocusRect, p,
|
||||
- QRect( pixmapRect( FALSE ).x(),
|
||||
- pixmapRect( FALSE ).y(),
|
||||
- pixmapRect( FALSE ).width(),
|
||||
- pixmapRect( FALSE ).height() ),
|
||||
- cg, QStyle::Style_Default,
|
||||
- QStyleOption(cg.base()));
|
||||
- }
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2781,6 +2786,7 @@
|
||||
d->renamingItem = 0;
|
||||
d->drawActiveSelection = TRUE;
|
||||
d->drawDragShapes = FALSE;
|
||||
+ d->backrubber = 0;
|
||||
|
||||
connect( d->adjustTimer, SIGNAL( timeout() ),
|
||||
this, SLOT( adjustItems() ) );
|
||||
@@ -3265,7 +3271,7 @@
|
||||
|
||||
void QIconView::doAutoScroll()
|
||||
{
|
||||
- QRect oldRubber = QRect( *d->rubber );
|
||||
+ QRect oldRubber = *d->rubber;
|
||||
|
||||
QPoint vp = viewport()->mapFromGlobal( QCursor::pos() );
|
||||
QPoint pos = viewportToContents( vp );
|
||||
@@ -3282,7 +3288,6 @@
|
||||
bool block = signalsBlocked();
|
||||
|
||||
QRect rr;
|
||||
- QRegion region( 0, 0, visibleWidth(), visibleHeight() );
|
||||
|
||||
blockSignals( TRUE );
|
||||
viewport()->setUpdatesEnabled( FALSE );
|
||||
@@ -3308,9 +3313,6 @@
|
||||
item->setSelected( TRUE, TRUE );
|
||||
changed = TRUE;
|
||||
rr = rr.unite( item->rect() );
|
||||
- } else {
|
||||
- region = region.subtract( QRect( contentsToViewport( item->pos() ),
|
||||
- item->size() ) );
|
||||
}
|
||||
|
||||
minx = QMIN( minx, item->x() - 1 );
|
||||
@@ -3327,42 +3329,77 @@
|
||||
viewport()->setUpdatesEnabled( TRUE );
|
||||
blockSignals( block );
|
||||
|
||||
- QRect r = *d->rubber;
|
||||
- *d->rubber = oldRubber;
|
||||
-
|
||||
- QPainter p;
|
||||
- p.begin( viewport() );
|
||||
- p.setRasterOp( NotROP );
|
||||
- p.setPen( QPen( color0, 1 ) );
|
||||
- p.setBrush( NoBrush );
|
||||
- drawRubber( &p );
|
||||
- d->dragging = FALSE;
|
||||
- p.end();
|
||||
-
|
||||
- *d->rubber = r;
|
||||
-
|
||||
- if ( changed ) {
|
||||
- d->drawAllBack = FALSE;
|
||||
- d->clipRegion = region;
|
||||
- repaintContents( rr, FALSE );
|
||||
- d->drawAllBack = TRUE;
|
||||
+ // static bool drawAll;
|
||||
+ if ( d->backrubber == 0 ) {
|
||||
+ d->backrubber = new QPixmap( viewport()->rect().size() );
|
||||
+ d->backrubber->fill( viewport(), viewport()->rect().topLeft() );
|
||||
+ // drawAll = true;
|
||||
}
|
||||
|
||||
+ // int oldX = 0, oldY = 0;
|
||||
+ // if ( !drawAll && d->scrollTimer ) {
|
||||
+ // oldX = contentsX();
|
||||
+ // oldY = contentsY();
|
||||
+ // }
|
||||
ensureVisible( pos.x(), pos.y() );
|
||||
+ // if ( !drawAll && d->scrollTimer && ( oldX != contentsX() || oldY != contentsY() ) )
|
||||
+ // drawAll = true;
|
||||
|
||||
- p.begin( viewport() );
|
||||
- p.setRasterOp( NotROP );
|
||||
- p.setPen( QPen( color0, 1 ) );
|
||||
- p.setBrush( NoBrush );
|
||||
- drawRubber( &p );
|
||||
- d->dragging = TRUE;
|
||||
+ QRect allRect = oldRubber.normalize();
|
||||
+ if ( changed )
|
||||
+ allRect |= rr.normalize();
|
||||
+ allRect |= d->rubber->normalize();
|
||||
+ QPoint point = contentsToViewport( allRect.topLeft() );
|
||||
+ allRect = QRect( point.x(), point.y(), allRect.width(), allRect.height() );
|
||||
+ allRect &= viewport()->rect();
|
||||
+
|
||||
+ d->dragging = FALSE;
|
||||
+
|
||||
+ QPainter p( d->backrubber );
|
||||
+ p.translate( -contentsX(), -contentsY() );
|
||||
+#if 0
|
||||
+ if ( !drawAll ) {
|
||||
+ oldRubber = oldRubber.normalize();
|
||||
+ point = contentsToViewport( oldRubber.topLeft() );
|
||||
+ oldRubber = QRect( point.x(), point.y(), oldRubber.width(), oldRubber.height() );
|
||||
+ oldRubber &= viewport()->rect();
|
||||
+
|
||||
+ point = contentsToViewport( nr.topLeft() );
|
||||
+ nr = QRect( point.x(), point.y(), nr.width(), nr.height() );
|
||||
+ nr &= viewport()->rect();
|
||||
+
|
||||
+ QRegion region;
|
||||
+ if ( allRect != nr )
|
||||
+ region = QRegion(allRect).subtract( QRegion( nr ) );
|
||||
+ if ( allRect != oldRubber )
|
||||
+ region += QRegion(allRect).subtract( QRegion( oldRubber ) );
|
||||
+
|
||||
+ QMemArray< QRect > ar = region.rects();
|
||||
+ for ( uint i = 0; i < ar.size(); ++i ) {
|
||||
+ ar[i].addCoords( -2, -2, 4, 4 );
|
||||
+ ar[i] = ar[i].normalize();
|
||||
+
|
||||
+ p.setClipRect( ar[i] );
|
||||
+ drawContents( &p, contentsX() + ar[i].left(), contentsY() + ar[i].top(), ar[i].width(), ar[i].height() );
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
+ {
|
||||
+ drawContents( &p,
|
||||
+ contentsX() + allRect.left(), contentsY() + allRect.top(),
|
||||
+ allRect.width(), allRect.height() );
|
||||
+ }
|
||||
|
||||
p.end();
|
||||
+ // drawAll = false;
|
||||
+ d->dragging = TRUE;
|
||||
+ bitBlt( viewport(), allRect.topLeft(), d->backrubber, allRect );
|
||||
|
||||
if ( changed ) {
|
||||
emit selectionChanged();
|
||||
- if ( d->selectionMode == Single )
|
||||
- emit selectionChanged( d->currentItem );
|
||||
+ if ( d->selectionMode == Single )
|
||||
+ emit selectionChanged( d->currentItem );
|
||||
}
|
||||
|
||||
if ( !QRect( 50, 50, viewport()->width()-100, viewport()->height()-100 ).contains( vp ) &&
|
||||
@@ -3389,9 +3426,7 @@
|
||||
|
||||
void QIconView::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
|
||||
{
|
||||
- if ( d->dragging && d->rubber )
|
||||
- drawRubber( p );
|
||||
-
|
||||
+ p->save();
|
||||
QRect r = QRect( cx, cy, cw, ch );
|
||||
|
||||
QIconViewPrivate::ItemContainer *c = d->firstContainer;
|
||||
@@ -3465,8 +3500,16 @@
|
||||
d->currentItem->paintFocus( p, colorGroup() );
|
||||
}
|
||||
|
||||
- if ( d->dragging && d->rubber )
|
||||
- drawRubber( p );
|
||||
+ p->restore();
|
||||
+ if ( d->rubber ) {
|
||||
+ p->save();
|
||||
+ p->translate( contentsX(), contentsY() );
|
||||
+ p->setRasterOp( NotROP );
|
||||
+ p->setPen( QPen( color0, 1 ) );
|
||||
+ p->setBrush( NoBrush );
|
||||
+ drawRubber( p );
|
||||
+ p->restore();
|
||||
+ }
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -4365,17 +4408,15 @@
|
||||
void QIconView::contentsMousePressEventEx( QMouseEvent *e )
|
||||
{
|
||||
if ( d->rubber ) {
|
||||
- QPainter p;
|
||||
- p.begin( viewport() );
|
||||
- p.setRasterOp( NotROP );
|
||||
- p.setPen( QPen( color0, 1 ) );
|
||||
- p.setBrush( NoBrush );
|
||||
+ QRect r( d->rubber->normalize() );
|
||||
+ delete d->rubber;
|
||||
+ d->rubber = 0;
|
||||
+
|
||||
+ repaintContents( r, FALSE );
|
||||
+ d->dragging = FALSE;
|
||||
|
||||
- drawRubber( &p );
|
||||
- d->dragging = FALSE;
|
||||
- p.end();
|
||||
- delete d->rubber;
|
||||
- d->rubber = 0;
|
||||
+ delete d->backrubber;
|
||||
+ d->backrubber = 0;
|
||||
|
||||
if ( d->scrollTimer ) {
|
||||
disconnect( d->scrollTimer, SIGNAL( timeout() ), this, SLOT( doAutoScroll() ) );
|
||||
@@ -4560,21 +4601,17 @@
|
||||
d->startDragItem = 0;
|
||||
|
||||
if ( d->rubber ) {
|
||||
- QPainter p;
|
||||
- p.begin( viewport() );
|
||||
- p.setRasterOp( NotROP );
|
||||
- p.setPen( QPen( color0, 1 ) );
|
||||
- p.setBrush( NoBrush );
|
||||
-
|
||||
- drawRubber( &p );
|
||||
- d->dragging = FALSE;
|
||||
- p.end();
|
||||
-
|
||||
+ QRect r(d->rubber->normalize());
|
||||
+
|
||||
if ( ( d->rubber->topLeft() - d->rubber->bottomRight() ).manhattanLength() >
|
||||
QApplication::startDragDistance() )
|
||||
emitClicked = FALSE;
|
||||
delete d->rubber;
|
||||
- d->rubber = 0;
|
||||
+ d->rubber = 0;
|
||||
+ repaintContents(r, FALSE);
|
||||
+ d->dragging = FALSE;
|
||||
+ delete d->backrubber;
|
||||
+ d->backrubber = 0;
|
||||
d->currentItem = d->tmpCurrentItem;
|
||||
d->tmpCurrentItem = 0;
|
||||
if ( d->currentItem )
|
||||
@@ -5334,9 +5371,9 @@
|
||||
QPoint pnt( d->rubber->x(), d->rubber->y() );
|
||||
pnt = contentsToViewport( pnt );
|
||||
|
||||
- style().drawPrimitive(QStyle::PE_RubberBand, p,
|
||||
- QRect(pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height()),
|
||||
- colorGroup(), QStyle::Style_Default, QStyleOption(colorGroup().base()));
|
||||
+ style().drawPrimitive( QStyle::PE_RubberBand, p,
|
||||
+ QRect( pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height() ).normalize(),
|
||||
+ colorGroup(), QStyle::Style_Default, QStyleOption(colorGroup().base()) );
|
||||
}
|
||||
|
||||
/*!
|
Loading…
Reference in new issue