mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-04 06:54:47 -04:00
move MessageItemDelegate to its own file
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Moved from Configuration.cpp
|
||||
//
|
||||
|
||||
#include "MessageItemDelegate.hpp"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QRegExpValidator>
|
||||
|
||||
//
|
||||
// Class MessageItemDelegate
|
||||
//
|
||||
// Item delegate for message entry such as free text message macros.
|
||||
//
|
||||
MessageItemDelegate::MessageItemDelegate(QObject *parent): QStyledItemDelegate{parent}
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *MessageItemDelegate::createEditor(QWidget *parent, QStyleOptionViewItem const &, QModelIndex const &) const
|
||||
{
|
||||
QRegularExpression message_alphabet{"[- @A-Za-z0-9+./?#<>;$]*"};
|
||||
auto editor = new QLineEdit{parent};
|
||||
editor->setFrame(false);
|
||||
editor->setValidator(new QRegularExpressionValidator{message_alphabet, editor});
|
||||
return editor;
|
||||
}
|
||||
Reference in New Issue
Block a user