Skip to content

Commit

Permalink
Refs #79 Fixed to Hash
Browse files Browse the repository at this point in the history
  • Loading branch information
doumdi committed Nov 17, 2022
1 parent 8c0babf commit fc76549
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions client/src/editors/TeraForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,13 +1083,11 @@ void TeraForm::setWidgetValue(QWidget *widget, const QVariant &value)

if (QTextEdit* text = dynamic_cast<QTextEdit*>(widget)){
if (value.canConvert(QMetaType::QVariantMap) || value.canConvert(QMetaType::QVariantHash)){
QVariantHash data;
if (value.convert(QMetaType::QVariantHash, &data)){
QJsonDocument doc;
doc.setObject(QJsonObject::fromVariantHash(data));
text->setText(doc.toJson(QJsonDocument::Compact));
return;
}
QVariantHash data = value.toHash();
QJsonDocument doc;
doc.setObject(QJsonObject::fromVariantHash(data));
text->setText(doc.toJson(QJsonDocument::Compact));
return;
}
text->setText(value.toString());
return;
Expand Down

0 comments on commit fc76549

Please sign in to comment.