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. Search information on QTableView
Forum Updated to NodeBB v4.3 + New Features

Search information on QTableView

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 400 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.
  • MihanM Offline
    MihanM Offline
    Mihan
    wrote on last edited by Mihan
    #1

    Hi all

    I want to make a function about searching on QTableView with QSqlQueryModel.

    I think it is too cumbersome that if I use QSqlQuery to research the information from database.
    And I have used QCompleter and connect the model so that I can input the key words Conveniently.

    what should I do next?

    Best regards
    Mihan

    1 Reply Last reply
    0
    • MihanM Offline
      MihanM Offline
      Mihan
      wrote on last edited by
      #2

      BTW, if I insert data by the other QSqlQuery, does the QSqlQueryModel know that and refresh the data automatically?

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Mihan said in Search information on QTableView:

        BTW, if I insert data by the other QSqlQuery, does the QSqlQueryModel know that and refresh the data automatically?

        No

        I want to make a function about searching on QTableView

        You can e.g. iterate over the model's data and search for the things you want.

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

        MihanM 1 Reply Last reply
        0
        • MihanM Offline
          MihanM Offline
          Mihan
          wrote on last edited by
          #4

          @Christian-Ehrlicher said in Search information on QTableView:

          You can e.g. iterate over the model's data and search for the things you want.

          I find QSortFilterProxyModel, maybe it can do what I want(searching).

          OTOH, how to refresh the data from QSqlquerymodel when the database was inserted new data?

          Christian EhrlicherC 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @Mihan said in Search information on QTableView:

            BTW, if I insert data by the other QSqlQuery, does the QSqlQueryModel know that and refresh the data automatically?

            No

            I want to make a function about searching on QTableView

            You can e.g. iterate over the model's data and search for the things you want.

            MihanM Offline
            MihanM Offline
            Mihan
            wrote on last edited by
            #5

            @Christian-Ehrlicher said in Search information on QTableView:

            No

            What about using the same QSqlQuery? QSqlQueryModel set the same QSqlQuery and I use the same QSqlQuery to insert data.

            1 Reply Last reply
            0
            • MihanM Mihan

              @Christian-Ehrlicher said in Search information on QTableView:

              You can e.g. iterate over the model's data and search for the things you want.

              I find QSortFilterProxyModel, maybe it can do what I want(searching).

              OTOH, how to refresh the data from QSqlquerymodel when the database was inserted new data?

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

              @Mihan said in Search information on QTableView:

              maybe it can do what I want(searching).

              This proxy is for filtering and sorting. Don't see why you need this for searching - the search functionality is the same as in it's base class QAbstractItemModel.

              how to refresh the data from QSqlquerymodel when the database was inserted new data?

              By using QSqlTableModel and doing the modifications through the model

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

              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