Results 1 to 7 of 7

Thread: Can't I modify qlistview's item? can i modify only qlistwidget's item?

  1. #1
    Join Date
    Jul 2012
    Posts
    23
    Thanks
    3

    Smile Can't I modify qlistview's item? can i modify only qlistwidget's item?

    I want to modify listview's item.

    so I add code this:

    Qt Code:
    1. setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
    To copy to clipboard, switch view to plain text mode 

    but anythings are not changed.
    I double-click listview's item, but i can't edit item..

    I show some example about editing tablewidget's item.

    Can I edit only listWIDGET or tableWIDGET, NOT listVIEW, tableVIEW??

    than why listview has <setEditTriggers>function??
    I can't understand.....

    PLEASE HELP ME!

  2. #2
    Join Date
    Sep 2011
    Posts
    1,245
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't I modify qlistview's item? can i modify only qlistwidget's item?

    have you examined the model -view examples?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Jul 2012
    Posts
    23
    Thanks
    3

    Default Re: Can't I modify qlistview's item? can i modify only qlistwidget's item?

    Thanks for your answer!

    sorry..
    Where is model-view example?
    I examined only itemview example.
    I can't find model-view example.
    Is right you mean example of qt\4.8.2\exmaples?

    I think editable itemview's exmaple is only listwidget not listview..
    Isn't it??

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,552
    Thanks
    13
    Thanked 1,579 Times in 1,508 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Can't I modify qlistview's item? can i modify only qlistwidget's item?

    The model underlying the view class needs to be editable or the view will not be able to edit it regardless of the edit triggers. The model needs to return Qt::ItemIsEditable amongst the flags() for the items the model allows editing for.

  5. #5
    Join Date
    Jul 2012
    Posts
    23
    Thanks
    3

    Default Re: Can't I modify qlistview's item? can i modify only qlistwidget's item?

    I FIND EDITABLE LISTVIEW EXMAPLE!
    but, this example use QStringListModel.
    so I change QStingListModel to QAbstractListModel that i reimplement.
    than this exmaple is broken! changed to no-editable ...
    why????

    thankyou ChrisW67.
    actually I can't fully understand you're answer.
    but roughly understanding, i add code
    Qt Code:
    1. Qt::ItemFlags GalleryModel::flags(const QModelIndex & index)
    2. {
    3. return Qt::ItemIsEditable;
    4. }
    To copy to clipboard, switch view to plain text mode 

    GalleryModel is my QAbstractListModel...

    isn't what you mean?
    but still item's not changed..

    when called flag function of model?
    I can't understand

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can't I modify qlistview's item? can i modify only qlistwidget's item?

    This should spill the light.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #7
    Join Date
    Jul 2012
    Posts
    23
    Thanks
    3

    Default Re: Can't I modify qlistview's item? can i modify only qlistwidget's item?

    oh my god....
    You were right!
    I reimplement flags and setdata function. but It is not activate properly. so I ask a question you continues..
    Because I think i do all action for listview's editable, I am very confused.
    But I find I droped word 'const' in my flags function
    And I got the all I wants.
    THANK YOU! THANK YOU!

    sprit Thanks for your interest.
    Actually, i can't understand 'This should spill the light.'s mean..
    It means you need more information?
    I can't speak english, well. sorry.
    IF we will meet next time, help me please! thank you

Similar Threads

  1. How to Modify QListView item height?
    By blackfox in forum Qt Programming
    Replies: 7
    Last Post: 16th May 2012, 11:38
  2. how to modify menu item height
    By blackfox in forum Qt Programming
    Replies: 2
    Last Post: 9th September 2008, 10:02
  3. Multiple Lines per item in a QListWidget/QListView
    By youkai in forum Qt Programming
    Replies: 1
    Last Post: 27th August 2008, 21:44
  4. Modify a ContextMenu
    By smarinr in forum Qt Programming
    Replies: 5
    Last Post: 10th May 2008, 17:41
  5. I have a problem to modify table
    By Abk in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2007, 20:11

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.