Add QtPropertyBrowser to the vs2015 qt version project

I directly added all the files of QtPropertyBrowser as subfolders to the project.

After adding, ok, compilation error

A bunch of the following errors occurred, I only took out one

moc_qtbuttonpropertybrowser.cpp(94): error C2027: Undefined type 'QtButtonPropertyBrowserPrivate' used

Then google results

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. Select all files from qtpropertybrowser (except ), right-click and select "Properties" . qtXXX.hqtXXX_p.h

  2. In the property page, go to "Configuration Properties" -> "Qt Meta-Object Compiler (Meta-Object Compiler)" -> "moc" and change "Dynamic C++ Source" File" is set to "disabled". This will exclude the generated moc_ file from being compiled directly, and instead compile it as an include file in qtpropertybrowser's cpp file, which is the correct way to use them.

By doing the above, you should be able to resolve the error you are experiencing. If the problem persists, please provide more code and details so we can provide more accurate assistance.

Of course, and then use his results to reverse Baidu, am I very smart?

QtTreePropertyBrowser usage_Fengyanjuan's blog-CSDN blog

 

Guess you like

Origin blog.csdn.net/qq_30377315/article/details/131815717