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

#include <items.h>

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

Public Member Functions

 Items (QWidget *parent=0, const char *name=0)
 
void keyPressEvent (QKeyEvent *e)
 
QSize sizeHint () const
 

Private Slots

void repaintGroup (Q3IconViewItem *pseudoSelection)
 
void clearPseudoSelection ()
 

Private Attributes

ItemcurrentPseudoSelection
 

Detailed Description

Definition at line 25 of file items.h.

Constructor & Destructor Documentation

§ Items()

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

Definition at line 22 of file items.cpp.

References clearPseudoSelection(), currentPseudoSelection, and repaintGroup().

23  : Q3IconView( parent, name)
24 {
26 // setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum);
27 
28  //connect mouse over events to paint pseudo selection in ligher blue
29  connect( this, SIGNAL(onItem(Q3IconViewItem*)),
30  this, SLOT(repaintGroup(Q3IconViewItem*)) );
31 
32  //clear any pseudo selection when mouse moves off icons
33  connect( this, SIGNAL(onViewport()),
34  this, SLOT(clearPseudoSelection()) );
35 }
void repaintGroup(Q3IconViewItem *pseudoSelection)
Definition: items.cpp:70
void clearPseudoSelection()
Definition: items.cpp:81
Item * currentPseudoSelection
Definition: items.h:40

Member Function Documentation

§ clearPseudoSelection

void Items::clearPseudoSelection ( )
privateslot

Definition at line 81 of file items.cpp.

References currentPseudoSelection, and Item::setMousedOver().

Referenced by Items(), and repaintGroup().

82 {
83  //if old pseudo selection unselect it
84  if(currentPseudoSelection != NULL)
85  {
87  repaintItem(currentPseudoSelection);
89  }
90 }
void setMousedOver(bool val)
Definition: item.cpp:60
Item * currentPseudoSelection
Definition: items.h:40

§ keyPressEvent()

void Items::keyPressEvent ( QKeyEvent *  e)

Definition at line 37 of file items.cpp.

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

§ repaintGroup

void Items::repaintGroup ( Q3IconViewItem pseudoSelection)
privateslot

Definition at line 70 of file items.cpp.

References clearPseudoSelection(), currentPseudoSelection, and Item::setMousedOver().

Referenced by Items().

71 {
72  //if old pseudo selection unselect it
74 
75  //paint new selection
76  currentPseudoSelection = (Item*)pseudoSelection;
78  repaintItem(currentPseudoSelection);
79 }
void setMousedOver(bool val)
Definition: item.cpp:60
Definition: item.h:27
void clearPseudoSelection()
Definition: items.cpp:81
Item * currentPseudoSelection
Definition: items.h:40

§ sizeHint()

QSize Items::sizeHint ( ) const

Definition at line 54 of file items.cpp.

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

Member Data Documentation

§ currentPseudoSelection

Item* Items::currentPseudoSelection
private

Definition at line 40 of file items.h.

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


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