Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [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 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 11 | #ifndef CHRONOCHAT_ENDORSE_COMBOBOX_DELEGATE_HPP |
| 12 | #define CHRONOCHAT_ENDORSE_COMBOBOX_DELEGATE_HPP |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 13 | |
| 14 | #include <QItemDelegate> |
| 15 | #include <string> |
| 16 | #include <vector> |
| 17 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 18 | namespace chronochat { |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 19 | |
| 20 | class EndorseComboBoxDelegate : public QItemDelegate |
| 21 | { |
| 22 | Q_OBJECT |
| 23 | public: |
| 24 | EndorseComboBoxDelegate(QObject* parent = 0); |
| 25 | |
| 26 | // virtual |
| 27 | // ~ComboBoxDelegate() {} |
| 28 | |
| 29 | QWidget* |
| 30 | createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const; |
| 31 | |
| 32 | void |
| 33 | setEditorData(QWidget* editor, const QModelIndex& index) const; |
| 34 | |
| 35 | void |
| 36 | setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const; |
| 37 | |
| 38 | void |
| 39 | updateEditorGeometry(QWidget* editor, |
| 40 | const QStyleOptionViewItem& option, |
| 41 | const QModelIndex& index) const; |
| 42 | |
| 43 | void |
| 44 | paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; |
| 45 | |
| 46 | private: |
| 47 | std::vector<std::string> m_items; |
| 48 | |
| 49 | }; |
| 50 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 51 | } // namespace chronochat |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 52 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 53 | #endif // CHRONOCHAT_ENDORSE_COMBOBOX_DELEGATE_HPP |