Tuesday, February 27, 2007

Qt QAbstractItemModel ModelTest

With labs.trolltech.com 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:


ssaboum said...

Hi, i would like to try and adapt your model tester for PyQt/PySide bindings, what do you think ?

Benjamin Meyer said...

Sure, never mess around with the Python bindings, but having a testing tool is always helpful for development.

ness said...

Is it possible to test if notification signals like rowsabouttobeinserted are emitted ?

Benjamin Meyer said...

@ness, yes checkout the QTest documentation on how to test signals.

Jess said...

I also needed a ModelTest equivalent in python but couldn't find any, so I wrote this one.


(and it indeed found bugs in my QAbstractItemModel-derived python class)

Popular Posts