mirror-chatterino2/src/widgets/helper/RegExpItemDelegate.cpp

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

26 lines
708 B
C++
Raw Normal View History

#include "widgets/helper/RegExpItemDelegate.hpp"
#include "widgets/helper/TrimRegExpValidator.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 TrimRegExpValidator(this->regexp_, editor));
return editor;
}
} // namespace chatterino