Posts Tagged ‘Qt’

Greetings from Fosdem13

Monday, February 4th, 2013

UPDATE: I published this one day too late, but here it is anyway:)

I’m writing this blog post from Fosdem. It’s my last day here and it feels that I’m already waiting for the next Fosdem. I must say that it’s amazing what volunteers can achieve. Thousands of developers, hundreds of presentations and a lot of beer.  Great work I must say!

I actually came to Fosdem to keep a presentation about QML mobile application development and I demoed how to abstract platform dependencies away so that it’s easier to port your mobile app to different platforms. The showcase part was demoed on Sailfish OS. I think the feedback I got from the presentation was very nice. So thank you for that!

I didn’t come to Fosdem alone. I came with other people like Carsten Munk (@stskeeps), David Greaves (@lbt) from Mer project, Marko Saukko(@sage), Carol Chen (@cybette) and Iekky Pylkkä (@iekku) from Jolla. David and Marko are also having talks here. Marko will talk about Porting Nemo Mobile and Mer to a new HW and David will be talking about How do we make “Qt on Mer” the solution of choise for device vendors.

So if you’re still here and you’re interested in Mer or Nemo Mobile, go to see these presentations.

Btw, the public transportation is really crowded here:)

20130203-094741
I think this is enough about blogging this time, but I just want to thank (again) all the voluteers and of course other people coming to here. What a great event!

 

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…)

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…)

Playing with Qt5 and QML

Wednesday, August 31st, 2011

It’s been a while since I did any experiments with Qt. I decided to take a look at Qt5 and QML. The first thing was to fetch the source code and figure out how it can be built. I was really surprised that in the end I didn’t encounter any problems while building it.

Building Qt5

It took only few steps to build Qt5 on Mac.

  • git clone git://gitorious.org/qt/qt5.git qt5
  • cd qt5
  • ./init-repository
  • qtrepotools/bin/qt5_tool -c -p -b
You can check out qtrepotools -h to choose what ever options you want.

Playing with QML

After building, you find all the stuff from qt5/qtbase directory. There is a bin directory where all the required binaries are. If you want to test how new QML with really fast scene graph works, you can try to run demos using qmlsene binary. Here’s a video where I run four different particle demos on not-so-new 13″ MacBook Pro without any big problems.

This blog post was short this time. If you are interested in what happens in the Qt development, the Qt5 is really worth to check. Naturally there are also other things happening in the background like modularization in addition to QML development. Personally, I think the best way to follow Qt development is to read Qt Labs Blog. But in the end I can’t say anything else that good work Trolls. Can’t wait that they will get Qt5 released in 2012.

Thanks for reading my blog!