Results 1 to 3 of 3

Thread: Closing all editors in a view?

  1. #1
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Closing all editors in a view?

    Is there a way for a view (i.e., QTableView) to "close all editors" ? I have a derivation but there is no method to call to "close all editors" and no of knowing who the editors are (QAbstractItemView knows in its internal data structures, but this is kept private). I don't want to use the focus out event in the delegate's event filter because it causes other behaviors that I don't want (i.e., I don't want to comit the edit on focus out or hide).

    The hide event doesn't come through to the event filter...

    This is Qt4
    Last edited by smacchia; 10th April 2007 at 13:50. Reason: updated contents

  2. #2
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Closing all editors in a view?

    In MyView::hideEvent (MyView is derived from QTableView), I tried:
    Qt Code:
    1. closePersistentEditor(currentIndex());
    2. QTableView::hideEvent(event); // let base class to do its thing too.
    To copy to clipboard, switch view to plain text mode 
    When I do this, it closes the editors. Then when I "show" the table again, I can't get focus on any of the cells and have to click quite a bit to get another editor. This is very puzzling...

  3. #3
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Closing all editors in a view?

    After more investigation, I found that the delegate event filter IS getting called for hide events, so this is the right place to "emit closeEditor(...)". Thus, problem solved (and sorry for the post when I solved it myself! but I was struggling with this for the last day...)


Similar Threads

  1. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  2. Custom widget in list view
    By fusoin23 in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2006, 14:09
  3. Model - View Programming doubt.
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2006, 13:01
  4. Replies: 6
    Last Post: 20th April 2006, 10:23

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.