Expand Declarations in Qt Creator « VCreate Logic Blog
 
Home
 
 

Expand Declarations in Qt Creator

Post: Blog — Posted by: prashanthudupa @ 5:08 pm

One of the things I dont particularly enjoy is to transfer functions from .h (declaration) to .cpp (implementation), specifying the class scope and then creating open and close brackets. The whole process consumes time and I always thought that it can be automated quite easily in Qt Creator. Just wrote a plugin for Qt Creator that makes it possible.

Consider the following class definition below.

Select the function declarations from constructor all the way down to setCurrentColor(). Copy the code snippet using Ctrl+C. Now in the .cpp file for this class as shown below

With the ExpandDeclarations plugin installed, we can now hit the key-combination Ctrl+Shift+V, to get this dialog box

to get this

This one really saves time, I tell you.

You can grab a copy of the plugin from here: https://svn2.hosted-projects.com/vcreatelogic/VCLTools/QtCPlugins/. Username and password for read-only access is anonymous/anonymous. In the same location you can also find a plugin that provides a project wizard called “Qt Creator Plugin” that automatically generates a Qt Creator Plugin skeleton project for you.

You can now select File -> New project and select the “Qt Creator Plugin” project.

Answer some simple questions

And have a fully functional empty plugin project automatically generated :-).

These plugins are given away under LGPL. So you can use them for any purpose you see fit.

 

Leave a comment