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. Sorting numbers in QSortFilterProxyModel with QSqlTableModel source
Forum Updated to NodeBB v4.3 + New Features

Sorting numbers in QSortFilterProxyModel with QSqlTableModel source

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 1.7k 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.
  • R Offline
    R Offline
    Resurrection
    wrote on last edited by
    #1

    Hi,

    by default QSortFilterProxyModel can sort few different types using QVariant::type to see what is in it to do the correct sort. However when the QSqlTableModel is used then the this always evaluates to QString and thus sorting numbers as strings. I wrote my own subclass of the filter model to force sorting by number but I wonder if there is a way to tell the QSortFilterProxyModel by what type it should sort? I know that the problem is obviously with QSqlTableModel disregarding the types of fields in the database but that is hardly something that could be influenced that easily.

    Secrets are power.

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

      Hi,

      Interesting question, I think you should rather ask it on the interest mailing list. You'll find the Qt's developers/maintainers. This forum is more user oriented

      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
      0
      • R Offline
        R Offline
        Resurrection
        wrote on last edited by
        #3

        Thanks, I have posted to [Interest].

        Secrets are power.

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

          Did you subscribe first ?

          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
          0
          • R Offline
            R Offline
            Resurrection
            wrote on last edited by
            #5

            Yes although I have not received any confirmation.

            Secrets are power.

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

              Then you're likely not subscribe, did you check your spam folder for the confirmation message ?

              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
              0
              • R Offline
                R Offline
                Resurrection
                wrote on last edited by
                #7

                I did but nothing there. I am using gmail and and all qt related e-mails got through fine. I will try alternative e-mail if that would work.

                Secrets are power.

                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