Results 1 to 3 of 3

Thread: QTreeView editing sometimes single click sometimes double click

  1. #1
    Join Date
    Mar 2011
    Posts
    21
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default QTreeView editing sometimes single click sometimes double click

    Hi,

    I use QTreeView::setEditTriggers(QAbstractItemView::AllE ditTriggers)

    When I click on a item (1) -> editing starts (e.q. line edit)
    When I click on a different item (2) -> editing starts
    So far so good.
    But:
    When I click outside the frame an then again on item (2) -> need double click to start editing
    I can simply start typing after single click but that's not what I want.

    How can it be achieved that a single click on item (2) starts editing?

    Thanks!
    Thomas

  2. #2
    Join Date
    Apr 2012
    Location
    India.
    Posts
    88
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeView editing sometimes single click sometimes double click

    It can be a focus issue, when you click on tree view after clicking out side may be the first click just sets focus on QTreeView and then second click opens editable, you should try setting focus policy for QTreeView.

  3. The following user says thank you to Rajesh.Rathod for this useful post:

    ctgrund (20th May 2014)

  4. #3
    Join Date
    Mar 2011
    Posts
    21
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeView editing sometimes single click sometimes double click

    ALMOST solved. Thanks for the direction! After setting ItemIsSelectable the setting QAbstractItemView::SelectedClicked does most of the things.

    One thing left: clicking on a selected item does start. BUT: clicking on selected but not active item starts editing only after about 0.5 seconds. This is not really good. Changing clicks beetween two items is ok. Editing starts immediately. But click-escape-click takes a while. Any hints??

    Thanks so far!
    Thomas

Similar Threads

  1. Replies: 4
    Last Post: 11th January 2014, 04:06
  2. Telling apart single click and double click in QTableView
    By jgirlich in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2013, 15:27
  3. Replies: 2
    Last Post: 16th July 2012, 13:40
  4. Replies: 7
    Last Post: 26th April 2012, 15:45
  5. Replies: 6
    Last Post: 5th June 2009, 10:38

Tags for this Thread

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.