On openframeworks.cc/setup/qtcreator/ it seems easy to get qt creator to work. I have to admit I had some problems and still have. Most I will be able to sort out myself.
But I utterly failed each time/approach to get auto completion to run for the OF native functions. Tried on different machines, on ubuntu 16.04 and 14.04, qt creator from QTs site as proposed, actual versions from half a year ago and yesterday (qt-opensource-linux-x64-5.6.2.run). Tried with the OF templates as well as with emptyExample as well as with importing a project through qt creator native process. No auto completion for OF functions. For functions of the App itself (ofApp Class) it does work, though.
Other people do seem to have the same problem, but I don’t know if all, most or just some. . Only concrete solution I found is to import the generated Projects in qt creator (native process, not OF template). Then to add all pathes to folders containing the OF classes in XX.files and all XX.h files in XX.includes (both of which do not exist before importing the project that way). Seems improbable that all people using auto completion on Linux are doing it like this?
So could you please help me sort this out:
- Is auto-completion supposed to work out of the box with qt creator on linux or do I have to take manual steps?
- In case of the latter: can you give me a hint to a smart(er) approach?
If there should still be something to do I am willing to help with providing scripts or stuff - as long as I can help with my limited skills.
Thanks for any hint
Hi hi, do you have clangCodeModel plugin installed? (in help > plugins)
had not, now have. Build a new project by template. Imported another one.
Does not make a difference. No Auto complete.
Thanks for helping!
I’m not sure what is it that activates the auto complete. I also have “clang” in Tools > Options > Analyzer, which means that clang is installed. I have 3.9.1, which is shown as “supported” in that window, for my version of qtcreator. I think each version of qtcreator supports some versions of clang.
Auto completion itself is working, but only for functions of the App itself (ofApp Class). Like keyPressed(…). For OF functions like ofDrawBitmapString(…) it does not.
Thanks for helping!
Interesting. Your question made me realize there’s some differences when I press CTRL+Space inside the arguments of ofDrawBitmapString(“hi”, 2, 2) and when I do that inside a test call to mouseDragged(4, 4, 4);
In the first case, the information about the arguments is only displayed if I put the cursor between “String” and “(”. With mouseDragged I can place cursor before any of the arguments and the information is shown when pressing CTRL+Space. This does not work with ofDrawBitmapString.
There’s some settings at Options > Text Editor > Completion (I guess you found those).
When I started with QtCreator and every time I updated it I had troubles with autocompletion. Now it’s working for me, With QtCreator 4.2.1, clang 3.9.1, and a nightly build of OF.
If I type ofDrawBit, I can press down to select ofDrawBitmapString and then Enter to autocomplete.
What’s at the top of your project qbs file? In mine:
import "/home/user/src/openFrameworks/libs/openFrameworksCompiled/project/qtcreator/ofApp.qbs" as ofApp
property string of_root: '/home/user/src/openFrameworks'
thanks a lot for your efforts! It was quite difficult to see clear in this case and you helped a lot.
My project abs file had relative paths. I changed them to static but to no avail. I also re-checked Completion settings.
Well anyway, good to know, you had troubles too. And that you solved it. I’ll retry with your suggestions sooner or later…
Thanks and have a good day!