Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Testing QAbstractItemModel::data
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Testing QAbstractItemModel::data

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.5k 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.
  • N Offline
    N Offline
    ngrosjean
    wrote on last edited by
    #1

    Hello,

    I'm working on a model / view software, and so have a couple of QxxxModel.
    I manage my unitary tests with the QTest library.

    I want to test my QxxxModel::data() methods on my unitary tests.

    I perhaps miss something, but is there a way to construct QModelIndex with specific row / column for testing purpose?

    Thanks!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Sure. Call the index() function. It takes a row, a column and a parent index. Pass an invalid QModelIndex (a default constructed one) as the parent to retreive a toplevel item.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        ngrosjean
        wrote on last edited by
        #3

        Perfect, I missed this index()... Thanks!

        1 Reply Last reply
        0

        • Login

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