Date:Thursday, March 18, 2010
- Qt Quick (QML)
- Qt Multimedia APIs
- Qt 4.7 TP1 on N900
Qt Quick (QML):
Qt Multimedia APIs:
Qt 4.7 TP1 on N900:
Transcript:Mark Hatch and Justin Noel
Mark: Good morning everybody. This is Match Hatch. I run the Qt services business at ICS and with me once again today is Justin Noel one of our top engineers at ICS. So Justin, what's on the agenda for today?
Justin: Well this week is pretty much going to be all about the Qt 4.7 technology preview 1. It came out late last week. I've been playing with it all weekend and a little bit in the beginning of the week. It's got some pretty cool new features - I have to say. Things on the agenda: we're going to talk about Qt Quick, QML - the declarative UI system that comes with Qt 4.7 - that's pretty much the largest piece of brand spanking new technology that's come in with Qt 4.7. We'll talk about the Qt multimedia API that first saw light of day in the Qt Mobility space with the package that went beta last month. Some of those APIs have been rolled back into regular Qt 4.7. And we'll also talk about getting Qt 4.7 to work on the Nokia N900.
M: Oh, great! I'm waiting for that one. So let's talk about Qt Quick. What's going on there?
M: So Flash development, which is a classic UI development that we see all the time is that they have the designer using Flash to create the wire frame, or create the human experience, and then we get what they generated. We have to figure out how to make it work in Qt. So now the questions become, can these designers really use Qt Quick, which used to be called QML, to do this or is it maybe one step beyond their capabilities?
J: Well I found that the visual designer that comes with Qt Creator 2.0, which is also in technology preview, is okay. It's pretty limited in the amount of items you can use compared to the amount of items you can use if you wrote the QML by hand in Creator. So that part is very new, and I'm sure it will get a lot of attention over the next few months and become a lot better. The coolest thing I have to say is that if you create the QML with the visual editor, you can actually go into the syntax highlighted text editor, make changes to the properties, and they will also be automagically reflected in the visual editor.
So I think it would work pretty well once it is stabilized and well-documented and the visual designer can do all of the features that you can do with hand coding.
M: So maybe initially here, you may need someone who is more comfortable with scripting than your typical Flash developer is for the first couple of releases until the Qt Creator stuff comes up to speed in terms of visual designer, you think?
J: Yes, well it turns out just going through and playing with the Visual Creator, you can lay down a couple of text fields in a base state, and then you can move to lets say for naming state 1, you can say, I want one of these labels to move from the lower right-hand corner to the top left-hand corner, and you can do that in the visual designer and boom, you've got a state. You can lay down a mouse area, change the state on a click, but the text label just snaps over to the other point - it basically teleports.
Very easily, if you go into the script you can specify transitions to be associated with your screen and you can actually specify one very short transition to say that all X and Y transitions are going to be based on a linear number transition so over a thousand milliseconds, let's say. And after you specify that transition, then you can go back to the visual editor, you can hit preview mode, and you click on the screen, and now the text moves from point A to point B in a fluid animation.
M: So it sounds like they're getting there. It sounds like a definite improvement - certainly we'd never ask the Flash guys to write C++ and Qt code. So how about the other side now, if I'm a hardened C++/Qt user, what am I going to think of this Qt Quick stuff?
J: As a hardened C++ guy myself, I have got to say, we are not in Kansas anymore. It is an interesting environment because you can do a lot of things with a very small amount of code - the concepts of states and finding state machines makes things very straightforward. What I found as a C++ person is grasping how to write your QML code in object-oriented fashion is very hard, and I think it comes down to learning any new language. For example, you take people who are new at C++, or even new at Qt, and they will try to do as much as they can inside of the main function, which is obviously what you never want to do. And I think I find myself falling in with the first couple of tries is trying to do too much in one spot. There's also a tendency in QML for things to be sort of magic, and what I might call global, in that in your project you can assign identifiers to all of your objects and those identifiers can be referenced in any one of your QML files. Which makes it really easy to set properties of objects you don't really have access to, but it also makes it very easy to step on your own feet if you set an id in one file and then in another file you make an instance of your new object and you re-set its id to something else. Now when your code blocks gets processed, the old id is no longer valid.
M: Now I'm a little confused in that there's QML and there's Qt Quick, are they one in the same, or is it a different name? It's the QMLinterest mailing list, right?
J: Yes, so Qt Quick seems to have been the brand name that Nokia is using for what they used to call QML. In fact, I think even that name is getting overridden by QDeclarative. I've noticed that in the technology preview, they changed a bunch of class names that start with QML something to QDeclarative something in the C++ world. So I think even Nokia is trying to get away from the acronym QML and either call it QDeclarative or Qt Quick.
M: So the technology preview means that not only do APIs change, but marketing trade names may also change.
J: Yes and in the technology preview everything is fair games, as it should be because users like myself and our listeners are going to be using this stuff in a pretty early stage and we want to make sure that Nokia gets it right the first time.
M: Sounds great. So what about this multimedia API?
J: Yes, we talked about this very quickly last week that there's been some rollback in functionality from the Qt Mobility back into regular Qt. This includes a video-playing widget and some audio-playing stuff, as well as the Bearer Management API, which basically can allow you to use multiple networks to get different pieces of information. That's really useful in phones where you either want to use the WiFi or you want to use the 3G network - it might be cheaper to use WiFi, so there may be some logic in your program to decide what to use.
The biggest thing I think is the multimedia API which is a new way of thinking about multimedia in Qt. You have this concept of a media context which could be a file or a streaming URL, which you create a media object, which could be an audio media object or a video media object, and then you can either assign that media object to play on a video widget or even a QGraphicsView video item. I did notice in the documentation for QML and Qt Quick there is actually a video item as well. So you can display your video in a number of different ways now in Qt, including right onto a graphics scene.
M: So what about Phonon? I'm still confused about the relationship between these two.
J: That's a very good question. There was some chatter at DevDays last year that this new API may use Phonon on one of its backends to get some of its work done. It's very opaque from the documentation. I can't tell at all what backends are being used on the different platforms. There is some mention of possibly making media services, plugins, media controls, from making your own types of backends for the system but there are no examples on how to do that. The documentation in Phonon, I had to look at it again just a few minutes ago and I did see, this might have been in other versions I haven't looked in a while, but it said that the version of Phonon that is shipped with Qt is an older API. That the Phonon actual project run by KDE has moved on and added new features, but those new features will not be supported in the version of Phonon that Qt supplies.
M: Well that sounds like Phonon is on its way to being deprecated then.
J: Well if they're not going to add new features to it that would definitely be the implication.
M: I know in the projects we're starting now, even though it's still in technology preview, we're using media API to do that stuff.
J: It would be really interesting to find out what's going on under the hood of the Qt multimedia API. I've noticed that on the X11 version of Qt when you configure there's new tests that test for X video support, which suggested doing some sort of in process rendering, but I have no idea how they're generating the frames. They might be using G-streamer; I don't really know.
M: So I guess the final topic today was our favorite phone, the N900, and the availability of 4.7 on that?
J: Just this morning posted to labs.trolltech.com, there was a blog posting and a link to download packages for the Qt 4.7 technology preview on the N900. This seems to be the styled and kineticized version of Qt for the N900. It is unstable. If you have previously installed Qt 4.6 onto your N900 phone, Qt 4.7 is actually going to blow that away. So if you need a stable version of Qt to run your application against, you might want to think twice before installing this version. There are instructions and a link up at labs.trolltech.com. It also seems that there should be sometime in the near future a new firmware release coming out with the N900 that is going to make Qt 4.6 the standard version of Qt that's going to be installed in slash user. After that, if you install the Qt 4.7 technology preview, it will be installed in opt. So, they will not conflict. You can actually switch between them using environment variables.
M: So as far a user of the N900, like you and I for example, it's not going to change anything in the existing applications because they're still GDK-based for most of them, right?
J: Yes. None of the actual applications that run on the N900 actually require Qt at all to run. You might have some things installed from devel extras repository that might use it, but you shouldn't break your phone.
M: Oh okay. Then if we had an application for some of the demo applications we got this would be a great thing to try out.
J: Yes, I think the N900 will be the perfect platform to try out Qt Quick because it's a very gadget-type of device where your applications will fit very well into the finite state machine pattern. Most things need to have big, special-looking buttons. It's something where the user is not expecting a real platform look and feel. If you're making a weather widget, there's really no platform specification for that. It will be very interesting. I can't wait to try it out.
M: Thank you, Justin. This has been an informative podcast and I think our listeners are itching to go out and download 4.7 themselves and give it a shot. If you have any input, we are very interested in hearing about it at firstname.lastname@example.org. Thank you again!
J: See you all next week!