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 virtual ~ShortcutTableView();
00029
00030 void setFilter(const QString& filter);
00031
00032 signals:
00033 void shortcutChanged();
00034
00035 protected slots:
00036 void editSuccess_();
00037
00038 protected slots:
00039 void onClick(const QModelIndex& index);
00040
00041 private:
00042 QSortFilterProxyModel* proxy_model_;
00043 EditSingleShortcut* editor_;
00044 int edited_row_;
00045 };
00046
00047 class ShortcutTableModel : public QAbstractTableModel
00048 {
00049 Q_OBJECT
00050
00051 public:
00052 ShortcutTableModel(ShortcutRegistry* reg);
00053 int rowCount(const QModelIndex& parent = QModelIndex()) const;
00054 int columnCount(const QModelIndex& parent = QModelIndex()) const;
00055
00056 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
00057 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00058 Qt::ItemFlags flags(const QModelIndex& index) const;
00059 bool isValid(const QKeySequence& seq) const;
00060 bool setData(const QModelIndex& index, const QVariant& data, int role = Qt::EditRole);
00061 private:
00062 ShortcutRegistry* registry_;
00063 };
00064
00065 }
00066 }
00067
00068 #endif //BALL_VIEW_WIDGETS_SHORTCUTTABLEVIEW_H
00069