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:
[legend]
Collaboration diagram for GroupIcon:
[legend]

List of all members.

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)
QWidgetgetSettingsWidget ()

Private Member Functions

void initializeItemRect ()

Private Attributes

QIconViewparent
QWidgetsettingsWidget
bool mousedOver

Detailed Description

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

Definition at line 28 of file groupIcon.h.


Constructor & Destructor Documentation

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

Definition at line 22 of file groupIcon.cpp.

References initializeItemRect(), and mousedOver.

00024                                                              :
00025                       QIconViewItem(parent, text, icon)
00026 {
00027   this->parent = parent;
00028   this->settingsWidget = settingsWidget;
00029   mousedOver = false;
00030   
00031   //initialize item rectangle
00032   initializeItemRect();
}


Member Function Documentation

QWidget * GroupIcon::getSettingsWidget (  ) 

Definition at line 70 of file groupIcon.cpp.

References settingsWidget.

00070 { return settingsWidget; }

void GroupIcon::initializeItemRect (  )  [private]

Definition at line 74 of file groupIcon.cpp.

References parent.

Referenced by GroupIcon().

00075 {
00076   //reset pixmap rect
00077   QRect pr = pixmapRect();
00078   int prWidth  = pr.width();
00079   int prHeight = pr.height();
00080   pr.setTopLeft( QPoint(3,3) );
00081   pr.setBottomRight( QPoint(pr.left()+prWidth, pr.top()+prHeight) );
00082   setPixmapRect( pr );
00083   
00084   //reset text rect
00085   int textWidth = ((GroupsWidget*)parent)->getTextWidth();
00086   QRect tr = textRect();
00087   tr.setTop( pixmapRect().top() );
00088   tr.setBottom( pixmapRect().bottom() );
00089   tr.setLeft( pixmapRect().right() + 2 );
00090   tr.setRight( tr.left() + textWidth );
00091   setTextRect( tr );
00092   
00093   //reset item rect using pixmap and text rect dimensions
00094   int itemW = 3 + pixmapRect().width() + (tr.left() - pr.right()) + textRect().width() + 3;
00095   int itemH = 3 + pixmapRect().height() + 3;
00096   setItemRect( QRect( pixmapRect().left() - 3, pixmapRect().top() - 3, itemW, itemH ) );
00097 }

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

Definition at line 68 of file groupIcon.cpp.

00068 { }

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

Definition at line 34 of file groupIcon.cpp.

References height, and mousedOver.

00035 {
00036   p->save();
00037   QRect r = rect();
00038 
00039   //if selected paint dark blue background and outline
00040   if(isSelected())
00041   {
00042     //Draw Selected Color (dark blue)
00043     p->fillRect( r, QColor(193, 210, 238) );
00044 
00045     //draw selection rectangle (darker blue)
00046     p->setPen( QColor(49, 106, 197) );
00047     p->drawRect(r);
00048   }
00049   //else if pseudo selected paint ligher blue background with outline
00050   else if(mousedOver)
00051   {
00052     //Draw Pseudo Selected Color (light blue)
00053     p->fillRect( r, QColor(224, 232, 246) );
00054 
00055     //draw selection rectangle (darker blue)
00056     p->setPen( QColor(152, 180, 226) );
00057     p->drawRect(r);
00058   }
00059 
00060   p->restore();
00061 
00062   p->drawPixmap( x()+3 , y() + ( height() - pixmap()->height() ) / 2, *pixmap());
00063 
00064   int align = AlignLeft | WordBreak | BreakAnywhere;
00065   p->drawText( textRect( FALSE ), align, text());
00066 }

void GroupIcon::setMousedOver ( bool  val  ) 

Definition at line 72 of file groupIcon.cpp.

References mousedOver.

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

00072 { mousedOver = val; }


Member Data Documentation

bool GroupIcon::mousedOver [private]

Definition at line 53 of file groupIcon.h.

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

Definition at line 51 of file groupIcon.h.

Referenced by initializeItemRect().

Definition at line 52 of file groupIcon.h.

Referenced by getSettingsWidget().


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

Generated by  doxygen 1.6.2