#include <item.h>
Inheritance diagram for Item:
Definition at line 25 of file 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.
00021 : QIconViewItem(parent, text, icon) 00022 { 00023 mousedOver = false; 00024 }
void Item::paintItem | ( | QPainter * | p, | |
const QColorGroup & | cg | |||
) |
Definition at line 26 of file item.cpp.
References height, and mousedOver.
00027 { 00028 p->save(); 00029 QRect r = rect(); 00030 00031 //if selected paint dark blue background and outline 00032 if(isSelected()) 00033 { 00034 //Draw Selected Color (dark blue) 00035 p->fillRect( r, QColor(193, 210, 238) ); 00036 00037 //draw selection rectangle (darker blue) 00038 p->setPen( QColor(49, 106, 197) ); 00039 p->drawRect(r); 00040 } 00041 //else if pseudo selected paint ligher blue background with outline 00042 else if(mousedOver) 00043 { 00044 //Draw Pseudo Selected Color (light blue) 00045 p->fillRect( r, QColor(224, 232, 246) ); 00046 00047 //draw selection rectangle (darker blue) 00048 p->setPen( QColor(152, 180, 226) ); 00049 p->drawRect(r); 00050 } 00051 00052 p->restore(); 00053 00054 p->drawPixmap( x() , y() + ( height() - pixmap()->height() ) / 2, *pixmap()); 00055 00056 int align = AlignLeft | WordBreak | BreakAnywhere; 00057 p->drawText( textRect( FALSE ), align, text()); 00058 }
void Item::paintFocus | ( | QPainter * | , | |
const QColorGroup & | ||||
) | [inline] |
void Item::setMousedOver | ( | bool | val | ) |
Definition at line 60 of file item.cpp.
References mousedOver.
Referenced by Items::clearPseudoSelection(), and Items::repaintGroup().
00061 { mousedOver = val; }
void Item::setTextWidth | ( | int | w | ) |
Definition at line 63 of file item.cpp.
References height, and topLeft.
00064 { 00065 QRect pr = pixmapRect(); 00066 pr.moveBy( 3, 3 ); 00067 setPixmapRect( pr ); 00068 00069 QRect tr = textRect(); 00070 tr.moveBy( 3, 3 ); 00071 tr.setRight( tr.left() + w); 00072 setTextRect( tr ); 00073 00074 int newW = pixmapRect().width() + 6 + w; 00075 int newH = QMAX( textRect().height(), pixmapRect().height() ) + 6; 00076 00077 setItemRect( QRect( rect().topLeft(), QSize(newW, newH)) ); 00078 }
bool Item::mousedOver [private] |