Skip to content

Commit 9aee4b2

Browse files
committed
Fix regression
1 parent f1f3bfe commit 9aee4b2

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

src/modules/value-editor/largetextmodel.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ QHash<int, QByteArray> ValueEditor::LargeTextWrappingModel::roleNames() const {
1616
}
1717

1818
int ValueEditor::LargeTextWrappingModel::rowCount(const QModelIndex &) const {
19-
return m_text.size() / m_chunkSize +
19+
int size= m_text.size() / m_chunkSize +
2020
(m_text.size() % m_chunkSize == 0 ? 0 : 1);
21+
22+
return size > 0 ? size : 1;
2123
}
2224

2325
QVariant ValueEditor::LargeTextWrappingModel::data(const QModelIndex &index,

src/qml/value-editor/editors/MultilineEditor.qml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ColumnLayout
2626
// init editor with empty model
2727
textView.model = qmlUtils.wrapLargeText("")
2828
textView.readOnly = false
29-
textView.textFormat = TextEdit.PlainText
29+
textView.textFormat = TextEdit.PlainText
3030
}
3131

3232
function validationRule(raw)
@@ -322,21 +322,26 @@ ColumnLayout
322322
property string format
323323

324324
delegate:
325-
NewTextArea {
326-
id: textAreaPart
327-
objectName: "rdm_key_multiline_text_field_" + index
325+
Item {
328326
width: texteditorWrapper.width
329327
height: textAreaPart.contentHeight < texteditorWrapper.height? texteditorWrapper.height - 5 : textAreaPart.contentHeight
330328

331-
enabled: root.enabled
332-
text: value
329+
NewTextArea {
330+
anchors.fill: parent
331+
id: textAreaPart
332+
objectName: "rdm_key_multiline_text_field_" + index
333333

334-
textFormat: textView.textFormat
335-
readOnly: textView.readOnly
336334

337-
onTextChanged: {
338-
root.isEdited = true
339-
textView.model && textView.model.setTextChunk(index, textAreaPart.text)
335+
enabled: root.enabled
336+
text: value
337+
338+
textFormat: textView.textFormat
339+
readOnly: textView.readOnly
340+
341+
onTextChanged: {
342+
root.isEdited = true
343+
textView.model && textView.model.setTextChunk(index, textAreaPart.text)
344+
}
340345
}
341346
}
342347
}

0 commit comments

Comments
 (0)