Qt Creator - acquaman/acquaman GitHub Wiki

As standard all Scientific Linux machines provided at the CLS come with Qt Creator 2.3.1 installed. It is recommended that development work for Acquaman is done in Qt Creator, as its integration of qmake and project management system make development significantly easier. For machines that are not Scientific Linux standard machines provided by ICT a more up-to-date version of Qt Creator can be used.

What follows are a few tips and tricks that people have noticed in Qt, that assist in development. Please feel free to add any useful tips you notice yourself.

Qt Creator Tips

  • Find Usages - Right clicking on a given variable/class/function name, and clicking 'Find Usages' (or pressing CONTROL+SHIFT+U) will prompt Qt to perform a context search for all usages of that particular variable/class/function within the project. This can sometimes miss references signals/slots
  • Follow Symbol - Right clicking of a given function call, class instance or variable name, and clicking 'Follow Symbol' (or pressing F2) will prompt Qt to take you to the place in code where that particular function, class or variable is defined.
  • Refactor - Right clicking on a class definition, function definition, or variable name, and clicking 'Refactor' then 'Rename Symbol Under Cursor' will allow you to alter the name of that particular class, function or variable, where ever it occurs.
  • Adding Definitions to Class Bodies from Headers - If you have a function (or, more likely, a whole bunch of functions) defined in a class header, which don't yet have matching definitions in the cpp file, then right clicking the definition in the header, and clicking 'Refactor' then 'Add Definition in xxxxxx.cpp' will create you a function stub in the cpp file.
  • Shifting Lines of Code Up and Down - If you wish to swap two lines of code, or just move a single line of code up or down a few lines, instead of cutting, and then pasting, it is possible to simply shift it. Put your cursor on the line you wish to move, then press SHIFT+CONTROL+UP to move the line up, or SHIFT+CONTROL+DOWN to move the line down.
  • Commenting Out Blocks of Code - If you wish to comment out a large block of code, simply select the lines you wish to comment out, and press CONTROL+/