Qt Creator editor news
September 28, 2011 by ckamm | Comments
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.
C++
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.
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).
QML
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.
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.
Blog Topics:
Comments
Subscribe to our newsletter
Subscribe Newsletter
Try Qt 6.8 Now!
Download the latest release here: www.qt.io/download.
Qt 6.8 release focuses on technology trends like spatial computing & XR, complex data visualization in 2D & 3D, and ARM-based development for desktop.
We're Hiring
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.