Qt Creator editor news

Published Wednesday September 28th, 2011
18 Comments on Qt Creator editor news
Posted in C++, Qt Quick, QtCreator | Tags: , , ,

While Qt Creator 2.3.0 was only released recently, we’ve already been busy working on new features and bug fixes in the master branch for some time now. There have been a few interesting developments in the C++ and QML/JS editors that I’d like to share with you.


We’re currently prototyping what would happen if we replaced our own C++ code model with clang’s. There’s just a couple of things left that need to be done before we’ll make the experimental branch public. There’ll be more about this in a different post.

The code style settings pages introduced in 2.3 have been overhauled. You can now set up several code style presets and easily switch between them. They can also be exported and imported to share them with your team.

Code Style settings page

There’s a new feature that helps you keep function declarations and definitions synchronized. Whenever you edit a function signature Creator will check if it can find the matching declaration or definition. If it found it and thinks it can apply your changes there, a little light bulb will appear at the end of the function. Open the list of quick fixes (Alt-Enter) and select ‘Apply changes’ to perform the same changes in the matching code.

If you’ve tried the ‘insert definition from declaration’ quick fix before but given up because it didn’t do everything you wanted, try it again! It’s been fixed to put the definition in a more natural spot (after the preceding declaration’s definition instead of at the end of the file) and has also become much smarter about minimizing qualified names (instead of always expanding them fully).


There’ve been several improvements that make functionality you know from C++ work in QML. Find Usages now works on QML component names – and globally renaming just about every kind of symbol is now supported as well.

To aid reading QML and JavaScript code we’ve introduced semantic highlighting to the QML/JS editor. That means code with a special semantic meaning, such as external ids, JS variables, strings with state names and several others can be formatted differently.

The default color scheme tries to be helpful without being too distracting and doesn’t use different formatting for all of them. You can set it up as you see fit in the editor preferences.

Semantic highlighting in QML
Options for Semantic Highlighting

We’ve mentioned JSlint-style static checks that Creator runs on your source code before. It’s now much easier to run them on the whole project: Clicking Tools->QmlJS->Run Checks will scan all projects’ qml and js files and report the results in the QML Analysis filter of the Build Issues tab. There are a couple of new checks as well.

QML and C++

When you’re writing a QML module or using QML from a C++ application you’ll often register new types with qmlRegisterType or expose some class instances with setContextProperty. Creator’s C++ code model now scans for these calls and tells the QML one about them. That way, the properties will show up in code completion and the static analyser won’t complain about unknown types.

However, since it only works when the source code is available, module authors still need to explicitly generate type information for QML modules with plugins before distributing it.

For feedback post here, on the Qt Creator mailing list or use the bug tracker.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in C++, Qt Quick, QtCreator | Tags: , , ,


Cristian says:

Having clang as a C++ code parser in QtCreator would be awesome.
This would be similar to Visual C++’s usage of EDG as C++ code parser.

I would be happy to have more options for C++ code style definition. Look at IntelliJ IDEA – it really has a rich set of options.

The declarations and definitions sync looks very useful. Looking forward to use it!

Dominik says:

The only things I was missing in code refactoring is, that the declarations and definitions don’t stay in sync and, that when I call “insert definition”, it throws it at the end of the .cpp, which was forcing me to do extra work with moving this definition. And now you’re telling, that it’s gonna be fixed. It’s just great. Thank you

Currently I like the direction the creator is heading. Still too many tooltips here and there for my taste, but this is not a problem anymore. 🙂
Of course, new is not new enough, so every few days I pull head. Last week I discovered a new menu item ‘test’. When I clicked it, the creator just crashed. Today it does not crash anymore, but I cannot get the test functions to do anything at all. Clearly work in progress. Is this even remotely usable already? I would test the test. 🙂

Scorp1us says:

Is there an overwrite mode yet?

Like when you hit and can overwrite the character under the cursor without hitting delete?

Matt Levine says:

PySide/Python support would be pretty sweet… just saying 🙂

pbws says:

When will a 64-bit Qt SDK for Windows x64 be available?

Thank you.

Will Stokes says:

I love QtCreator. 🙂 The editor is just fantastic. The code style settings in 2.3.0 are simply fantastic. Finally and editor that will format the code the way I want it to look down to every detail!

Christian Kamm says:

Scorp1us: No. Please vote on https://bugreports.qt.nokia.com/browse/QTCREATORBUG-5330.
Matt: We’ve got no plans to do that, sorry: https://bugreports.qt.nokia.com/browse/QTCREATORBUG-3585 .
pbws: I don’t know.

ZSchneidi says:

The new code completion for qml registered types is awesome.
Thats what I was hoping for ^^

Thank you guys for making the QtCreator the most amazing IDE out there.
Its just fun to use it and nice to watch it growing.

Thanks to all Qt and QtCreator developers ; )
thumbs up

Ralph Zhang says:

Can’t wait to see clang being the (I guess?) the code parser, the current parser just doesn’t work for our project. We don’t have very large code base (50K loc), but with some deep template and macro presented, QtCreator eats all my 8G memory while parsing them and still growing.
I’m pretty sure as a compiler, clang won’t do that 😛

Rob Caldecott says:

Can you format old code based on the C++ formatting rules? That would be very, very useful.

Thorbjørn Lindeijer says:

It’s awesome to see all the improvements made to C++ support! And in fact I find myself using the ‘insert definition from declaration’ almost every time now – as well as the syncing feature of course. Thanks! 🙂

Alexey Sergeev says:

How about “find all overrides of virtual function”, also “move to implementation”, correct “Find Usages” not just search for function name – all the things ages ago in KDevelop4?

Christian Kamm says:

Rob: No, currently you’d have to open each file manually in Qt Creator and reindent it. Don’t the existing tools, like astyle or indent work for you?
Thorbjorn: Great to hear!
Alexey: “Find Usages” does already exist in Creator; it has some limitations, like not doing overload resolution, but is already incredibly useful. To find all overrides of a virtual function I usually just run find usages and check the headers. What should “move to implemenation” do?

Boris Rybalkin says:

Maybe Alexey meant this one from IntelliJ IDEA:

That is very helpful. It provided me a few ideas and I’ll be posting them on my web site eventually. I’m bookmarking your site and I’ll be back again. Thank you again!

Commenting closed.

Get started today with Qt Download now