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. beginInsertRows & endInsertRows doesn't refresh enough items in view
Forum Updated to NodeBB v4.3 + New Features

beginInsertRows & endInsertRows doesn't refresh enough items in view

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 405 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.
  • jronaldJ Offline
    jronaldJ Offline
    jronald
    wrote on last edited by jronald
    #1

    Env

    Linux
    Qt 6.2.0

    Screenshot

    original as below
    1.png
    insert "111" at pos 1 as below, the problem is that "fff" doesn't show
    2.png
    collapse & expand "bbb", everything becomes ok as below
    3.png

    Code

    beginInsertRows(parent_index, n, n); // n = 1
    ...
    endInsertRows();
    

    Question

    How to fix it?

    Christian EhrlicherC 1 Reply Last reply
    0
    • jronaldJ Offline
      jronaldJ Offline
      jronald
      wrote on last edited by
      #4

      The problem should be in QModelIndex DemoModel::parent(const QModelIndex &index) const

      row in returned QModelIndex should be relative to grand parent.

      Thanks

      1 Reply Last reply
      0
      • jronaldJ jronald

        Env

        Linux
        Qt 6.2.0

        Screenshot

        original as below
        1.png
        insert "111" at pos 1 as below, the problem is that "fff" doesn't show
        2.png
        collapse & expand "bbb", everything becomes ok as below
        3.png

        Code

        beginInsertRows(parent_index, n, n); // n = 1
        ...
        endInsertRows();
        

        Question

        How to fix it?

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @jronald said in beginInsertRows & endInsertRows doesn't refresh enough items in view:

        How to fix it?

        Provide a minimal, compilable example of your problem so we can take a look what you're doing wrong.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        jronaldJ 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          @jronald said in beginInsertRows & endInsertRows doesn't refresh enough items in view:

          How to fix it?

          Provide a minimal, compilable example of your problem so we can take a look what you're doing wrong.

          jronaldJ Offline
          jronaldJ Offline
          jronald
          wrote on last edited by jronald
          #3

          @Christian-Ehrlicher said in beginInsertRows & endInsertRows doesn't refresh enough items in view:

          Provide a minimal, compilable example of your problem so we can take a look what you're doing wrong.

          Modified simpletreemodel in official examples, but it works properly, code at https://ufile.io/4egsoww3
          It might be my bug, I'll check it again

          1 Reply Last reply
          0
          • jronaldJ Offline
            jronaldJ Offline
            jronald
            wrote on last edited by
            #4

            The problem should be in QModelIndex DemoModel::parent(const QModelIndex &index) const

            row in returned QModelIndex should be relative to grand parent.

            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