Archive for the ‘Qt’ Category

Deploying shaders for view transitions on Qt5 / QtQuick 2.0

Sunday, August 26th, 2012

I’ve been playing with QML quite a long time, even though it’s a young technology. I bet, I’m not the only one who has noticed that when building an application with QML, you may end up having a bunch of views and then you should figure you a way to navigate between them.

You can of course create all the views in the beginning and then switch between them based on user’s interaction. This may lead you to the situation where your app eats memory and your “Main.qml” is rather large. Another way is to build your own framework which provides an infrastructure for creating and displaying those views. The third way would be to use a ready-made framework such as Qt-Components. The third way, may not be always an option because it may work only on certain platforms, therefore you’ll end up building something of your own.

I decided to give a try and build something of my own. I call it “d-touch” framework. I had the following list in my mind how the framework should work:

  1. Transitions between views must be dynamic i.e. I want to be able to change from slide transition to something else without touching a code at all.
  2. I don’t want to create all the views in the beginning in my main. Instead I want to load them dynamically on demand.
The first requirement was solved using shaders. To be more precise, I use only fragment shaders at the moment. This lead me to a solution that I don’t need to define “positions” for views and then do transitions e.g. from (x1,y2) to (x2,y2) coordinates. Instead, I just make them to be in a “view stack” and actual transition has been implemented using Qt5′s ShaderEffect element.
The second requirement is solved by providing functionality (functions) for creating views dynamically. View management is handled fully by d-touch framework. Views just define, what QML files needs to be opened or closed and the framework handles the rest.
Here’s a short video where I demonstrate how shader based transitions work and all the views are created only when needed.

(more…)

I’m looking for a new Job!

Monday, August 20th, 2012

Things ain’t go always like you plan and therefore I’m starting to look for a new job. If you have read my blog, I’m pretty sure that you know I like Qt. So here’s my wish list what I’d like to do and what I’ve done:

  • I like to use Qt and Linux / Mac
  • I’m a ScrumMaster and I like scrum, so I like working in teams
  • I’m used to of multinational and distributed environments
  • Job should be in Finland  so hear me Jolla, Digia, Futurice, etc:)
  • I can keep Qt / QML trainings too
  • I like people, so I’m used to of working near to clients
  • I have worked both on mobile (Nokia N9) and on industrial side
  • I’ve released few apps to iOS side too
QML Portfolio
(update) I added my QML portfolio here too. It doesn’t include all the stuff, but the coolest ones. The last three videos are stuff that I’ve done for my previous employer.

If you are interested in to hire me, you can download my CV below or send me email directly to marko(dot)a(dot)mattila(at)gmail(dot)com. Oh yes, and I could start my new job (most likely) in the beginning of September.

Marko-Mattila-CV

Qt5: New signal and slot syntax

Thursday, May 17th, 2012

I thought, that I should write about this topic, because it’s time to start my self-education project again and see how I can take new features of Qt in use. I’m not sure how useful this blog post is because there already is a nice wiki page available about the same topic on qt-project.org. But for those, who haven’t read the wiki page, this might be a bit shock – Yes, in Qt5 there is a new syntax for connecting signals and slots!

Don’t worry, your old code (Qt 4.x) doesn’t break and Trolls will continue the support of the old, string-based connection. So what’s new in the new signal-slot syntax then? Basically you can connect signals and slots using the following style shown in by the example below. Note that you still have to have Q_OBJECT macro defined in a class, which introduces signals or slots.

connect(sender, &Sender::valueChanged, receiver, &Receiver::updateValue );

Instead of using SIGNAL() and SLOT() macros, you can now also use C++ function pointers to connect signals and slots. In Qt5, you can connect signals to any member function of a class  i.e. they don’t need to be slots. Note that in the end, Qt slots are only class’ member functions. The “slots” keyword is only an empty define and used only by MOC (Meta Object Compiler) when parsing headers.

(more…)

Porting QtQuick1.X extensions to Qt5

Wednesday, March 7th, 2012

A friend of mine (@jan_ekholm/twitter and chakie/@freenode) developed a cool C++ VideoWidget using Qt a some time ago. The idea of making this kind of own custom widget, was that Qt’s multimedia isn’t the best multimedia kit on earth. The problem is that it’s not really a cross platform because it depends on underlying platform multimedia kit. For example on linux it may depend on streamer or phonon backend, on Windows it depends on DirectShow and on Mac on QuickTime. This also means that something that works on one platform, may not work on another platform.

One weird thing about Qt’s multimedia is that QML bindings are provided only by Qt Mobility’s multimedia module. Then again Phonon isn’t very efficient and it doesn’t have QML bindings. If using VLC with Qt, it’s almost impossible to make overlays (text) visible on a video. So Chakie made a solution, which doesn’t depend any of these, is a cross platform (Windows, Mac, Linux) and works quite nicely.

I thought that it would be great to port that QWidget/C++ based solution to QML. Actually, it was quite straight forward to do that, thanks to Chakie’s original solution, it took only a few hours to get the first version to work. Of course, fine tuning takes time, but it didn’t really take more than two hours to make the QML extension to show a video.

(more…)