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

Displays group icon and text, also contains pointer to widget for setting group settings. More...

#include <groupIcon.h>

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

Public Member Functions

 GroupIcon (Q3IconView *parent, QPixmap icon, QString text, QWidget *settingsWidget)
 
void paintItem (QPainter *p, const QColorGroup &cg)
 
void paintFocus (QPainter *p, const QColorGroup &cg)
 
void setMousedOver (bool val)
 
QWidgetgetSettingsWidget ()
 

Private Member Functions

void initializeItemRect ()
 

Private Attributes

Q3IconViewparent
 
QWidgetsettingsWidget
 
bool mousedOver
 

Detailed Description

Displays group icon and text, also contains pointer to widget for setting group settings.

Definition at line 30 of file groupIcon.h.

Constructor & Destructor Documentation

◆ GroupIcon()

GroupIcon::GroupIcon ( Q3IconView parent,
QPixmap  icon,
QString  text,
QWidget settingsWidget 
)

Definition at line 22 of file groupIcon.cpp.

23  :
24  Q3IconViewItem(parent, text, icon)
25 {
26  this->parent = parent;
27  this->settingsWidget = settingsWidget;
28  mousedOver = false;
29 
30  //initialize item rectangle
32 }
void initializeItemRect()
Definition: groupIcon.cpp:74
Q3IconView * parent
Definition: groupIcon.h:53
bool mousedOver
Definition: groupIcon.h:55
QWidget * settingsWidget
Definition: groupIcon.h:54

References initializeItemRect(), mousedOver, parent, and settingsWidget.

Member Function Documentation

◆ getSettingsWidget()

QWidget * GroupIcon::getSettingsWidget ( )

Definition at line 70 of file groupIcon.cpp.

70 { return settingsWidget; }

References settingsWidget.

◆ initializeItemRect()

void GroupIcon::initializeItemRect ( )
private

Definition at line 74 of file groupIcon.cpp.

75 {
76  //reset pixmap rect
77  QRect pr = pixmapRect();
78  int prWidth = pr.width();
79  int prHeight = pr.height();
80  pr.setTopLeft( QPoint(3,3) );
81  pr.setBottomRight( QPoint(pr.left()+prWidth, pr.top()+prHeight) );
82  setPixmapRect( pr );
83 
84  //reset text rect
85  int textWidth = ((GroupsWidget*)parent)->getTextWidth();
86  QRect tr = textRect();
87  tr.setTop( pixmapRect().top() );
88  tr.setBottom( pixmapRect().bottom() );
89  tr.setLeft( pixmapRect().right() + 2 );
90  tr.setRight( tr.left() + textWidth );
91  setTextRect( tr );
92 
93  //reset item rect using pixmap and text rect dimensions
94  int itemW = 3 + pixmapRect().width() + (tr.left() - pr.right()) + textRect().width() + 3;
95  int itemH = 3 + pixmapRect().height() + 3;
96  setItemRect( QRect( pixmapRect().left() - 3, pixmapRect().top() - 3, itemW, itemH ) );
97 }
Displays group icon and text, also contains pointer to widget for setting group settings.
Definition: groupsWidget.h:29

References parent.

Referenced by GroupIcon().

◆ paintFocus()

void GroupIcon::paintFocus ( QPainter *  p,
const QColorGroup &  cg 
)

Definition at line 68 of file groupIcon.cpp.

68 { }

◆ paintItem()

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

Definition at line 34 of file groupIcon.cpp.

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

References height, and mousedOver.

◆ setMousedOver()

void GroupIcon::setMousedOver ( bool  val)

Definition at line 72 of file groupIcon.cpp.

72 { mousedOver = val; }

References mousedOver.

Referenced by ConfigurationWidget::clearPseudoSelection(), and ConfigurationWidget::repaintGroup().

Member Data Documentation

◆ mousedOver

bool GroupIcon::mousedOver
private

Definition at line 55 of file groupIcon.h.

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

◆ parent

Q3IconView* GroupIcon::parent
private

Definition at line 53 of file groupIcon.h.

Referenced by GroupIcon(), and initializeItemRect().

◆ settingsWidget

QWidget* GroupIcon::settingsWidget
private

Definition at line 54 of file groupIcon.h.

Referenced by getSettingsWidget(), and GroupIcon().


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