#include <subalbumsIconView.h>
Inheritance diagram for SubalbumsIconView:
Definition at line 31 of file subalbumsIconView.h.
Signals | |
| void | itemHasMoved () |
Public Member Functions | |
| SubalbumsIconView (QWidget *parent) | |
| int | getTextWidth () |
| QSize | minimumSizeHint () const |
| QSize | sizeHint () const |
Protected Member Functions | |
| void | drawContents (QPainter *p, int clipx, int clipy, int clipw, int cliph) |
| QDragObject * | dragObject () |
| void | contentsMousePressEvent (QMouseEvent *e) |
| void | contentsDragMoveEvent (QDragMoveEvent *e) |
Private Slots | |
| void | repaintGroup (QIconViewItem *pseudoSelection) |
| void | clearPseudoSelection () |
Private Member Functions | |
| void | contentsDropEvent (QDropEvent *e) |
Private Attributes | |
| QPixmap | bufferPixmap |
| QPoint | dragStartPos |
| SubalbumPreviewWidget * | currentPseudoSelection |
| int | textWidth |
|
|
Definition at line 28 of file subalbumsIconView.cpp. References clearPseudoSelection(), currentPseudoSelection, repaintGroup(), and textWidth. 00028 : QIconView( parent ) 00029 { 00030 // setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum); 00031 setMouseTracking(true); 00032 00033 currentPseudoSelection = NULL; 00034 00035 //connect mouse over events to paint pseudo selection in ligher blue 00036 connect( this, SIGNAL(onItem(QIconViewItem*)), 00037 this, SLOT(repaintGroup(QIconViewItem*)) ); 00038 00039 //clear any pseudo selection when mouse moves off icons 00040 connect( this, SIGNAL(onViewport()), 00041 this, SLOT(clearPseudoSelection()) ); 00042 00043 //compute textWidth for collection names using a calibration string 00044 QString calibrationString( qApp->translate("SubalbumPreviewWidget", "Calibration String") ); 00045 QFontMetrics fm( qApp->font() ); 00046 textWidth = fm.width( calibrationString ); 00047 }
|
|
|
Definition at line 167 of file subalbumsIconView.cpp. References currentPseudoSelection, and SubalbumPreviewWidget::setMousedOver(). Referenced by repaintGroup(), and SubalbumsIconView(). 00168 {
00169 //if old pseudo selection unselect it
00170 if(currentPseudoSelection != NULL)
00171 {
00172 currentPseudoSelection->setMousedOver(false);
00173 repaintItem(currentPseudoSelection);
00174 currentPseudoSelection = NULL;
00175 }
00176 }
|
|
|
Definition at line 111 of file subalbumsIconView.cpp. References currentPseudoSelection, and SubalbumPreviewWidget::setMousedOver(). 00112 {
00113 QIconView::contentsDragMoveEvent( e );
00114 e->accept(true);
00115
00116 //if source of drag is not from application then return
00117 if(e->source() == NULL)
00118 return;
00119
00120 //if source of drag is from within this view then return, in the future we'll put
00121 //drag code in here to drag indicators for rearranging the items of the iconview
00122 if(e->source() == viewport() )
00123 {
00124
00125 }
00126 //else if source is from photos iconview
00127 else if(e->source()->parentWidget() == ((LayoutWidget*)parentWidget()->parentWidget())->getSubalbum()->getPhotos() )
00128 {
00129 SubalbumPreviewWidget* item = (SubalbumPreviewWidget*)findItem( e->pos() );
00130
00131 //if item pointer same as current pseudo selection ignore
00132 if(item == currentPseudoSelection)
00133 {
00134 return;
00135 }
00136
00137 //unpaint old selection
00138 if(currentPseudoSelection != NULL)
00139 {
00140 currentPseudoSelection->setMousedOver(false);
00141 repaintItem(currentPseudoSelection);
00142 }
00143
00144 //set new selection
00145 currentPseudoSelection = item;
00146
00147 //repaint new selection
00148 if(currentPseudoSelection != NULL)
00149 {
00150 currentPseudoSelection->setMousedOver(true);
00151 repaintItem(currentPseudoSelection);
00152 }
00153 }
00154 }
|
|
|
Definition at line 49 of file subalbumsIconView.cpp. References itemHasMoved(). 00050 {
00051 QIconView::contentsDropEvent( e );
00052
00053 //if drop originated from this viewport then emit item moved signal
00054 if(e->source() == viewport() )
00055 emit itemHasMoved();
00056 }
|
|
|
Definition at line 71 of file subalbumsIconView.cpp. References dragStartPos. 00072 {
00073 //ignore all clicks other than left-clicks
00074 if( e->button() != Qt::LeftButton ) return;
00075
00076 dragStartPos = e->pos();
00077 QIconView::contentsMousePressEvent( e );
00078 }
|
|
|
Definition at line 80 of file subalbumsIconView.cpp. References buffer, dragStartPos, and SubalbumPreviewWidget::paint(). 00081 {
00082 //no item selected?
00083 if( !currentItem() )
00084 return 0;
00085
00086 //create drag object
00087 QIconDrag *drag = new QIconDrag( viewport() );
00088
00089 //create buffer and paint item to buffer
00090 QRect r = currentItem()->rect();
00091 QPixmap buffer( r.width(), r.height() );
00092 QPainter painter( &buffer, this );
00093 painter.translate( -r.x(), -r.y() );
00094 ((SubalbumPreviewWidget*)currentItem())->paint( &painter );
00095
00096 //clip off background color around edges which was used for anti-aliasing edges.
00097 //result image will have semi-selection oval around it.
00098 QBitmap bit = buffer.createHeuristicMask();
00099 buffer.setMask( bit );
00100
00101 //set pixmap to use buffer
00102 drag->setPixmap( buffer, QPoint( dragStartPos.x() - r.x(), dragStartPos.y() - r.y() ) );
00103
00104 //we don't want to show any rectangles, but if we don't append two null rectangles the last drag rectangles this iconview displayed
00105 //possibly form objects dropped onto it from outside the viewport, aka photos, will be drawn! :(
00106 drag->append( QIconDragItem(), QRect(), QRect() );
00107
00108 return drag;
00109 }
|
|
||||||||||||||||||||||||
|
Definition at line 58 of file subalbumsIconView.cpp. References bufferPixmap. 00059 {
00060 if( bufferPixmap.size() != size())
00061 { bufferPixmap.resize( size() ); }
00062 QPainter bufferPainter( &bufferPixmap, viewport() );
00063 int xOffset = clipx - contentsX();
00064 int yOffset = clipy - contentsY();
00065
00066 bufferPainter.translate( -contentsX(), -contentsY() );
00067 QIconView::drawContents( &bufferPainter, clipx, clipy, clipw, cliph );
00068 bitBlt(p->device(), xOffset, yOffset, &bufferPixmap, xOffset, yOffset, clipw, cliph );
00069 }
|
|
|
Definition at line 178 of file subalbumsIconView.cpp. Referenced by SubalbumPreviewWidget::initializeItemRect(), and SubalbumPreviewWidget::setText(). 00179 { return textWidth; }
|
|
|
Referenced by contentsDropEvent(). |
|
|
Definition at line 181 of file subalbumsIconView.cpp. References sizeHint(). 00181 { return sizeHint(); }
|
|
|
Definition at line 156 of file subalbumsIconView.cpp. References clearPseudoSelection(), currentPseudoSelection, and SubalbumPreviewWidget::setMousedOver(). Referenced by SubalbumsIconView(). 00157 {
00158 //if old pseudo selection unselect it
00159 clearPseudoSelection();
00160
00161 //paint new selection
00162 currentPseudoSelection = (SubalbumPreviewWidget*)pseudoSelection;
00163 currentPseudoSelection->setMousedOver(true);
00164 repaintItem(currentPseudoSelection);
00165 }
|
|
|
Definition at line 183 of file subalbumsIconView.cpp. Referenced by minimumSizeHint(). 00184 {
00185 QSize s = QIconView::sizeHint();
00186
00187 //find max item width
00188 s.setWidth(0);
00189 QIconViewItem *item;
00190 for( item = firstItem(); item != NULL; item = item->nextItem() )
00191 {
00192 if(item->width() > s.width() )
00193 s.setWidth( item->width() );
00194 }
00195 s.setWidth( s.width() + 2*spacing() + verticalScrollBar()->sizeHint().width() );
00196 return s;
00197 }
|
|
|
Definition at line 59 of file subalbumsIconView.h. Referenced by drawContents(). |
|
|
Definition at line 61 of file subalbumsIconView.h. Referenced by clearPseudoSelection(), contentsDragMoveEvent(), repaintGroup(), and SubalbumsIconView(). |
|
|
Definition at line 60 of file subalbumsIconView.h. Referenced by contentsMousePressEvent(), and dragObject(). |
|
|
Definition at line 65 of file subalbumsIconView.h. Referenced by SubalbumsIconView(). |
1.3.9.1