AlbumShaper  1.0a3
Public Member Functions | Private Slots | Private Attributes
Items Class Reference

#include <items.h>

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

List of all members.

Public Member Functions

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

Private Slots

void repaintGroup (QIconViewItem *pseudoSelection)
void clearPseudoSelection ()

Private Attributes

ItemcurrentPseudoSelection

Detailed Description

Definition at line 23 of file items.h.


Constructor & Destructor Documentation

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

Definition at line 19 of file items.cpp.

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

                                         : QIconView( parent, name)
{
  currentPseudoSelection = NULL;
//  setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum);

  //connect mouse over events to paint pseudo selection in ligher blue
  connect( this, SIGNAL(onItem(QIconViewItem*)),
                this, SLOT(repaintGroup(QIconViewItem*)) );

  //clear any pseudo selection when mouse moves off icons
  connect( this, SIGNAL(onViewport()),
                this, SLOT(clearPseudoSelection()) );
}

Member Function Documentation

void Items::clearPseudoSelection ( ) [private, slot]

Definition at line 78 of file items.cpp.

References currentPseudoSelection, and Item::setMousedOver().

Referenced by Items(), and repaintGroup().

{
  //if old pseudo selection unselect it
  if(currentPseudoSelection != NULL)
  {
    currentPseudoSelection->setMousedOver(false);
    repaintItem(currentPseudoSelection);
    currentPseudoSelection = NULL;
  }
}
void Items::keyPressEvent ( QKeyEvent *  e)

Definition at line 34 of file items.cpp.

{
  //change key left/right presses to up/down events
  int key = e->key();
  if( key == Key_Left) key = Key_Up;
  if( key == Key_Right) key = Key_Down;

  QIconView::keyPressEvent(
    new QKeyEvent(QEvent::KeyPress,
              key,
              e->ascii(),
              e->state(),
              e->text(),
              e->isAutoRepeat(),
              e->count() ) );
}
void Items::repaintGroup ( QIconViewItem pseudoSelection) [private, slot]

Definition at line 67 of file items.cpp.

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

Referenced by Items().

{
  //if old pseudo selection unselect it
  clearPseudoSelection();

  //paint new selection
  currentPseudoSelection = (Item*)pseudoSelection;
  currentPseudoSelection->setMousedOver(true);
  repaintItem(currentPseudoSelection);
}
QSize Items::sizeHint ( ) const

Definition at line 51 of file items.cpp.

{
  QSize s = QIconView::sizeHint();

  //find max item width
  s.setWidth(0);
  QIconViewItem *item;
  for( item = firstItem(); item != NULL; item = item->nextItem() )
  {
    if(item->width() + 2 > s.width() )
      s.setWidth( item->width() );
  }
  s.setWidth( s.width() + 2*spacing() );
  return s;
}

Member Data Documentation

Definition at line 38 of file items.h.

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


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