mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
25 lines
708 B
C++
25 lines
708 B
C++
#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
|