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]ProxyModel not working
Forum Updated to NodeBB v4.3 + New Features

[solved]ProxyModel not working

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

    I've inherited QSortFilterProxyModel creating class MyProxyModel
    in this class I rewrite data() method to show something different on column 4.
    @
    MyProxyModel *pmod = new MyProxyModel(this);
    pmod->setSourceModel(mod);
    ui->tblOre->setModel(pmod);
    fprintf(stderr,"%d\n",ui->tblOre->model()->data(pmod->index(1,4)).toInt());
    fprintf(stderr,"%d\n",pmod->data(pmod->index(1,4)).toInt());
    @

    I don't know why those printf have different outputs:
    the first uses the real data in the underlying model
    the second shows the data I want

    (ui->tblOre->model()==pmod) returns true

    obviusly the problem is that when I use the view to show data, in the column I need to show particular data, real data is shown.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Well, can you paste your implementation of data()?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • P Offline
        P Offline
        p91paul
        wrote on last edited by
        #3

        solved by myself...
        the problem was that I've omitted the const in the data() function signature, so superclass method was called.
        thanks anyway

        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