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

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

#include <groupsWidget.h>

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

Public Member Functions

 GroupsWidget (QWidget *parent=0, const char *name=0)
 
void keyPressEvent (QKeyEvent *e)
 
QSize sizeHint () const
 
void setTextWidth (int val)
 
int getTextWidth ()
 

Protected Member Functions

void contentsMousePressEvent (QMouseEvent *e)
 

Private Attributes

int textWidth
 

Detailed Description

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

Definition at line 28 of file groupsWidget.h.

Constructor & Destructor Documentation

§ GroupsWidget()

GroupsWidget::GroupsWidget ( QWidget parent = 0,
const char *  name = 0 
)

Definition at line 22 of file groupsWidget.cpp.

23  : Q3IconView( parent, name)
24 {
25  setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum);
26 }

Member Function Documentation

§ contentsMousePressEvent()

void GroupsWidget::contentsMousePressEvent ( QMouseEvent *  e)
protected

Definition at line 28 of file groupsWidget.cpp.

29 {
30  //ignore all clicks other than left-clicks
31  if( e->button() != Qt::LeftButton ) return;
32 
33  Q3IconView::contentsMousePressEvent( e );
34 }

§ getTextWidth()

int GroupsWidget::getTextWidth ( )

Definition at line 72 of file groupsWidget.cpp.

References textWidth.

73 { return textWidth; }

§ keyPressEvent()

void GroupsWidget::keyPressEvent ( QKeyEvent *  e)

Definition at line 36 of file groupsWidget.cpp.

37 {
38  //change key left/right presses to up/down events
39  int key = e->key();
40  if( key == Qt::Key_Left) key = Qt::Key_Up;
41  if( key == Qt::Key_Right) key = Qt::Key_Down;
42 
43  Q3IconView::keyPressEvent(
44  new QKeyEvent(QEvent::KeyPress,
45  key,
46  e->ascii(),
47  e->state(),
48  e->text(),
49  e->isAutoRepeat(),
50  e->count() ) );
51 }

§ setTextWidth()

void GroupsWidget::setTextWidth ( int  val)

Definition at line 69 of file groupsWidget.cpp.

References textWidth.

Referenced by ConfigurationWidget::ConfigurationWidget().

70 { textWidth = val; }

§ sizeHint()

QSize GroupsWidget::sizeHint ( ) const

Definition at line 53 of file groupsWidget.cpp.

54 {
55  QSize s = Q3IconView::sizeHint();
56 
57  //find max item width
58  s.setWidth(0);
59  Q3IconViewItem *item;
60  for( item = firstItem(); item != NULL; item = item->nextItem() )
61  {
62  if(item->width() + 2 > s.width() )
63  s.setWidth( item->width() );
64  }
65  s.setWidth( s.width() + 2*spacing() );
66  return s;
67 }

Member Data Documentation

§ textWidth

int GroupsWidget::textWidth
private

Definition at line 46 of file groupsWidget.h.

Referenced by getTextWidth(), and setTextWidth().


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