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