Saturday, March 25, 2006

My First Qt App

Well, not quite my first - I've written Hello World apps before. And I've hacked on plenty of KDE stuff. But this is my first app from scratch, and I'm well on my way. It took a while to decide where to start: KDE3 with Qt3, or Qt4 on its own? KDevelop or Kate? Autotools, Scons, Cmake or Qmake? Well, I plumped for Qt4, Kate and Qmake: Qt4 because it's newer than Qt3 and there's less to learn (and the API looks nicer); Kate because when I'm learning something it's nice to tie things together myself, without having to learn how KDevelop manages it's projects too; Qmake because all the Qt tutorials and things talk about it, and again, it seemed to put the least obstacles in the way of learning Qt.

So I now have a nice main window, a few dialogue boxes, saving and loading Xml files - most of the GUI for my app. All I have to do now is the hard part. The guts of the programme. What is it? You'll just have to wait and see. I don't want to go getting people's hopes up only to dash them to pieces in a few days when I realise I've bitten off more than I can chew.

Oh, just one problem: I have a QTreeView, with a QDirModel attached, and I'm trying to find out when the selection is changed. For the other lists and things I've got it working fine, but I've tried on_listView_selectionChanged, currentChanged, and various other combinations of things from the documentation, but no luck so far. Does anyone have any wonderful ideas how to make that work?


Ben Meyer said...

Check out the selections model which should have the signals you want.

James Ots said...

Aha! I hadn't noticed there was a selection model as well as the item model. It's working now. Thanks.