#include <items.h>
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 | |
Item * | currentPseudoSelection |
Definition at line 23 of file items.h.
Items::Items | ( | QWidget * | parent = 0 , |
|
const char * | name = 0 | |||
) |
Definition at line 19 of file items.cpp.
References clearPseudoSelection(), currentPseudoSelection, and repaintGroup().
00020 : QIconView( parent, name) 00021 { 00022 currentPseudoSelection = NULL; 00023 // setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum); 00024 00025 //connect mouse over events to paint pseudo selection in ligher blue 00026 connect( this, SIGNAL(onItem(QIconViewItem*)), 00027 this, SLOT(repaintGroup(QIconViewItem*)) ); 00028 00029 //clear any pseudo selection when mouse moves off icons 00030 connect( this, SIGNAL(onViewport()), 00031 this, SLOT(clearPseudoSelection()) ); 00032 }
void Items::clearPseudoSelection | ( | ) | [private, slot] |
Definition at line 78 of file items.cpp.
References currentPseudoSelection, and Item::setMousedOver().
Referenced by Items(), and repaintGroup().
00079 { 00080 //if old pseudo selection unselect it 00081 if(currentPseudoSelection != NULL) 00082 { 00083 currentPseudoSelection->setMousedOver(false); 00084 repaintItem(currentPseudoSelection); 00085 currentPseudoSelection = NULL; 00086 } 00087 }
void Items::keyPressEvent | ( | QKeyEvent * | e | ) |
Definition at line 34 of file items.cpp.
00035 { 00036 //change key left/right presses to up/down events 00037 int key = e->key(); 00038 if( key == Key_Left) key = Key_Up; 00039 if( key == Key_Right) key = Key_Down; 00040 00041 QIconView::keyPressEvent( 00042 new QKeyEvent(QEvent::KeyPress, 00043 key, 00044 e->ascii(), 00045 e->state(), 00046 e->text(), 00047 e->isAutoRepeat(), 00048 e->count() ) ); 00049 }
void Items::repaintGroup | ( | QIconViewItem * | pseudoSelection | ) | [private, slot] |
Definition at line 67 of file items.cpp.
References clearPseudoSelection(), currentPseudoSelection, and Item::setMousedOver().
Referenced by Items().
00068 { 00069 //if old pseudo selection unselect it 00070 clearPseudoSelection(); 00071 00072 //paint new selection 00073 currentPseudoSelection = (Item*)pseudoSelection; 00074 currentPseudoSelection->setMousedOver(true); 00075 repaintItem(currentPseudoSelection); 00076 }
QSize Items::sizeHint | ( | ) | const |
Definition at line 51 of file items.cpp.
00052 { 00053 QSize s = QIconView::sizeHint(); 00054 00055 //find max item width 00056 s.setWidth(0); 00057 QIconViewItem *item; 00058 for( item = firstItem(); item != NULL; item = item->nextItem() ) 00059 { 00060 if(item->width() + 2 > s.width() ) 00061 s.setWidth( item->width() ); 00062 } 00063 s.setWidth( s.width() + 2*spacing() ); 00064 return s; 00065 }
Item* Items::currentPseudoSelection [private] |
Definition at line 38 of file items.h.
Referenced by clearPseudoSelection(), Items(), and repaintGroup().