Initial Setup of QtCreator

2015-09-17 by Andreas Heindl



Qt Creator for Qt Creator is the IDE I recommend for usage when working with Qt code. It is part of Qt itself or can be downloaded separately (to get the latest version).

Here are some important steps I configure after having installed Qt Creator:

Highlighter definition files

Download of generic highlighter definitions
Download of generic highlighter definitions

Download all definitions via Tools > Options > Text Editor > Generic Highlighter > Download Definitions

Highlighting for .qss files (Qt Stylesheet files) .qss highlight definition

Tools > Options > Environment > MIME Types Filter for text/css and in Patterns add ;*.qss

Integrate offline help from cppreference.com

  • Download offline help Qt help book from http://www.cppreference.com
  • Unzip to a (new) directory, e.g. C:\Qt\qch\qch_book_20150808
  • Tools > Options > Help > Documentation
    • Add…
    • Select the .qch file just unzipped, e.g. C:\Qt\qch\qch_book_20150808\cppreference-doc-en-cpp.qch
    • Press Open, then OK
  • Open the locator by pressing CTRL + K, type e.g. ?std::vector. Attention: Qt Creator 3.5.0 has a bug that forces you to type slowly or no hits will be displayed. See a Short Demonstration of Qt Locator bug.

You might be interested in more help files available at the Qt Creator Documentation Gallery.

Create accompanying CMD shell

Create a batch file with the following contents. You will have to adapt the paths, of course:

@echo off
:: setup Qt, e.g. put qmake into PATH
call C:\Qt\Qt5.5.0\5.5\msvc2013\bin\qtenv2.bat
:: setup Visual Studio 2012 for architecture x86
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
:: add Qt Creator to PATH
set PATH=C:\qt\qtcreator-3.5.0\bin;%PATH%
:: print which binaries will be used
where qmake.exe
where qtcreator.exe
where devenv.exe
:: set text in title bar
title [Qt55] [VS2012] [x86]
if exist P:\projects cd /d P:\projects

Create a Windows shortcut which executes the batch file. Set target to %COMSPEC% /A /Q /K "C:\bin\vs2013_qt_shell.bat" .

Setting up the debugger

As described in the article Setting Up Debugger on qt.io.

TortoiseSVN

If you are using TortoiseSVN, you can integrate it into Qt Creator’s External Tools and use it to update, commit, blame, … directly from within Qt Creator. TortoiseSVN feels a lot easier to use than the built-in SVN tools.

  • Tools > Options > Environment > External Tools
  • Add > Add Category: name it svn or similar
  • Add the following commands via Screenshot of Options > External ToolsAdd > Add Tool:
    • Executable is always: TortoiseProc.exe
    • Arguments are:
      • diff: /command:diff /path:"%{CurrentProject:VcsTopLevelPath}"
      • diff file: /command:diff /path:%{CurrentDocument:FilePath}
      • commit: /command:commit /path:"%{CurrentProject:VcsTopLevelPath}"
      • blame: /command:blame /path:%{CurrentDocument:FilePath} /line:%{CurrentDocument:Row}
      • log: /command:log /path:"%{CurrentProject:VcsTopLevelPath}"
      • log file: /command:log /path:%{CurrentDocument:FilePath}