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);
|
2023-10-25 18:13:48 +02:00
|
|
|
~ComboBoxItemDelegate() override;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2023-10-25 18:13:48 +02:00
|
|
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
|
|
|
const QModelIndex &index) const override;
|
|
|
|
void setEditorData(QWidget *editor,
|
|
|
|
const QModelIndex &index) const override;
|
|
|
|
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
|
|
|
const QModelIndex &index) const override;
|
2018-04-27 01:11:09 +02:00
|
|
|
};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-27 01:11:09 +02:00
|
|
|
} // namespace chatterino
|