Proof Of Life
As mentioned in previous blog posts, we are currently playing around with ideas for a new widget architecture. While I was in Brazil, I spent some time working with guys at INdT in Recife. We decided to put together a proof-of-concept demo.
QML application using styled components.
Hey Good Lookin’
The idea behind the project is to take a different approach to UI components and from what we have done in the past.
In Qt today the look-and-feel of a widget is to a large degree implemented in the widget itself, often intertwined with the logic. Styling of widgets is done by forwarding painting calls to QStyle and by requesting hints from the style for certain behavior or property values.
As I wrote in I can haz teh future, plz, we want to separate the UI component data-and-logic from the look-and-feel. This allows us to save the UX designer from having to deal with the messy, complicated and error-prone parts, while at the same time saving the developers from additional pain when said designer changes his or her mind. Win-win. 🙂
In my presentation at the Bossa’10 Conference I referred to the component’s data-and-logic part as “controls”, but after a reconsidering, I now refer to them as “models” (as per the MVC design pattern). The component models are implemented as sub-classes of QObject and export their values through properties.
We implement the look-and-feel part of the UI components using QML since this is what it does best.
As part of the proof-of-concept we have also implemented a styling system. The idea is that it builds the component by populating it with a scene-graph consisting of primitives. This gives the style full freedom to decide how the widgets will look and behave.