Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to call a method of a QModelIndex object from QML?
Forum Update on Tuesday, May 27th 2025

How to call a method of a QModelIndex object from QML?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 229 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drhm
    wrote on 9 Feb 2021, 20:49 last edited by drhm 2 Sept 2021, 20:50
    #1

    In the following example index is an object of the QModelIndex class:

    var s = index.sibling(0, 0)
    

    The execution leads to the following error:

    TypeError: Property 'sibling' of object QModelIndex(0,0,0x286a3e0,FileSystemModel(0x19bc150)) is not a function
    

    The same error type occurs with the following line:

    var s = index.row()
    

    But using row as a property like in the following line works:

    var s = index.row
    

    So, what's going wrong here? How can I call a method of a QModelIndex object in a QML file?

    1 Reply Last reply
    0

    1/1

    9 Feb 2021, 20:49

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved