Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

groupsWidget.cpp

Go to the documentation of this file.
00001 //============================================== 00002 // copyright : (C) 2003-2005 by Will Stokes 00003 //============================================== 00004 // This program is free software; you can redistribute it 00005 // and/or modify it under the terms of the GNU General 00006 // Public License as published by the Free Software 00007 // Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 //============================================== 00010 00011 //Systemwide includes 00012 #include <qiconview.h> 00013 00014 //Projectwide includes 00015 #include "groupsWidget.h" 00016 00017 //============================================== 00018 GroupsWidget::GroupsWidget( QWidget* parent, 00019 const char* name ) : QIconView( parent, name) 00020 { 00021 setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum); 00022 } 00023 //============================================== 00024 void GroupsWidget::contentsMousePressEvent ( QMouseEvent * e ) 00025 { 00026 //ignore all clicks other than left-clicks 00027 if( e->button() != Qt::LeftButton ) return; 00028 00029 QIconView::contentsMousePressEvent( e ); 00030 } 00031 //============================================== 00032 void GroupsWidget::keyPressEvent( QKeyEvent* e ) 00033 { 00034 //change key left/right presses to up/down events 00035 int key = e->key(); 00036 if( key == Key_Left) key = Key_Up; 00037 if( key == Key_Right) key = Key_Down; 00038 00039 QIconView::keyPressEvent( 00040 new QKeyEvent(QEvent::KeyPress, 00041 key, 00042 e->ascii(), 00043 e->state(), 00044 e->text(), 00045 e->isAutoRepeat(), 00046 e->count() ) ); 00047 } 00048 //============================================== 00049 QSize GroupsWidget::sizeHint() const 00050 { 00051 QSize s = QIconView::sizeHint(); 00052 00053 //find max item width 00054 s.setWidth(0); 00055 QIconViewItem *item; 00056 for( item = firstItem(); item != NULL; item = item->nextItem() ) 00057 { 00058 if(item->width() + 2 > s.width() ) 00059 s.setWidth( item->width() ); 00060 } 00061 s.setWidth( s.width() + 2*spacing() ); 00062 return s; 00063 } 00064 //============================================== 00065 void GroupsWidget::setTextWidth(int val) 00066 { textWidth = val; } 00067 //============================================== 00068 int GroupsWidget::getTextWidth() 00069 { return textWidth; } 00070 //============================================== 00071 00072

Generated on Sun Mar 4 19:42:56 2007 for AlbumShaper by doxygen 1.3.7