[Qt-creator] Extending Qt Creator with scripts

bill.king at nokia.com bill.king at nokia.com
Mon Oct 31 10:09:21 CET 2011

I've also been considering a script runner plugin in my capacity as QA for creator. I would rather have as much surfacing as possible done inside the one plugin, than touch many plugins for many reasons. It should only effect other plugins where it is absolutely necessary to do so. We can surface objects quite effectively there to QtScript.

This project over here: http://gitorious.org/qt-creator-static-code-quality-plugin gives a good jump off point/proof of concept that it can work this way. It also gives a good use-case as well :)

I'm definitely interested in this going further, and would like to be included on any code-reviews for it. If I'm lucky I may even get some time to help work on it occasionally.

Two thumbs up here.

Bill King.

From: qt-creator-bounces+bill.king=nokia.com at qt-project.org [qt-creator-bounces+bill.king=nokia.com at qt-project.org] on behalf of ext Nicolas Arnaud-Cormos [nicolas.arnaud-cormos at kdab.com]
Sent: Sunday, 30 October 2011 7:51 PM
To: Qt Creator mailing list
Subject: [Qt-creator] Extending Qt Creator with scripts

Hi all,

Qt Creator is one of my favorite IDE, unfortunatelly there's something I'm
still missing compare to xemacs: scripting.
In my day to day work, I'm using xemacs most of the time because of existing
scripts for this particular project. Also, we all have some specific tasks we
do again and again in a project, and creating a new plugin each time would be
a pain.

I would like to work on this, but before starting anything let's discuss the
architecture a bit here (and maybe on IRC), so I would be able to push it

I'm thinking of javascript, for 2 reasons: it's supported by Qt Script, and
QML developpers know it.
I considered QML 5 seconds, but I don't see how a declarative langage (mainly
for creating graphical interface) can be used here, and what we would gain.
So my primary goal is javascript using Qt Script.

Script manager
There's already a ScriptManager class in core, not used, with already some
nice things. This ScriptManager is used to start the engine with all the Qt
Creator interfaces registered.
Seems like a good decision, and I'll revive this class.

Qt Creator interfaces
There's not much code right now, but it seems that the direction taken by
ScriptManager is to do a 1:1 mapping with QtCreator.
For me, it doesn't make sense, scripting must be fast and easy.
I would propose to create an object (or maybe more than one) for each plugin,
with methods we want to export to javascript.

For exemple, for a cppplugin, I would like to write something like this (more
or less, but you get the idea):
if (isCppFile())

Script plugin
The script plugin will manage the script files (directories, delete,
Like the macro plugin, a way to execute a script using the locator, and a way
to assign shortcuts to scripts.
So except the engine (in ScriptManager... maybe rename it to ScriptEngine) and
the plugins interfaces, everything script related should be in this plugin.

Macro plugin
That's the last target of my project: replacing the current macro plugin by
something which create scripts.
So instead of storing key events (press 's' key, release 's' key...), I would
store editor->write("slots") in a script. It should also fix some issues of the
current macro plugin...

Any comments are very welcome, either here or on IRC (nikikko).


Nicolas Arnaud-Cormos | nicolas.arnaud-cormos at kdab.com | Senior Software
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
Qt-creator mailing list
Qt-creator at qt-project.org

More information about the Qt-creator mailing list