AlbumShaper  1.0a3
Public Member Functions | Private Attributes | List of all members
Item Class Reference

#include <item.h>

Inheritance diagram for Item:
Inheritance graph
[legend]
Collaboration diagram for Item:
Collaboration graph
[legend]

Public Member Functions

 Item (Q3IconView *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
 

Detailed Description

Definition at line 27 of file item.h.

Constructor & Destructor Documentation

§ Item()

Item::Item ( Q3IconView parent,
QPixmap  icon,
QString  text 
)

Definition at line 21 of file item.cpp.

References mousedOver.

21  : Q3IconViewItem(parent, text, icon)
22 {
23  mousedOver = false;
24 }
bool mousedOver
Definition: item.h:37

Member Function Documentation

§ paintFocus()

void Item::paintFocus ( QPainter *  ,
const QColorGroup &   
)
inline

Definition at line 33 of file item.h.

References setMousedOver(), and setTextWidth().

33 { }

§ paintItem()

void Item::paintItem ( QPainter *  p,
const QColorGroup &  cg 
)

Definition at line 26 of file item.cpp.

References height, and mousedOver.

27 {
28  p->save();
29  QRect r = rect();
30 
31  //if selected paint dark blue background and outline
32  if(isSelected())
33  {
34  //Draw Selected Color (dark blue)
35  p->fillRect( r, QColor(193, 210, 238) );
36 
37  //draw selection rectangle (darker blue)
38  p->setPen( QColor(49, 106, 197) );
39  p->drawRect(r);
40  }
41  //else if pseudo selected paint ligher blue background with outline
42  else if(mousedOver)
43  {
44  //Draw Pseudo Selected Color (light blue)
45  p->fillRect( r, QColor(224, 232, 246) );
46 
47  //draw selection rectangle (darker blue)
48  p->setPen( QColor(152, 180, 226) );
49  p->drawRect(r);
50  }
51 
52  p->restore();
53 
54  p->drawPixmap( x() , y() + ( height() - pixmap()->height() ) / 2, *pixmap());
55 
56  int align = Qt::AlignLeft | Qt::TextWordWrap | Qt::TextWrapAnywhere;
57  p->drawText( textRect( FALSE ), align, text());
58 }
bool mousedOver
Definition: item.h:37
int height
Definition: blur.cpp:79

§ setMousedOver()

void Item::setMousedOver ( bool  val)

Definition at line 60 of file item.cpp.

References mousedOver.

Referenced by Items::clearPseudoSelection(), paintFocus(), and Items::repaintGroup().

61 { mousedOver = val; }
bool mousedOver
Definition: item.h:37

§ setTextWidth()

void Item::setTextWidth ( int  w)

Definition at line 63 of file item.cpp.

References height, and topLeft.

Referenced by paintFocus().

64 {
65  QRect pr = pixmapRect();
66  pr.moveBy( 3, 3 );
67  setPixmapRect( pr );
68 
69  QRect tr = textRect();
70  tr.moveBy( 3, 3 );
71  tr.setRight( tr.left() + w);
72  setTextRect( tr );
73 
74  int newW = pixmapRect().width() + 6 + w;
75  int newH = QMAX( textRect().height(), pixmapRect().height() ) + 6;
76 
77  setItemRect( QRect( rect().topLeft(), QSize(newW, newH)) );
78 }
QPoint topLeft
int height
Definition: blur.cpp:79

Member Data Documentation

§ mousedOver

bool Item::mousedOver
private

Definition at line 37 of file item.h.

Referenced by Item(), paintItem(), and setMousedOver().


The documentation for this class was generated from the following files: