diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp index b074a3dc48f..50c3f008382 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp @@ -357,14 +357,16 @@ QVector AnnotationTableView::fetchComments() const Comment AnnotationTableView::fetchComment(int row) const { - auto *item = m_model->item(row, ColumnId::Title); - if (item->text().isEmpty()) + const auto *item = m_model->item(row, ColumnId::Title); + Comment comment = item->data().value(); + + if (comment.isEmpty()) return {}; - Comment comment = item->data().value(); comment.setTitle(item->text()); comment.setAuthor(m_model->item(row, ColumnId::Author)->text()); comment.setText(dataToCommentText(m_model->item(row, ColumnId::Value)->data(Qt::DisplayRole))); + return comment; }