Qt 5.1.1 QtCreator auto-completion / code highlighting / code-model (?)



  • I've started to use Qt 5.1.1 with it's embedded QtCreator on my MacOS 10.6.8. I need to work with CMake and it build project fine. But I have issues with QtCreator - a lot of underlined text (warnings) and there is no auto-completion for Qt classes/objects (for example if I write '.' after some object). All this works when I'm using QMake so code-model seems to be fine.. but in case of CMake it just not works. Previously I've worked with Qt4 and CMake and everything was okay.. what can be wrong with Qt5? Maybe I need to provide more information about my Qt installation for QtCreator - but I have no idea how to do this.


  • Moderators

    Creator queries the include paths from the build system. In the cmake case we get them from a xml file in the build directory (can't remember the name right now, sorry).

    Could you check whether the include paths are correct there?



  • That's right all you need is to set include path to
    <Path Qt5.1.1 installed>/5.1.1/clang_64/include

    Here is my solution:

    @
    find_package(Qt5Widgets)
    if(Qt5Widgets_FOUND)
    string(REPLACE "/bin/moc" "/include" QT5_INCLUDES ${QT_MOC_EXECUTABLE})
    include_directories(SYSTEM ${QT5_INCLUDES})
    endif()
    @



  • Thanks a lot guys! Works like a charm! Sorry for delay with comments - because of that issue I've switched to windows part of development and just didn't checked this thread.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.