mirror-chatterino2/src/widgets/helper/RegExpItemDelegate.cpp
kornes 3bf1756579
Fix: ignore whitespaces pasted in EmotePopup search (#3730)
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
2022-05-16 09:42:17 +00:00

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