Results 1 to 2 of 2

Thread: closeEditor on QTreeView

  1. #1
    Join Date
    Feb 2013
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default closeEditor on QTreeView

    I'm using a custom QTreeView class in order to extend the original. One of the features I want to include in my program is that if the user asks for a new element inside the tree, it goes automatically in edition mode... that's done. But then, I want to check if the user actually wrote new text on it, because if he left the default "type new element here" and exited the editor field, the item is automatically deleted.

    I've found the function closeEditor and I've overridden it. And yeah, it fires when the editor closes... but the parameter that comes into the function is a QWidget * ... and in order to delete it I believe I need to get the index of the element or something like that...

    I've searched a lot around, but I guess that I've been missing something...

    Any ideas?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: closeEditor on QTreeView

    currentIndex() should be pointing to the edited cell.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QTreeView
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 4th March 2009, 19:51
  2. use QTreeView
    By totosugito in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2008, 09:33
  3. closeEditor() not always closing QLineEdit
    By mclark in forum Qt Programming
    Replies: 8
    Last Post: 27th November 2007, 01:44
  4. Use of QAbstractItemDelegate::closeEditor
    By jml in forum Qt Programming
    Replies: 3
    Last Post: 3rd August 2007, 22:55
  5. closeEditor on a QTreeWidgetItem
    By merlvingian in forum Newbie
    Replies: 1
    Last Post: 10th October 2006, 16:32

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.