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. Display some data after uploading csv file

Display some data after uploading csv file

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 312 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.
  • D Offline
    D Offline
    dziko147
    wrote on last edited by
    #1

    Hello ,
    Currently , i upload a csv file and i display all the data in a tablewidget .
    i want to display some line of my loaded csv file in another tablewidget .
    How to do this
    thank you

    JonBJ 1 Reply Last reply
    0
    • D dziko147

      Hello ,
      Currently , i upload a csv file and i display all the data in a tablewidget .
      i want to display some line of my loaded csv file in another tablewidget .
      How to do this
      thank you

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @dziko147 said in Display some data after uploading csv file:

      Currently , i upload a csv file and i display all the data in a tablewidget .
      i want to display some line of my loaded csv file in another tablewidget .

      The same way as however you say you currently do it? Copy whatever data you want from one QTableWidget to another.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dziko147
        wrote on last edited by
        #3

        thanks for your reply , but when you use this solution you must reload the file .
        What i want is loading the file for only one time then display some lines on another tablewidget .
        I hopeb that my question is clear :)

        Pl45m4P 1 Reply Last reply
        0
        • D dziko147

          thanks for your reply , but when you use this solution you must reload the file .
          What i want is loading the file for only one time then display some lines on another tablewidget .
          I hopeb that my question is clear :)

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #4

          @dziko147

          Then load it just once and put (= copy) the data in both tableWidgets. There should be no problem at all.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            Use QSortFilterProxyModel to filter out the rows you don't want in the second view and call QTableView::setModel passing the proxy

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            2
            • D Offline
              D Offline
              dziko147
              wrote on last edited by
              #6

              who can give me example or source code please .
              thank you

              1 Reply Last reply
              0
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by VRonin
                #7

                in the header

                private:
                QSortFilterProxyModel *m_filterProxy;
                QTableView* m_secondTable;
                

                in the source

                m_filterProxy = new QSortFilterProxyModel(this);
                m_filterProxy->setSourceModel(tableWidget.model());
                m_filterProxy->setFilterRegularExpression(QStringLiteral("^[Aa].*")); // only show items starting with A
                m_secondTable = new QTableView(this);
                m_secondTable->setModel(m_filterProxy);
                // m_secondTable->show();
                

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                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