You want intellisense to work for your productivity
1. You are in the function body of a slot. The VS intellisense parser gets confused by the slot keyword in the header file and stops therefore working. As
an easy workarround for this just place a ';' behind the slots declaration, e.g.:
2. The class/struct is not directly included. Sometimes the completion on e.g. a push button object does not work since you included <QtGui>. For
compilation it's of course perfect, but intellisense may not work correctly with this information. Try to include <QtGui/QPushButton> instead/in addition.
3. The C++ source code has not been generated yet. Intellisense works only on C++ code, but when designing a form there is no C++ code directly involved.
The C++ code is generated by uic which must be run after the ui file is saved. So, whenever you added or removed an item from the form you have to run uic
on it. This can easily be done by opening the context menu for the ui file in the solution explorer and clicking on compile. Another, more comfortable, way
of doing this is enabling the AutoRunUic property in Tools|Options|Qt|General options page. This basically saves the form and runs uic whenever you leave
the form editor.
4. Make sure you open Visual Studio using the command prompt provided with Qt in the Start menu if you are using the binary package or from a command prompt
that has the environment set correctly if you are using the source package.
If it's only happening with a specific project, then try deleting (or renaming to be safe) the .ncb and .suo file for that project. These will be
regenerated when the project is opened and built, respectively, and could help if the problem is due to some sort of corruption in those files.
I use visual studio 2008 and use the "visual Studio with Qt <Version Nr>" command line utility from the Qt menu. This works fine.
Disclaimer:The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!
About the Author
Author: Wim Peeters - Keskon GmbH & Co. KG
Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.