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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
731 B
C++
Raw Normal View History

2018-04-27 01:11:09 +02:00
#pragma once
2018-04-27 01:11:09 +02:00
#include <QStyledItemDelegate>
2018-04-27 01:11:09 +02:00
namespace chatterino {
2018-04-27 01:11:09 +02:00
// stolen from https://wiki.qt.io/Combo_Boxes_in_Item_Views
2018-04-27 01:11:09 +02:00
class ComboBoxItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
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();
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;
};
2018-04-27 01:11:09 +02:00
} // namespace chatterino