It happens seldomly, but a couple of weeks ago I had the chance to look at some parts of the Windows Runtime port again and now I have some time to write about the outcome.
One of the tedious items when working on the port is that all applications have to be “pre-packaged” to be run on the host system. As this is not really a cross-compile environment, where you need to deploy an application and its dependencies to a device, it feels weird. On the other hand it reflects the real world scenario pretty well, which helps you as an app developer so that you do not forget to put items into the final package.
So right now the test build needs to look like this:
App.exe
AppManifest.XML
QtCore5d.dll
Platform/Imageformat plugins…
…
That implies that you need to copy Qt every time you want to test something. This usually is not a problem for an application developer, who copies Qt once. Doing that while developing on Qt itself is time consuming and error-prone, as for each test application you need to copy again.
Browsing through the documentation I found the following option to be interesting: “Framework ”
Qbs has reached a state where it’s conveniently possible to build projects of the complexity of Qt Creator. Therefore it deserves a version number that reflects its usefulness to the public. To encourage you to use it for your own projects, we hereby present to you qbs 1.0.0.
Why should I use it?
Qbs takes care of your build environment. Build your project for different platforms in the same shell.
Build multiple configurations of your project in parallel.
Fast incremental builds. A speed comparision is here.
QMLish language. Write your complicated tasks in JavaScript instead of some obscure language (I’m looking at you, qmake).
Qbs is supported in Qt Creator 2.8.
Qbs is not tied to the Qt version. That means switching the Qt version doesn’t automatically switch your build tool version.
Where can I get it?
Qt Creator 2.8 will come with qbs integrated.
Instruction how to build qbs from source can be found in the wiki: http://qt-project.org/wiki/qbs
This is a question that arises very often. Though it would be possible to replace the current qmake-based build system of Qt with qbs, we still would need a configure script and our infamous syncqt. I don’t see much gained from that. We’re aiming somewhat higher and want to replace configure and syncqt as well. That’s where qbs still lacks features. Also, bootstrapping qbs is not possible yet.
Today we release the Qt Creator 2.8 beta. Thanks to the 60 individual contributors to this version, it comes with a large amount of new “stuff” and lots and lots of bug fixes.
Too much to cover it all here, as always, so I’ll try to highlight a few things:
You can now open new editor windows with Window > Split New Window. This opens a new window that behaves basically the same as the editor area in the main window (for example you can split this window as well). Opening a document will then open an editor in the last editor window that was active. Since this raises quite some usability questions, how things should work exactly, we want and need your feedback on how you (want to) use that feature, and what issues you have with how it works currently! So please open bug reports, or contact us on the mailing list or IRC when you find something that should work different.
C++ support in Qt Creator got lots of fixes, and more refactoring actions:
Moving function definitions from inline in the header to source
Assigning a method return value or ‘new’ expression to a local variable
Adding declarations and implementations for pure virtual methods from the superclass (many thanks to Lorenz Haas!)
What many of you probably didn’t notice is that Qt Creator 2.7 has an experimental implementation of a side-by-side diff viewer (which needed to be turned on explicitly). This diff viewer is now enabled by default and used for git version control operations. You can also diff two arbitrary files with Tools > Diff.
Git version control integration got many new features, most notably maybe that you now can do interactive rebases from within Qt Creator. But also added was support for updating submodules, continuing and aborting many operations, and a lot more. Thanks to Orgad Shaneh and Petar Perisin for all their work in this area.
Thanks also go to Sergey Shambir who contributed an editor for python code, with highlighting and indentation, and a python class wizard.
Otherwise, display of many data types when debugging with CDB was fixed, QNX and Android support received many fixes, and much, much more. For some more details you can head over to the change log, or just download and try it.
Note: Something that I want to mention here to reduce the surprise: Progress information has moved to the bottom-right corner of Qt Creator’s main window, with the option to hide the detailed progress information and just show a summary progress bar instead.
We have launched Qt Insights, a Qt market research study that will help us learn more about Qt usage in the big world and also help new audiences learn about Qt.
Digia, BlackBerry, Basyskom, ICS and KDAB have come together to sponsor the Qt Insights Market Research Study. Qt Insights will help new audiences learn about Qt through a dialog with Qt users together with a media awareness campaign.
We need your help!
Complete the 10-minute developer survey and enter into a draw to win one of three Blackberry Z10 smartphones plus other prizes courtesy of Digia will be available throughout the campaign.
Take the survey at http://bit.ly/QtInsightsSurvey. Findings will be shared at www.qtinsights.com later in the summer.
For a few months now, we have been working on a new project under the codename Boot to Qt, and today we launch it as a technology preview.
Boot to Qt is a commercial offering that provides a fully integrated solution for the creation of slick user interfaces on embedded devices. The offering includes:
A light-weight UI stack for embedded linux, based on the Qt Framework - Boot to Qt is built on an Android kernel/baselayer and offers an elegant means of developing beautiful and performant embedded devices.
Ready-made images – We have images for several different devices which include the Boot to Qt software stack, making it possible to get up and running with minimal effort from day one.
Full Qt Creator Integration – One-click deploy and run on hardware and a fully featured development environment.
Simulator – A VirtualBox based simulator which allows device development without hardware and opens up for simulating hardware input, such as GPS and connectivity.
This technology preview focuses on the stack built on an Android baselayer. We also want to provide a similar software stack and the same convenience with ready-made images and IDE integration also for traditional embedded Linux, hopefully with a preview coming some time this summer.
We are expecting to have an official release towards the end of this year.
The following video shows Boot to Qt in action on our reference hardware:
And the following video show the Boot to Qt SDK works:
Scope of Boot to Qt
The software stack includes most of the Qt Framework:
Qt Core, Qt Gui, Qt Network, Qt Widgets, Qt Xml
Qt QML and Qt Quick
Qt Quick Controls
Qt Graphical Effects
Boot to Qt specific additions, including virtual keyboard, brightness control and power off/reboot functionality
The hardware devices supported in the Technology Preview are:
Google Nexus 7 - 1.2 GHz Quad-Core ARM Cortex A9, Tegra 3 GPU, 1GB RAM
This is not a fixed set, but a place for us to start. If you have suggestions for other devices, let us know. The stack can also run on x86 hardware.
Right now, the stack is single-process. The launcher is a QML application which launches other QML applications in-process. We have looked briefly into using Android Gralloc APIs to do multiprocess sharing of hardware buffers, and we know it can be done, but we consider this out of the 1.0 scope.
We have also had similar discussions around Multimedia and Webkit, we want to have them in place, but maybe not in the initial release. The current software stack is already quite powerful and serves a number of different use cases.
Performance
Qt 5 introduced a new OpenGL ES 2.0 based scene graph to power Qt Quick 2. This makes Qt Quick very suitable for running on embedded hardware, even those with moderate specs. The demo launcher we ship with the images for instance, runs velvet at 60 FPS on all our hardware devices.
We were looking at CPU usage while playing around in the application launcher on the Nexus 7. When idle, it uses a shader to add a glow on the currently selected item and has a small particle system on the Qt logo in the corner. We found that when the launcher was just animating the glow on the active item and running the small particle system on the Qt logo, the CPU load was running at about 50%. When we flicked it, it dropped to 30% and when the finger was down and we were moving the list via touch, it dropped to below 20%. So it seemed that the more we did, the less the CPU load became. What we were observing was CPU frequency scaling. The CPU is a Quad-core clocked at 1.2GHz (with a special 1.3Ghz single-core operating mode), but when idle, it had disabled 3 cores and had scaled the one remaining core to 102Mhz. So we were able to animate a large part of a 1280×800 screen at 60FPS on a CPU clocked at 102Mhz, and were still only using half of that.
For reference, the same animation runs at 2% CPU on the i.MX6 and 15% on the Beagle, none of which does do frequency scaling.
We also have pretty decent startup times. Below is a diagram comparing Boot to Qt to native Android. Now of course, full Android brings in a lot of additional stuff, but that is also the point. Most embedded devices do not need that.
Startup times, in seconds, from power-on until device reaches the B2Qt launcher or the Android Homescreen.
Lower is better
This is not too shabby, but we believe we can cut this down a bit more, at least when we start exploring various embedded Linux configurations. As an example, Qt 5 on Raspberry Pi can start rendering after as little as 3 seconds.
Boot to Qt is available for evaluation upon request. If you want to try it out or if you are just interested in the software, please use the contact form on the product page and we will be happy to get you started. Of course, feel free to leave comments and questions on this blog too.
Digia has supported Metropolia University of Applied Sciences in their electric car project called Electric Raceabout (E-RA). This cool research project has produced a street legal electric sports car, which not only has the World record on ice, but also runs Qt.
Metropolia University, located in Helsinki, Finland, does extensive research on electric vehicles, one example being E-RA – an electric sports car built primarily by automotive engineering students.
With 4-wheel drive and well designed handling E-RA is a really capable sports car with impressive specs:
Top speed of over 260 km/h
Motor power of 282 kW
Peak torque of 800 Nm – in each wheel
And all this provided by an electric vehicle that is fully street legal (and rest assured, the Finnish road inspection is surely one of the toughest in the world to pass).
E-RA has achieved lap time of 8 minutes 42,72 seconds at Nürburgring Nordschleife, which was electric vehicle track record for quite a while, as well as World record as the fastest electric vehicle on ice with average speed of 252,09 km/h. Nicely driven E-RA has operating range of over 200 kilometers.
The students have built both the IVI system and the instrument cluster with Qt 4.8 running on top of Linux. I think the whole E-RA project is a really great proof of the skills the soon-to-graduate engineers have, and certainly the Qt parts are no less impressive.
Have a look on the enclosed video produced by the students at Metropolia University to hear the full story:
If you want to create a QML application where the UI responds well to window resizing, the toolbox that Qt Quick offers has been somewhat limited. Qt 5.1 will offer the new Qt Quick types RowLayout, ColumnLayout and GridLayout for this purpose.
Background
Up until Qt 5.1, positioners and anchors have been the only Qt Quick tools available for arranging items in the UI.
Positioners are convenient for adding many items, but not always helpful for creating a resizable UI since they (as the name implies – surprise, surprise) only positions the items – the widths and heights are kept the same.
Anchors allows a bit more flexibility, at the price of verbosity. With anchors you can make an item stretch by binding one edge to the corresponding edge of the parent, and you set up a similar binding on the items’ opposite edge. However, you cannot make several items distribute themselves evenly if the window is resized.
The last option is to do the manual layouting yourself. This offers great flexibility, but it can be verbose, cumbersome and error-prone. During the development of Qt Quick Controls, we wanted to improve this and decided to provide a better and more convenient layout system.
import QtQuick.Layouts 1.0
By including the above import you will have RowLayout, ColumnLayout and GridLayout available in your toolbox. These layouts behave very much like their sisters found in the QtWidgets module: QHBoxLayout, QVBoxLayout and QGridLayout. It also tries to match the API of the Row, Grid and Column QML elements where it makes sense. So, if you are familiar with any of these APIs, you will find Qt Quick Layouts easy to grasp.
Alignment of items inside a cell can be specified with the Layout.alignment property.
The feature set it adds might not look like a lot, but the fact that you can have both non-stretching items and stretching items in the same layout makes things easier and more intuitive in many cases.
Example
Suppose we need to create a ToolBar with two buttons and a slider that occupies the remaining space. When resizing, the extra space will be allocated to the slider.
Without Qt Quick Layouts, the solution with least code would probably be a mix between using a Row and using anchors:
Notice how much shorter the declaration for the Slider element is. Also note that when using Qt Quick Layouts, the spacing only needs to be specified once. Code is reduced from 288 to 172 characters (whitespace excluded), which is a 40% reduction.
Summary
In this example, by using Qt Quick Layouts we got 40% less code, improved readability (not only because the code got shorter, but also because the structure of the code became closer to the structure of the UI).
If you want a resizable UI, you will probably find that Qt Quick Layouts are easier to use than anchors, positioners and manual layouting.
When writing JavaScript code, it doesn’t take long until I’m missing some function which is available in Qt’s C++ API. One very simple example is QList::contains. Checking whether an array contains a certain element works like this in JavaScript:
var names = ["Egon", "Peter", "Raymond", "Waldo"];
if (names.indexOf("Waldo") !== -1)
print("We've found him!");
It would be nice if we could express the condition using a contains method but Array doesn’t provide one.
Luckily, JavaScript enables us to add methods to inbuilt types by modifiying the corresponding prototype object.
Array.prototype.contains = function(e) {
return this.indexOf(e) !== -1;
}
if (names.contains("Waldo"))
print("We've found him!");
Yay! Now we can use the contains method for all arrays!
But wait – there’s a surprise lurking right around the corner once you’re trying to iterate over the keys of the array.
for (var i in names)
print(i);
This will print:
0
1
2
3
contains
I know, iterating over arrays should be done with an index variable…but still…this additional key is unexpected and asking for trouble.
The solution for this problem is to mark the property contains as non-enumerable. We can use the Object.defineProperty function for that which is available since JavaScript 1.8.5.
Object.defineProperty(Array.prototype, "contains", {
value: function(e) { return this.indexOf(e) !== -1; },
enumerable: false // This is the default and can be omitted.
})
We’re passing to Object.defineProperty the object we want to enhance, the name of the property we want to add and a descriptor object that contains the attributes of our new property.
The value of contains will be the function that we formerly passed directly to the prototype. Setting the enumerable property to false in the descriptor object will hide contains when using a for (... in ...) loop.
This way we can create a nice Qtish API for the inbuilt JavaScript types Array and String. This can be put into a .js file and used it in QML/JS or in qbs project files.
What do you think? Would such an API be helpful for your QML code? Which QList or QString method are you missing most?
I am happy to announce that we have today released Qt 5.1 Beta. We are now a major step closer to release Qt 5.1.0, which is expected before the summer. With the Beta release, binary installers for Qt 5.1 are available making it easier for you to get started with Qt. Let’s take a quick look at what is in the package.
Key functionality
The main driver for Qt 5.1 has been to increase the maturity of the new features introduced with Qt 5.0. We have improved the functionality and performance based on the feedback received from real-world use cases of Qt 5.0 and porting applications from Qt 4.x. We are able to meet your needs with Qt 5 because of the feedback and contributions from our growing ecosystem of about 500,000 developers in over 70 industries using Qt on numerous platforms and configurations.
The key new features of Qt 5.1 Beta include:
Qt Quick Controls module providing a set of reusable UI components especially for desktop applications created with Qt Quick
Qt Quick Layouts module bringing an easier, more intuitive, way to manage scalable UIs by ensuring that items are consistently arranged, and that the UI as a whole remains usable across different screen sizes.
Qt Serial Port module providing a cross-platform interface for using hardware and virtual serial ports in Qt applications
Possibility to use Qt Quick and Widgets together in the same application window
Qt Creator 2.7.1 bundled into the package, providing, for example, Qt Quick Designer for rapid prototyping, as well as improved C++11 code editing
Support for static Qt builds making it possible to address those use cases that cannot use dynamic linking
Introducing Qt Sensors as an officially supported module
For most users the big thing with Qt 5.1 Beta compared to Qt 5.1 Alpha is binary installers that provide a convenient way of installing all you need to start developing with Qt without needing to build Qt yourself. With Qt 5.1 we are introducing some new configurations such as 64bit VS2012 with OpenGL, which is already available with the Beta. Soon after the Beta we are upgrading MinGW to version 4.8 and aim to bring also 32bit VS2012 with ANGLE configuration by the time we are releasing Qt 5.1.0.
Qt 5.1 Beta comes as an offline installer, but we will also be providing online installers before the release of Qt 5.1.0 final. The offline installer contains all you need to get started with Qt – tools, documentation, examples and pre-built Qt libraries. Source packages are available for those who wish to build Qt (or need to use a configuration that is not available as a pre-built binary). In addition to the desktop binaries, Qt 5.1 Beta comes with pre-built binaries for Android that can be bundled in with your application.
New platforms
Qt 5.1 Beta provides technology-preview level implementation of the new Android and iOS ports. In addition, Qt 5.1.0 final is planned to re-introduce Windows Embedded Compact 7 support that has earlier been available with Qt 4.8. We have added all these new platforms into the CI system so that each change that goes into Qt is verified to work on these as well as the other platforms and configurations already in the CI. At the moment, the CI for Android and iOS only tests for building, but we are gradually also adding the automated tests to be run on these new platforms, to decrease the possibility of regressions.
There is quite a lot of buzz around the new mobile ports and many are interested in knowing what is possible already with the Qt 5.1 Beta. In general, it can be stated that you can create stunning applications that run smoothly on both of the new platforms, but with limitations in supported functionality and the developer experience of getting your masterpiece into these devices.
With Android the following functionality works quite well in the Qt 5.1 Beta:
OpenGL, networking and other core functionalities of Qt
Some parts of Qt Multimedia, for example QML media player
A set of commonly used sensors with Qt Sensors
Deploying your application to a device from Qt Creator
Debugging your application from Qt Creator
Qt 5.1 Beta comes with pre-built binaries for Android that can be bundled in with your application
With iOS the main issue is Qt Quick 2 not being available, as it needs a new QML engine, but the following functionality works quite well in the Qt 5.1 Beta:
Widgets, Graphics View and Qt Quick 1 applications
OpenGL, networking and other core functionalities of Qt
A set of commonly used sensors with Qt Sensors
Deploying your application to a device from Xcode / iTunes
Next steps
With the release of Qt 5.1 Beta we are one step closer to the Qt 5.1.0 final release, which we aim to have out before summer. Based on the feedback we receive from the Beta, there will be a Release Candidate created in a few weeks time, or alternatively a second Beta.
Registration for the Qt Contributors Summit 2013 is now open.
Before going into details, I’ve added a photo of the The Guggenheim mirror balls right outside the famous Guggenheim Museum in Bilbao. It can symbolise how every Qt contributor is linked together, working on the same project, using the summit to reflect on how Qt can be developed even better. Ok, Knut, snap out of it. Over to the practicalities.
You took a sponsorship package including event invitations (coming soon)
You are in the organization team.
You are invited by a maintainer or the organization team and we still have seats left.
KDE Akademy contributor
Please add sessions unconference style
Since the main idea for the Qt CS is to let developers meet and make solutions, now is the time to pre-schedule sessions on the Qt CS program wiki. Please press “Join group” at the top of the wiki-page. We will give you wiki-access as soon as possible and add you to the group.
The Qt Blog provides you with one area for all Qt development posts from our Qt engineering experts. It includes information on projects in the works, tips and tricks, technical release information and more from our pool of very clever Qt developers.