Qt/C++ port of a Python program I wrote a year or so ago