PDA

View Full Version : QTreeView does not get focus on S60



hubbobubbo
1st June 2010, 12:13
Hi

I have a single QTreeView in my S60 application. However I must press the "middle" hardware button first, before I can navigate up and down in the list. When I click the middle button the Options changes to Done and I can navigate, then I have to press Done and Options pop back up. However this is my only widget and I want to be able to scroll up and down without selecting the widget first.

I tried using :
QModelIndex Index = standardModel->index(1,0);
myList->setCurrentIndex(Index);

And this changes the selected index but does not give focus

Then I tried:
myList->setFocus()
but that did not work either?

So what am I doing wrong, this should be pretty straight forward right?

The QTreeView is placed inside a stackedView but there is no layout or anything in the stack, only this listView.

aamer4yu
1st June 2010, 14:44
I guess what you see is the default behaviour on S60. They have something called focus, and additionally editFocus. When widgets like treeview are in edit focus, the events are transferred to that widgets, otherwise the they are handled by the application.

What you can do is install a event filer on you application, then catch the Qt::Key_left / Right events and set the index of the treeView yourself.

Ohh.. by the way you can try setting QWidget::setEditFocus on your treeview . I guess that should be sufficient too. :)