00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <qpixmap.h>
00019 #include <qpainter.h>
00020
00021
00022 #include "photosIconView.h"
00023
00024 PhotosIconView::PhotosIconView( QWidget *parent ) : QIconView( parent )
00025 {
00026 }
00027
00028 void PhotosIconView::contentsDropEvent( QDropEvent *e )
00029 {
00030 QIconView::contentsDropEvent( e );
00031
00032
00033 QIconViewItem *item = findItem( e->pos() );
00034
00035
00036
00037 if( item != NULL && e->source() == viewport())
00038 emit itemHasMoved();
00039 }
00040
00041 void PhotosIconView::drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph )
00042 {
00043 if( bufferPixmap.size() != size())
00044 { bufferPixmap.resize( size() ); }
00045 QPainter bufferPainter( &bufferPixmap, viewport() );
00046 int xOffset = clipx - contentsX();
00047 int yOffset = clipy - contentsY();
00048
00049 bufferPainter.translate( -contentsX(), -contentsY() );
00050 QIconView::drawContents( &bufferPainter, clipx, clipy, clipw, cliph );
00051 bitBlt(p->device(), xOffset, yOffset, &bufferPixmap, xOffset, yOffset, clipw, cliph );
00052 }
00053
00054 int PhotosIconView::numSelected()
00055 {
00056 int num = 0;
00057 QIconViewItem* current = firstItem();
00058 while(current != NULL)
00059 {
00060 if(current->isSelected())
00061 num++;
00062 current = current->nextItem();
00063 }
00064 return num;
00065 }
00066