将 QtPropertyBrowser 加入到 vs2015 qt版中工程中

我是直接将QtPropertyBrowser的所有文件当子文件夹全部加入到工程里的

加完之后,ok,编译错误

出现一堆以下错误,我只拿出一条

moc_qtbuttonpropertybrowser.cpp(94): error C2027: 使用了未定义类型“QtButtonPropertyBrowserPrivate”

然后google结果

https://stackoverflow.com/questions/28605629/qtcreator-debugger-showing-not-accessible-for-qstring

The problem is your project is set up to compile the generated moc_XXX.cpp files for the qtpropertybrowser headers . In this case they are included at the end of qtXXX.cpp files and are not meant to be compiled separately, as they make use of the private implementation in the ccp. To fix this, in VS, select all the qtXXX.h files from qtpropertybrowser (except for the qtXXX_p.h). Right click and select Properties. In the property page go to Configuration Properties -> Qt Meta-Object-Compiler -> moc and set Dynamic C++ Source to Disable. This will exclude generated moc_ files from direct compilation. They will be compiled as an include in the cpp files from qtpropertybrowser, the way they were meant to be.

  1. 选择来自 qtpropertybrowser 的所有 qtXXX.h 文件(除了 qtXXX_p.h),右键点击并选择 "属性"。

  2. 在属性页中,转到 "配置属性" -> "Qt 元对象编译器 (Meta-Object Compiler)" -> "moc",将 "动态 C++ 源文件" 设置为 "禁用"。这将排除生成的 moc_ 文件直接编译,而是将其作为 qtpropertybrowsercpp 文件中的包含文件编译,这是它们的正确使用方式。

通过执行上述操作,应该能够解决您遇到的错误。如果问题仍然存在,请提供更多的代码和细节,以便我们提供更准确的帮助。

当然了,然后再用他的结果反向百度,是不是我很聪明啊

QtTreePropertyBrowser使用_风烟倦的博客-CSDN博客

猜你喜欢

转载自blog.csdn.net/qq_30377315/article/details/131815717