|
AlbumShaper
1.0a3
|
#include <item.h>


Public Member Functions | |
| Item (QIconView *parent, QPixmap icon, QString text) | |
| void | paintItem (QPainter *p, const QColorGroup &cg) |
| void | paintFocus (QPainter *, const QColorGroup &) |
| void | setMousedOver (bool val) |
| void | setTextWidth (int w) |
Private Attributes | |
| bool | mousedOver |
| Item::Item | ( | QIconView * | parent, |
| QPixmap | icon, | ||
| QString | text | ||
| ) |
Definition at line 21 of file item.cpp.
References mousedOver.
: QIconViewItem(parent, text, icon) { mousedOver = false; }
| void Item::paintFocus | ( | QPainter * | , |
| const QColorGroup & | |||
| ) | [inline] |
| void Item::paintItem | ( | QPainter * | p, |
| const QColorGroup & | cg | ||
| ) |
Definition at line 26 of file item.cpp.
References height, and mousedOver.
{
p->save();
QRect r = rect();
//if selected paint dark blue background and outline
if(isSelected())
{
//Draw Selected Color (dark blue)
p->fillRect( r, QColor(193, 210, 238) );
//draw selection rectangle (darker blue)
p->setPen( QColor(49, 106, 197) );
p->drawRect(r);
}
//else if pseudo selected paint ligher blue background with outline
else if(mousedOver)
{
//Draw Pseudo Selected Color (light blue)
p->fillRect( r, QColor(224, 232, 246) );
//draw selection rectangle (darker blue)
p->setPen( QColor(152, 180, 226) );
p->drawRect(r);
}
p->restore();
p->drawPixmap( x() , y() + ( height() - pixmap()->height() ) / 2, *pixmap());
int align = AlignLeft | WordBreak | BreakAnywhere;
p->drawText( textRect( FALSE ), align, text());
}
| void Item::setMousedOver | ( | bool | val | ) |
Definition at line 60 of file item.cpp.
References mousedOver.
Referenced by Items::clearPseudoSelection(), and Items::repaintGroup().
{ mousedOver = val; }
| void Item::setTextWidth | ( | int | w | ) |
Definition at line 63 of file item.cpp.
References height, and topLeft.
{
QRect pr = pixmapRect();
pr.moveBy( 3, 3 );
setPixmapRect( pr );
QRect tr = textRect();
tr.moveBy( 3, 3 );
tr.setRight( tr.left() + w);
setTextRect( tr );
int newW = pixmapRect().width() + 6 + w;
int newH = QMAX( textRect().height(), pixmapRect().height() ) + 6;
setItemRect( QRect( rect().topLeft(), QSize(newW, newH)) );
}
bool Item::mousedOver [private] |
Definition at line 35 of file item.h.
Referenced by Item(), paintItem(), and setMousedOver().
1.7.5.1