Merge pull request #306 from Scrumplex/limit-instance-lengths

Limit instance names to 128 chars
This commit is contained in:
Ezekiel Smith 2022-03-21 01:04:40 +11:00 committed by GitHub
commit 8bc6cdf55c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -44,7 +44,11 @@
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="instNameTextBox"/>
<widget class="QLineEdit" name="instNameTextBox">
<property name="maxLength">
<number>128</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameLabel">

View File

@ -405,6 +405,8 @@ void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model,
QString text = realeditor->toPlainText();
text.replace(QChar('\n'), QChar(' '));
text = text.trimmed();
// Prevent instance names longer than 128 chars
text.truncate(128);
if(text.size() != 0)
{
model->setData(index, text);