-
Notifications
You must be signed in to change notification settings - Fork 38
QT creator
- More robust indexer than eclipse
- Less tedious auto-complete with more language support (e.g. CMake)
- Download and install the latest QT creator from https://www.qt.io/download-open-source/ (QT creator downloads almost at the bottom)
- You need to launch QT creator with your workspace environment sourced, no idea if unity buttons can be automated to do that:
cd <YOUR_QTCREATOR_INSTALL_DIR>
. ~/catkin_ws/devel/setup.bash
./bin/qtcreator
(Alternative solution would be to add source ~/catkin_ws/devel/setup.bash
to the end of ~/.bashrc.)
- Edit Qt desktop file so that it doesn't have to be launched from terminal every time (more info - http://wiki.ros.org/IDEs#QtCreator)
$ cat /usr/share/applications/DigiaQt-qtcreator-community.desktop
[Desktop Entry]
Type=Application
Exec=bash -i -c /opt/Qt5.7.0/Tools/QtCreator/bin/qtcreator
Name=Qt Creator (Community)
GenericName=The IDE of choice for Qt development.
Icon=QtProject-qtcreator
Terminal=false
Categories=Development;IDE;Qt;
MimeType=text/x-c++src;text/x-c++hdr;text/x-xsrc;application/x-designer;application/vnd.qt.qmakeprofile;application/vnd.qt.xml.resource;text/x-qml;text/x-qt.qml;text/x-qt.qbs;
You should not try to generate this file yourself, but rather modify the file that was created when you installed QtCreator. Normally in Ubuntu, this file resides in /usr/share/applications if you did a system wide installation or in ~/.local/share/applications if you installed it only for your user. Use this standard QtCreator desktop file, and in the Exec line add bash -i -c. This will run your QtCreator in a shell which should source all required setup.bash files of your ros installation and workspace. More about desktop files and their locations for Ubuntu can be found here. Note also that the same trick can be used with eclipse.
- File -> Open File or Project -> navigate to and open the CMakeLists of your package in
catkin_ws/src
- For the build location, select your package location in
catkin_ws/build
- Run CMake. If you run cmake the first time you might want to run it with arguments
-DCMAKE_BUILD_TYPE=Release
(e.g. multiagent-mapping is too slow otherwise)
Since the files shown in project view are only CMake dependencies, the headers will not show up at first. Add them by adding the following to the CMakeLists, then right-click the project and Run CMake
again:
#############
# QTCREATOR #
#############
FILE(GLOB_RECURSE LibFiles "include/*")
add_custom_target(headers SOURCES ${LibFiles})
To enable parallel build, go to the Projects
tab (very left), and in your projects under Build & Run
click Details
in the Make
build step. Add -j8
as additional argument.
This is unfortunately a bit more tedious than with eclipse, since the project view is constraint by CMake. Currently, I add files with File -> New File or Project -> C++ -> header / source
, then add the source to CMakeLists, then re-run CMake.
F2: Find definition of expression under the cursor
F4: Source/Header switch
Ctrl + B: Build active project
Follow the instructions at: https://github.com/procedural/qtcreator-themes