Qt Visual Studio Add-in: Frequently Asked Questions

Frequently Asked Questions

Why is code completion not working?

You’re implementing a slot…

Visual Studio can only provide code completion as long as it understands the code. Unfortunately, it does not know how to handle the Qt keyword slots in the header file. This means that the respective function body is foreign to the code model and no code completion will be provided. You can workaround the problem be placing a ';' after the colon of the slots keyword in the class declaration.

Note: Remember to remove the ';' when exporting the project as the code might not with older Unix compilers.

 class MyClass {
     Q_OBJECT

 public slots:;
     void doSomething();

   ...
 };

You are referencing objects from a .ui file…

The Visual Studio code model parser only parses C++ sources, meaning that widgets or objects defined in .ui files will not be accessible. To workaround the problem, the Qt Visual Studio Add-in automatically generates C++ code from the .ui file by saving the file and running uic on it. This step is done everytime the project is built. If the code completion does not work, try to rebuild the project. It is possible that you have to wait some time, before code completion fully works after updating an .ui file. For more information, you can refer to the Modifying Project Properties section.

It still does not work…

You should refresh the code model, Intellisense. This is done by opening the solution explorer, invoking the context menu of the project and activating the item Update Intellisense.

 

发表评论

电子邮件地址不会被公开。