QString VariantPropertyManager::valueText(const QtProperty *property) const { if (mValues.contains(property)) { QVariant value = mValues[property].value; int typeId = propertyType(property); if (typeId == filePathTypeId()) { FilePath filePath = value.value<FilePath>(); QString path = filePath.absolutePath; if (path.endsWith(QLatin1Char('/'))) path.chop(1); return QFileInfo(path).fileName(); } if (typeId == tilesetParametersTypeId()) { if (TilesetDocument *tilesetDocument = value.value<TilesetDocument*>()) return QFileInfo(tilesetDocument->tileset()->imageSource()).fileName(); } return value.toString(); } auto stringAttributesIt = mStringAttributes.find(property); if (stringAttributesIt != mStringAttributes.end()) { if ((*stringAttributesIt).multiline) return escapeNewlines(value(property).toString()); } return QtVariantPropertyManager::valueText(property); }
void TextPropertyEdit::setText(const QString &text) { mCachedText = text; mLineEdit->setText(escapeNewlines(text)); }