mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
25 lines
674 B
C++
25 lines
674 B
C++
|
#include "widgets/helper/RegExpItemDelegate.hpp"
|
||
|
|
||
|
#include <QLineEdit>
|
||
|
|
||
|
namespace chatterino {
|
||
|
|
||
|
RegExpItemDelegate::RegExpItemDelegate(QObject *parent,
|
||
|
QRegularExpression regexp)
|
||
|
: QStyledItemDelegate(parent)
|
||
|
, regexp_(regexp)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
QWidget *RegExpItemDelegate::createEditor(QWidget *parent,
|
||
|
const QStyleOptionViewItem &option,
|
||
|
const QModelIndex &index) const
|
||
|
{
|
||
|
auto *editor = new QLineEdit(parent);
|
||
|
editor->setValidator(
|
||
|
new QRegularExpressionValidator(this->regexp_, editor));
|
||
|
return editor;
|
||
|
}
|
||
|
|
||
|
} // namespace chatterino
|