This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Choose QT version in KDevelop code hints

Tags: None
(comma "," separated)
User avatar
Kwezi Bhule
Registered Member
Posts
2
Karma
0
OS
How do I change the QT version used in the KDevelop semantic analysis?

We're currently coding on a qmake (qmake6) project that uses Qt core 6.4. KDevelop adds semantic warnings in our code whenever we write code that uses stuff added in Qt 6.0 or later.

How do we configure or change the semantic analysis to use the correct Qt version?

See screenshot of the problem:

Image

sliced() was added to QString in 6.0, but is still marked as an error.
User avatar
Kwezi Bhule
Registered Member
Posts
2
Karma
0
OS
So, here is how we solved it.

First we installed the Qt documentation package from the distribution. Then we added this to KDevelop. Settings > Configure KDevelop > Documentation > Qt Help, add your newly installed qt6 document in the "Load Qt Help files from this directory". For us it is /usr/share/dock/qt6/qtdoc

Then we made sure that the project uses qmake6 rather than qmake. In the project settings (Project > Open Configuration > QMake), make sure the QMake executable points to /usr/bin/qmake6.

Also in the project settings, Go to language support and enter the third tab "C/C++ parser", specify your C++ profile, select your compiler. The first tab, add /usr/include/qt6 to includes/imports (not sure if this is needed, but it won't hurt).

Then go to the cppcheck main section, go to the second tab "Include Directories". Tick the "use 'system' include dirs" box.

We had to go to the third tab "Extra parameters" as well and add -DQ_MOC_OUTPUT_REVISION=68. The Value 68 is dependant on your version and you can find it in your generated moc files, or in a system header. If you don't have a warning in the settings, you don't need to add this.

After this, semantic analysis works like a charm!


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kesang, Yahoo [Bot]