blob: 92e26d16f1d00f567121e5922de6868cce0c7a62 [file] [log] [blame]
Yingdi Yu0b0a7362014-08-05 16:31:30 -07001/* -*- 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 CHRONOS_ENDORSE_COMBOBOX_DELEGATE_HPP
12#define CHRONOS_ENDORSE_COMBOBOX_DELEGATE_HPP
13
14#include <QItemDelegate>
15#include <string>
16#include <vector>
17
18namespace chronos {
19
20class EndorseComboBoxDelegate : public QItemDelegate
21{
22 Q_OBJECT
23public:
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
46private:
47 std::vector<std::string> m_items;
48
49};
50
51} // namespace chronos
52
53#endif // CHRONOS_ENDORSE_COMBOBOX_DELEGATE_HPP