#include <photoWidget.h>
Inheritance diagram for PhotoWidget:


Definition at line 34 of file photoWidget.h.
Public Member Functions | |
| PhotoWidget (PhotosIconView *parent, Photo *phto) | |
| Sets subalbum pointer. | |
| Photo * | getPhoto () |
| Returns photo pointer. | |
| void | sync () |
| Syncs photo's description. | |
| void | updateImage () |
| Update photo thumbnail from background object. | |
| void | updateDescription () |
| Update photo description. | |
| void | paintItem (QPainter *p, const QColorGroup &cg) |
| Repain iconview item. | |
| void | setText (const QString &text) |
| bool | acceptDrop (const QMimeSource *e) const |
| int | compare (QIconViewItem *i) const |
Private Member Functions | |
| void | dropped (QDropEvent *e, const QValueList< QIconDragItem > &lst) |
Private Attributes | |
| Photo * | phto |
| Pointer to photo backend object. | |
| PhotosIconView * | parent |
| Parent. | |
|
||||||||||||
|
Sets subalbum pointer.
Definition at line 28 of file photoWidget.cpp. References PADDED_THUMBNAIL, and phto.
00029 : QIconViewItem( parent, 00030 phto->getDescription(), 00031 *phto->getImage(PADDED_THUMBNAIL) ) 00032 { 00033 this->parent = parent; 00034 this->phto = phto; 00035 } |
|
|
Definition at line 155 of file photoWidget.cpp.
00156 {
00157 return true;
00158 }
|
|
|
Definition at line 160 of file photoWidget.cpp.
00161 {
00162 if( pos().y() > (i->pos().y() + height()) ||
00163 (
00164 pos().y() >= i->pos().y() &&
00165 pos().x() >= i->pos().x()
00166 ))
00167 { return 1; }
00168 else
00169 { return -1; }
00170 }
|
|
||||||||||||
|
Definition at line 99 of file photoWidget.cpp. References parent.
00100 {
00101 //item is being moved around within subalbum
00102 if(e->source()->parentWidget() == parent)
00103 {
00104 //selected photos dropped on left of object
00105 if(e->pos().x() < (x() + (width()/2)))
00106 {
00107 //count number of items being moved
00108 int num=0;
00109 QIconViewItem* current = parent->firstItem();
00110 while(current != NULL)
00111 {
00112 if(current->isSelected())
00113 {
00114 num++;
00115 }
00116 current = current->nextItem();
00117 }
00118
00119 //compute new x-coordinate of first object being moved
00120 int xpos = x() - num;
00121
00122 //iterate over each object being moved and move to their new location
00123 current = parent->firstItem();
00124 while(current != NULL)
00125 {
00126 if(current->isSelected())
00127 {
00128 current->move(xpos, y());
00129 xpos++;
00130 }
00131 current = current->nextItem();
00132 }
00133 } //end if
00134 //selected photos being dropped on right of object
00135 else
00136 {
00137 //compute first new x coordinate for selected photos
00138 int xpos = x() + (width()/2) + 1;
00139
00140 //iterate over all selected photos and move to their new location
00141 QIconViewItem* current = parent->firstItem();
00142 while(current != NULL)
00143 {
00144 if(current->isSelected())
00145 {
00146 current->move(xpos, y());
00147 xpos++;
00148 }
00149 current = current->nextItem();
00150 }
00151 } //end else
00152 }
00153 }
|
|
|
Returns photo pointer.
Definition at line 37 of file photoWidget.cpp. References phto. Referenced by Subalbum::syncPhotoList().
00038 {
00039 return phto;
00040 }
|
|
||||||||||||
|
Repain iconview item.
Definition at line 57 of file photoWidget.cpp.
00059 {
00060 if(isSelected())
00061 {
00062 //draw red border around item
00063 int align = AlignHCenter;
00064 align |= WordBreak | BreakAnywhere;
00065
00066 //create buffer to draw in
00067 QRect rct = rect();
00068 rct.moveBy(-x(), -y());
00069 QPixmap buffer( size() );
00070 //create a painter pointing to the buffer
00071 QPainter bp( &buffer );
00072 //paint to buffer
00073 bp.setBrushOrigin( p->brushOrigin() );
00074 bp.fillRect( rct, white );
00075 QRect pr = pixmapRect(false);
00076 pr.moveBy(-x(), -y());
00077 bp.drawPixmap(pr, *pixmap());
00078 QRect tr = textRect(false);
00079 tr.moveBy(-x(), -y());
00080 bp.drawText(tr,align, text());
00081 bp.setPen( red );
00082 bp.drawRect(rct);
00083 bp.end();
00084 //paint buffer to widget
00085 p->drawPixmap( x(), y(), buffer );
00086 }
00087 else
00088 {
00089 QIconViewItem::paintItem ( p, cg);
00090 }
00091 }
|
|
|
Definition at line 93 of file photoWidget.cpp. References sync(). Referenced by updateDescription().
00094 {
00095 sync();
00096 QIconViewItem::setText(text);
00097 }
|
|
|
Syncs photo's description.
Definition at line 42 of file photoWidget.cpp. References phto, and Photo::setDescription(). Referenced by setText(), and SubalbumWidget::syncPhotos().
00043 {
00044 phto->setDescription(text());
00045 }
|
|
|
Update photo description.
Definition at line 52 of file photoWidget.cpp. References Photo::getDescription(), phto, and setText().
00053 {
00054 this->setText( phto->getDescription() );
00055 }
|
|
|
Update photo thumbnail from background object.
Definition at line 47 of file photoWidget.cpp. References Photo::getImage(), PADDED_THUMBNAIL, and phto.
|
|
|
Parent.
Definition at line 70 of file photoWidget.h. Referenced by dropped(). |
|
|
Pointer to photo backend object.
Definition at line 67 of file photoWidget.h. Referenced by getPhoto(), PhotoWidget(), sync(), updateDescription(), and updateImage(). |
1.3.4