AlbumShaper
1.0a3
|
Displays group icon and text, also contains pointer to widget for setting group settings. More...
#include <groupIcon.h>
Public Member Functions | |
GroupIcon (QIconView *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) |
QWidget * | getSettingsWidget () |
Private Member Functions | |
void | initializeItemRect () |
Private Attributes | |
QIconView * | parent |
QWidget * | settingsWidget |
bool | mousedOver |
Displays group icon and text, also contains pointer to widget for setting group settings.
Definition at line 28 of file groupIcon.h.
Definition at line 22 of file groupIcon.cpp.
References initializeItemRect(), mousedOver, parent, and settingsWidget.
: QIconViewItem(parent, text, icon) { this->parent = parent; this->settingsWidget = settingsWidget; mousedOver = false; //initialize item rectangle initializeItemRect(); }
QWidget * GroupIcon::getSettingsWidget | ( | ) |
void GroupIcon::initializeItemRect | ( | ) | [private] |
Definition at line 74 of file groupIcon.cpp.
References parent.
Referenced by GroupIcon().
{ //reset pixmap rect QRect pr = pixmapRect(); int prWidth = pr.width(); int prHeight = pr.height(); pr.setTopLeft( QPoint(3,3) ); pr.setBottomRight( QPoint(pr.left()+prWidth, pr.top()+prHeight) ); setPixmapRect( pr ); //reset text rect int textWidth = ((GroupsWidget*)parent)->getTextWidth(); QRect tr = textRect(); tr.setTop( pixmapRect().top() ); tr.setBottom( pixmapRect().bottom() ); tr.setLeft( pixmapRect().right() + 2 ); tr.setRight( tr.left() + textWidth ); setTextRect( tr ); //reset item rect using pixmap and text rect dimensions int itemW = 3 + pixmapRect().width() + (tr.left() - pr.right()) + textRect().width() + 3; int itemH = 3 + pixmapRect().height() + 3; setItemRect( QRect( pixmapRect().left() - 3, pixmapRect().top() - 3, itemW, itemH ) ); }
void GroupIcon::paintFocus | ( | QPainter * | p, |
const QColorGroup & | cg | ||
) |
Definition at line 68 of file groupIcon.cpp.
{ }
void GroupIcon::paintItem | ( | QPainter * | p, |
const QColorGroup & | cg | ||
) |
Definition at line 34 of file groupIcon.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()+3 , y() + ( height() - pixmap()->height() ) / 2, *pixmap()); int align = AlignLeft | WordBreak | BreakAnywhere; p->drawText( textRect( FALSE ), align, text()); }
void GroupIcon::setMousedOver | ( | bool | val | ) |
Definition at line 72 of file groupIcon.cpp.
References mousedOver.
Referenced by ConfigurationWidget::clearPseudoSelection(), and ConfigurationWidget::repaintGroup().
{ mousedOver = val; }
bool GroupIcon::mousedOver [private] |
Definition at line 53 of file groupIcon.h.
Referenced by GroupIcon(), paintItem(), and setMousedOver().
QIconView* GroupIcon::parent [private] |
Definition at line 51 of file groupIcon.h.
Referenced by GroupIcon(), and initializeItemRect().
QWidget* GroupIcon::settingsWidget [private] |
Definition at line 52 of file groupIcon.h.
Referenced by getSettingsWidget(), and GroupIcon().