Results 1 to 3 of 3

Thread: QML-Get tableview cell content

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

    Default QML-Get tableview cell content

    Hi.
    I have a TableView with 3 columns (column 1=checkbox, column 2=X and column 3 =Y ).
    I want to get cell content of selected row (checked checkbox in column 3 of row).
    Immediately after checking checkbox draw a circle in specefic position (x,y).

    Model of tableview is QStandardItemModel.

    Code:
    Qt Code:
    1. Canvas {
    2. id: canvas
    3. anchors.fill: parent
    4. onPaint: {
    5. var ctx = canvas.getContext("2d");
    6. ctx.globalCompositeOperation = "source-over";
    7. ctx.lineWidth = 1;
    8. for(var i=1;i<=tablemodel.rowCount;i++){
    9. console.log(tablemodel.model.get(i).XData);
    10. console.log(tablemodel.model.get(i).YData);
    To copy to clipboard, switch view to plain text mode 

    I have this error:
    TypeError: Property 'get' of object QStandardItemModel is not a function

    Please guide me

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

    Default Re: QML-Get tableview cell content

    Have you derived from QStandardItemModel and added a get() function and made it Q_INVOKABLE?

    Cheers,
    _

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

    neda (4th April 2016)

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

    Default Re: QML-Get tableview cell content

    Quote Originally Posted by anda_skoa View Post
    Have you derived from QStandardItemModel and added a get() function and made it Q_INVOKABLE?

    _
    Thank you,
    Excuse me for this simple question.

Similar Threads

  1. Detect when the content of a cell of QTableView is changed
    By qt_developer in forum Qt Programming
    Replies: 5
    Last Post: 21st August 2021, 16:00
  2. Replies: 2
    Last Post: 4th October 2015, 13:20
  3. color specified cell in a tableview
    By poporacer in forum Newbie
    Replies: 1
    Last Post: 29th March 2011, 20:52
  4. Getting Cell Content of QTableWidget
    By Kclark in forum Qt Programming
    Replies: 1
    Last Post: 27th December 2010, 13:30
  5. Edit TableView Content
    By emorgen in forum Newbie
    Replies: 7
    Last Post: 2nd June 2010, 22:00

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.