BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
hotkeyTable.h
Go to the documentation of this file.
1 #ifndef BALL_VIEW_WIDGETS_HOTKEY_TABLE_H
2 #define BALL_VIEW_WIDGETS_HOTKEY_TABLE_H
3 
4 #ifndef BALL_VIEW_KERNEL_COMMON_H
6 #endif
7 
8 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY
10 #endif
11 
12 #ifndef BALL_VIEW_WIDGETS_PYWIDGET_H
14 #endif
15 
16 #include <QtGui/QTableWidget>
17 #include <QtGui/QItemDelegate>
18 
19 namespace BALL
20 {
21  namespace VIEW
22  {
24  : public QItemDelegate
25  {
26  public:
27 
28  ComboBoxDelegate(QObject* parent = 0);
29 
30  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
31  const QModelIndex &index) const;
32 
33  void setEditorData(QWidget *editor, const QModelIndex &index) const;
34  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
35 
36  void updateEditorGeometry(QWidget *editor,
37  const QStyleOptionViewItem &option, const QModelIndex &index) const;
38  private:
39 
40  QStringList sl_keys_;
41  QStringList sl_modifier_;
42  };
43 
48  : public QTableWidget,
50  {
51  Q_OBJECT
52 
53  public:
54 
56  enum Modifier
57  {
58  NONE = 0,
60  // ALT // currently not working!
61  };
62 
64  HotkeyTable(QWidget* parent = 0, const char* name = "PythonSettings");
65 
67  virtual bool getValue(String& value) const;
68 
70  virtual bool setValue(const String& value);
71 
73  std::list<Hotkey> getContent() const;
74 
76  void setContent(const std::list<Hotkey>& hotkeys);
77 
78  public slots:
79 
81  virtual void addEmptyRow();
82 
84  virtual void removeSelection();
85 
89  virtual void appendHotkey(const String& modif, const String& F_key,
90  const String& command, String comment = "");
91 
92  private:
93  QStringList modifier_, keys_;
94  ComboBoxDelegate delegate_;
95  };
96  }
97 }
98 
99 #endif //BALL_VIEW_WIDGETS_HOTKEY_TABLE_H
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
virtual bool setValue(const String &value)
Overload this in derived classes!
void setContent(const std::list< Hotkey > &hotkeys)
virtual void addEmptyRow()
virtual void removeSelection()
virtual bool getValue(String &value) const
Overload this in derived classes!
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
virtual void appendHotkey(const String &modif, const String &F_key, const String &command, String comment="")
HotkeyTable(QWidget *parent=0, const char *name="PythonSettings")
ComboBoxDelegate(QObject *parent=0)
void setEditorData(QWidget *editor, const QModelIndex &index) const
std::list< Hotkey > getContent() const
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const