KeyActionListViewItem.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef KEY_ACTION_LIST_VIEW_ITEM
00008 #define KEY_ACTION_LIST_VIEW_ITEM
00009
00010 #include <qaction.h>
00011 #include <qlistview.h>
00012 #include "Util.h"
00013
00014 class KeyActionListViewItem : public QListViewItem {
00015
00016 public:
00017 KeyActionListViewItem( QListView *parent, QAction *action, Action actionIndex ) : QListViewItem( parent ), action( action ), actionIndex( actionIndex ) {
00018 keyCode = action->accel();
00019 updateText();
00020 }
00021
00022 QAction *getAction() {
00023 return action;
00024 }
00025
00026 Action getActionIndex() {
00027 return( actionIndex );
00028 }
00029
00030 void setKey( int keyCode ) {
00031 this->keyCode = keyCode;
00032 updateText();
00033 }
00034
00035 int getKey() {
00036 return keyCode;
00037 }
00038
00039 void updateText() {
00040 setText( 1, keyCode ? Util::describeKey( keyCode ) : QString::null );
00041 }
00042
00043 private:
00044
00045 QAction* action;
00046 int keyCode;
00047 Action actionIndex;
00048
00049 };
00050
00051 #endif