shortcutTableView.h

Go to the documentation of this file.
00001 #ifndef BALL_VIEW_WIDGETS_SHORTCUTTABLEVIEW_H
00002 #define BALL_VIEW_WIDGETS_SHORTCUTTABLEVIEW_H
00003 
00004 #ifndef BALL_VIEW_KERNEL_COMMON_H
00005 # include <BALL/VIEW/KERNEL/common.h>
00006 #endif
00007 
00008 #ifndef BALL_VIEW_DIALOGS_EDITSINGLESHORTCUT_H
00009 # include <BALL/VIEW/DIALOGS/editSingleShortcut.h>
00010 #endif
00011 
00012 #include <QtGui/QTableView>
00013 #include <QtGui/QItemDelegate>
00014 #include <QtGui/QPushButton>
00015 
00016 class QSortFilterProxyModel;
00017 
00018 namespace BALL
00019 {
00020   namespace VIEW
00021   {
00022     class BALL_VIEW_EXPORT ShortcutTableView : public QTableView
00023     {
00024       Q_OBJECT
00025 
00026       public:
00027         ShortcutTableView(QWidget* parent);
00028 
00029         void setFilter(const QString& filter);
00030 
00031       signals:
00032         void shortcutChanged();
00033 
00034       protected slots:
00035         void editSuccess_();
00036 
00037       protected slots:
00038         void onClick(const QModelIndex& index);
00039 
00040       private:
00041         QSortFilterProxyModel* proxy_model_;
00042         EditSingleShortcut* editor_;
00043         int edited_row_;
00044     };
00045 
00046     class ShortcutTableModel : public QAbstractTableModel
00047     {
00048       Q_OBJECT
00049 
00050       public:
00051         ShortcutTableModel(ShortcutRegistry* reg);
00052         int rowCount(const QModelIndex& parent = QModelIndex()) const;
00053         int columnCount(const QModelIndex& parent = QModelIndex()) const;
00054 
00055         QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
00056         QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00057         Qt::ItemFlags flags(const QModelIndex& index) const;
00058         bool isValid(const QKeySequence& seq) const;
00059         bool setData(const QModelIndex& index, const QVariant& data, int role = Qt::EditRole);
00060       private:
00061         ShortcutRegistry* registry_;
00062     };
00063 
00064   }
00065 }
00066 
00067 #endif //BALL_VIEW_WIDGETS_SHORTCUTTABLEVIEW_H
00068