blob: 424a8f756a5811ec95f2f4d945935f5bc1edb34c [file] [log] [blame]
Yingdi Yub2e747d2013-11-05 23:06:43 -08001/* -*- 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 Yufa4ce792014-02-06 18:09:22 -080011#ifndef ENDORSE_COMBOBOX_DELEGATE_H
12#define ENDORSE_COMBOBOX_DELEGATE_H
Yingdi Yub2e747d2013-11-05 23:06:43 -080013
14#include <QItemDelegate>
15#include <string>
16#include <vector>
Yingdi Yufa0b6a02014-04-30 14:26:42 -070017
Yingdi Yub2e747d2013-11-05 23:06:43 -080018class EndorseComboBoxDelegate : public QItemDelegate
19{
20 Q_OBJECT
21public:
22 EndorseComboBoxDelegate(QObject *parent = 0);
23
24 // virtual
25 // ~ComboBoxDelegate() {}
Yingdi Yufa0b6a02014-04-30 14:26:42 -070026
Yingdi Yub2e747d2013-11-05 23:06:43 -080027 QWidget*
28 createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
29
Yingdi Yufa0b6a02014-04-30 14:26:42 -070030 void
Yingdi Yub2e747d2013-11-05 23:06:43 -080031 setEditorData(QWidget *editor, const QModelIndex &index) const;
Yingdi Yufa0b6a02014-04-30 14:26:42 -070032
33 void
Yingdi Yub2e747d2013-11-05 23:06:43 -080034 setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
Yingdi Yufa0b6a02014-04-30 14:26:42 -070035
Yingdi Yub2e747d2013-11-05 23:06:43 -080036 void
37 updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
Yingdi Yufa0b6a02014-04-30 14:26:42 -070038
Yingdi Yub2e747d2013-11-05 23:06:43 -080039 void
40 paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
Yingdi Yufa0b6a02014-04-30 14:26:42 -070041
Yingdi Yub2e747d2013-11-05 23:06:43 -080042private:
43 std::vector<std::string> m_items;
Yingdi Yufa0b6a02014-04-30 14:26:42 -070044
Yingdi Yub2e747d2013-11-05 23:06:43 -080045};
46
47#endif