Results 1 to 2 of 2

Thread: QML TableView get data from selected row

  1. #1
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default QML TableView get data from selected row

    Hi,
    How can I get data from all cell of selected row in tableview.

    Qt Code:
    1. TableView {
    2. id: tablemodel
    3. anchors.fill: parent
    4. model: myXML.newMyModel // == > QStandardItemModel
    5.  
    6. onClicked: {
    7. txt1.text = model.get(row).prop1;
    8. }
    9.  
    10. MyTableViewColumn {
    11. title: "...."
    12. ....
    13. width: 50
    14. }
    15. .....
    16. MyTableViewColumn {
    17. role: "index"
    18. title: " "
    19. width: 30
    20. }
    To copy to clipboard, switch view to plain text mode 

    I have this error:
    Qt Code:
    1. TypeError: Property 'get' of object QStandardItemModel(0xa8a1cd3ac0) is not a function
    To copy to clipboard, switch view to plain text mode 
    Last edited by neda; 5th March 2016 at 12:42.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML TableView get data from selected row

    You could provide a Q_INVOKABLE function in a subclass of QStandardItemModel.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    neda (6th March 2016)

Similar Threads

  1. get all row data from a selected row
    By thefatladysingsopera in forum Qt Programming
    Replies: 2
    Last Post: 3rd May 2011, 13:35
  2. Replies: 12
    Last Post: 8th October 2010, 17:19
  3. Replies: 3
    Last Post: 6th October 2010, 09:33
  4. Managing data in a TableView
    By scarleton in forum Qt Programming
    Replies: 6
    Last Post: 11th June 2010, 01:48
  5. getting data from tableView
    By mkarakaplan in forum Newbie
    Replies: 1
    Last Post: 7th November 2007, 10:51

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.