ui文件第一行内容如下:
知道这条线有什么问题,以及如何解决这个问题吗?
最佳答案
您的问题是缺少空间。我在我的 QtDesigner 中尝试了以下行:
<?xml version="1.0"encoding="UTF-8"?>
它没有用,但是当我修改它以包含引号之后和下一个属性之前的空格时,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
设计者可以很好地加载它。
您可能在手动查看文件时不小心犯了这个错误。
诚然,QtDesigner 报告的错误很奇怪,因为如果您为您的内容查找 xml 验证程序(xml lint,www.xmlvalidation.com),它们将提供更准确的错误诊断,如下所示:
Errors in the XML document:
1: 36 White space is required before the encoding pseudo attribute in the XML declaration.
关于c++ - Qt Designer 在加载 ui 时返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20898615/