Results 1 to 3 of 3

Thread: model/view editing question

  1. #1
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default model/view editing question

    I have a model/view framework I'm fiddling with, where I want to enable editing... but only when I right-click on an item and click on "rename" in a menu... whereas a double-click will actually activate the item rather than edit it.

    At the moment, I have editing enabled via the flags() function (Qt::ItemIsEditable), and whenever I activate (double-click) my item it also enters an edit mode. Functionally, this works... it's just a bit clunky.

    If I simply disabled editing from the flags() function, could I use the built-in functionality via my "rename" menu option rather than building custom edit functions?
    Life without passion is death in disguise

  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: model/view editing question

    You have to change the edit triggers in the view. The model is fine. You want to change the method of editing the data, not the possibility to edit data, so the right place to look is the view.

  3. #3
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: model/view editing question

    Yeah, I was looking in the wrong spot... got it. What I needed in this case was a view->setEditTriggers(QAbstractItemView::SelectedClicke d);. Thanks.
    Life without passion is death in disguise

Similar Threads

  1. A question about Model/View programming
    By awhite1159 in forum Qt Programming
    Replies: 5
    Last Post: 15th June 2008, 15:38
  2. General Question about Qt4 Model/View
    By reed in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2008, 15:06
  3. quick question on model/view programming
    By locus in forum Qt Programming
    Replies: 1
    Last Post: 2nd February 2007, 10:04
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46

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.