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. Empty rows in QSortFilterProxyModel
Forum Update on Monday, May 27th 2025

Empty rows in QSortFilterProxyModel

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 906 Views
  • 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.
  • L Offline
    L Offline
    loki7
    wrote on 14 Jul 2014, 09:52 last edited by
    #1

    Hi folks,

    I'm using QSortFilterProxyModel to sort a custom model(inherit from QAbstractItemModel) which maintains a callstack tree. Data will dynamically inserted into this model by a custom interface called insert data(showed below).
    @
    void ProfModel::insertData(DWORD *stack, int depth, Counts counts)
    {
    ProfItem *curr = m_root_item;
    curr->modData(counts);

    ProfItem *tmp;
    for(int i=0; i<depth; i++)
    {
    tmp = curr->getChild(stack[i]);
    if(tmp == NULL)
    {
    beginInsertRows(createIndex(curr->row(), 0, curr),
    curr->childCount(), curr->childCount());
    for(int j=i; j<depth; j++)
    {
    tmp = curr->createChild(stack[j]);
    tmp->modData(counts);
    m_queue->addParse(tmp);
    curr = tmp;
    }
    endInsertRows();
    return;
    }
    else
    {
    tmp->modData(counts);
    curr = tmp;
    }
    }
    }
    @

    Everything goes as expected if I directly display my custom model into a QTreeView. But when I display my model through a QSortFilterProxyModel, randomly there were some empty rows inserted in the treeview. I'm sure that these empty rows are not exist in my custom model.

    I've tried Qt4.7 and Qt4.8, but both of them came out with the same result.

    Can anyone help me with this?

    Thanks in advance.

    Best

    1 Reply Last reply
    0

    1/1

    14 Jul 2014, 09:52

    • 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