Results 1 to 1 of 1

Thread: QTreeView edit() not working.

  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Qt products
    Qt4

    Unhappy QTreeView edit() not working.

    I have made a customised directory model and plugged it into a QTreeView. The standard edit works fine when triggered by the user (pressing F2 or clicking on an already selected directory). But I can't get seem to trigger it programmatically. I have added a "New Folder" button, and when this is pressed a folder called "New Folder" is added under the currently selected folder. I want to immediately open an edit box for this new folder, but just cannot get Qt to do it. At the moment I am doing the following:
    creating the new directory on disk,
    then recreating the model object from scratch and assigning it to the view,
    then expanding out the hierarchy to the new folder,
    focusing the QTreeView,
    selecting the new folder,
    calling QTreeView->edit(currentIndex());

    Any ideas what is going on? The new folder gets selected correctly, but doesn't losing focus when edit is called, like focus is moving to the new edit widget. But the widget never appears.

    edit/
    Okay I found the problem, and it was due to the fact that I was using a thread to check for changes to the directory structure and this was causing the model to be recreated immediately.
    Last edited by billw; 20th August 2010 at 18:44.

Similar Threads

  1. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 20:06
  2. Multiple clicks required to get into edit mode on QTreeView
    By JonInAnnArbor in forum Qt Programming
    Replies: 10
    Last Post: 26th November 2012, 19:59
  3. QTreeView - how to force an end to a user edit
    By onamatic in forum Qt Programming
    Replies: 2
    Last Post: 17th November 2008, 22:21
  4. Edit items on QTreeView + QDirModel
    By junior0007 in forum Qt Programming
    Replies: 4
    Last Post: 23rd November 2007, 08:16
  5. Replies: 1
    Last Post: 28th February 2007, 09:34

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.