mirror-chatterino2/src/widgets/helper/ComboBoxItemDelegate.hpp

26 lines
756 B
C++
Raw Normal View History

2018-04-27 01:11:09 +02:00
#pragma once
#include <QStyledItemDelegate>
namespace chatterino {
// stolen from https://wiki.qt.io/Combo_Boxes_in_Item_Views
class ComboBoxItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
2018-07-06 19:23:47 +02:00
ComboBoxItemDelegate(QObject *parent = nullptr);
2018-04-27 01:11:09 +02:00
~ComboBoxItemDelegate();
2018-08-06 21:17:03 +02:00
virtual QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
2018-04-27 01:11:09 +02:00
const QModelIndex &index) const;
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const;
};
} // namespace chatterino