Yingdi Yu | 8dacdf2 | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 4 | * Yingdi Yu |
| 5 | * |
| 6 | * BSD license, See the LICENSE file for more information |
| 7 | * |
| 8 | * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 9 | */ |
| 10 | |
| 11 | #ifndef LINKNDN_ENDORSE_COMBOBOX_DELEGATE_H |
| 12 | #define LINKNDN_ENDORSE_COMBOBOX_DELEGATE_H |
| 13 | |
| 14 | #include <QItemDelegate> |
| 15 | #include <string> |
| 16 | #include <vector> |
| 17 | |
| 18 | class EndorseComboBoxDelegate : public QItemDelegate |
| 19 | { |
| 20 | Q_OBJECT |
| 21 | public: |
| 22 | EndorseComboBoxDelegate(QObject *parent = 0); |
| 23 | |
| 24 | // virtual |
| 25 | // ~ComboBoxDelegate() {} |
| 26 | |
| 27 | QWidget* |
| 28 | createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; |
| 29 | |
| 30 | void |
| 31 | setEditorData(QWidget *editor, const QModelIndex &index) const; |
| 32 | |
| 33 | void |
| 34 | setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; |
| 35 | |
| 36 | void |
| 37 | updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; |
| 38 | |
| 39 | void |
| 40 | paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; |
| 41 | |
| 42 | private: |
| 43 | std::vector<std::string> m_items; |
| 44 | |
| 45 | }; |
| 46 | |
| 47 | #endif |