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. tableview is not update ?

tableview is not update ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 574 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.
  • F Offline
    F Offline
    future
    wrote on last edited by
    #1

    i am not sure what happend.
    my program need sort part of lines in tableview, and i use function : moveSection. but it is not work .....
    i found that index is not change after moveSection .
    my code :

        for(int ii = startIdx; ii <= endIdx; ii++)
        {
            for(int j = startIdx; j <=  (endIdx - 1) ;j++)
            {
                if(model->item(j, m_s)->data(Qt::UserRole + 2).toDouble() > model->item(j + 1, m_s)->data(Qt::UserRole + 2).toDouble())
                {
                    ui->optionsView->verticalHeader()->moveSection(j, j + 1);
                    qApp->processEvents();
                }
    }
    

    how to sort part of lines in tableview ?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      future
      wrote on last edited by
      #2

      actually, this loop only did once move, even if i used qApp->processEvents();

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        If you want to do sorting on your views, you should rather consider QSortFilterProxyModel or implement your own QAbstractProxyModel.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2

        • Login

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