Results 1 to 2 of 2

Thread: QTreeView does not get focus on S60

  1. #1
    Join Date
    Dec 2009
    Posts
    62
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default QTreeView does not get focus on S60

    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.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeView does not get focus on S60

    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.

Similar Threads

  1. Window focus issues (How to force focus to a window?)
    By montylee in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2009, 01:00
  2. focus
    By hgedek in forum Newbie
    Replies: 3
    Last Post: 25th December 2007, 19:14
  3. Focus issues / Setting multiple focus
    By ComputerPhreak in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2007, 06:09
  4. Focus Help please
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 15th November 2006, 18:09
  5. Keeping focus at bottom of QListView
    By jakamph in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2006, 14:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.