Wednesday, February 28, 2007


With 4.3 features wrapping there is a new itemview class called QColumnView. It provides a way of displaying a tree model. Each column is another level in the tree with the far left being the top of the tree and the far right side being a node. It is known for quick and easy keyboard navigation and a final preview area. Most commonly this view is known for its usage in OS X and in particularly in Finder. Below is a screenshot of using the view with the dir model and a simple file preview widget.

This widget isn't just for the finder though. I have found the same ui pattern in a lot of places (mostly on OS X). On extreme example was a date scheduling application. The first column let you select the month, the second you selected the day and the third the time. But rather then using lists of strings it showed calendars and clocks. I have seen a lot of applications who only need a few columns such as iTunes with their genre/artist/album columns. There are other applications who have only had two columns, the model was just a list (which was the first column) and when you clicked on an item the second column showed a detailed control of the item.

From the UI Patters and Techniques page on Cascading Lists:

"Use When the user needs to navigate a hierarchy that isn't very deep, but might have many items on each level. An [QTreeView] would work, but the user would be scrolling up and down a lot to see all the items, and they wouldn't get a good overview of the items at higher levels in the hierarchy. ... By spreading the hierarchy out across several scrolled lists, you show more of it at once. It's that simple. Visibility is good when you're dealing with complex information structures. Also, laying the items out in lists organizes them nicely -- a user can more easily keep track of what level they're dealing with than they could with an outline format, since the hierarchy levels are in nice predictable fixed-position lists."

And of course QTimeLine is used to provide smooth animations when scrolling between two columns. I snagged an animated gif, but be warned it came out a lot choppier then in real life.

The most intersting part of QColumnView is the last column. An empty space by default it can be replaced with a large widget that provides controls or previews. With such a large area to use quite a lot of information about the currently selected item can be shown. Unlike a tree where a separate area is needed or with icon where there is a constant battle to keep the items small, but have then be big to convey the information (often being just a small thumbnail). I look forward to seeing how it is used.

Tuesday, February 27, 2007

Qt QAbstractItemModel ModelTest

With going live this week I was able to release a little tool that provides a way to check for common errors in implementations of QAbstractItemModel.

Never really finding anywhere in Qt where this would belong, labs is a perfect way to get this to developers. Although quite small it has been very usefull in finding issues, a lot faster then me sitting down and reading through code. It is especially usefull when writing tree based models because it will check all of the edge cases. On many occasions when KDE developers have asked me questions about problems they are having with their models, after running their code with the model test I was able to resolve the problem within minutes.

You can find the source on its labs page here:

Saturday, February 24, 2007


Included with Qt 4.2 you will find a useful cross platform application you might not know about, called pixel tool. Pixeltool is a desktop magnifier and as you move your mouse around the screen it will show the magnified contents in its window. Hitting the space bar freezes the application so it will stop updating. The application source is located in /tools/pixeltool/, and is built by default so the binary is placed in bin/ like assistant and designer. Below is a screenshot selecting the plus in the tree menu in KMail.

If you right click on the window there are a handful of features you can tweak such as the grid color, grid size and zooming. I am not too sure if any distributions package this tool (Debian's qt4-dev-tools package doesn't), but it would be cool if they did.

Popular Posts