Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Update sql data models
Forum Updated to NodeBB v4.3 + New Features

Update sql data models

Scheduled Pinned Locked Moved Solved QML and Qt Quick
16 Posts 2 Posters 4.9k Views 2 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #7

    @Diarby said in Update sql data models:

    setFilter(tr("subregionid = %1").arg(parentId));

    Why are you translating that string ?

    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
    • D Offline
      D Offline
      Diarby
      wrote on last edited by
      #8

      Hello,
      Excuse me for late answering. It's not a translation but a way to pass parentId parameter. Taking into account your remark, I changed to QString("subregionid = %1").arg(parentId), the result is the same : child combo are not updated.

      I am confused but this code is so simple that I wonder what is wrong ?

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

        Did you check the content of the model after applying the filter on the C++ side ?

        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
        • D Offline
          D Offline
          Diarby
          wrote on last edited by
          #10

          Hello,
          I did most checks in C++ and got the data for each parentId supplied as expected. But back to QML, the changes are not applied.
          In theory the QML combo, updates are done when the control is activated : I send the selected ID to child model so it can update his data and applied it to combo.
          Maybe I am wrong, but where ?

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

            Can you share your project ?

            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
            • D Offline
              D Offline
              Diarby
              wrote on last edited by
              #12

              With pleasure. Whole project is compiled in world.7z (12 KiB) [0_1516430081478_world.7z](Uploading 100%)
              I receive message that I don't have privilèges to upload files. May I send you by email ?

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

                Not pre-compiled, just the sources.

                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
                • D Offline
                  D Offline
                  Diarby
                  wrote on last edited by
                  #14

                  Hello ! I am happy to be back as politicians in my country blocked internet from saturday to wednesday. Please find here https://www.dropbox.com/s/6juslcf7dfkxk69/world.7z?dl=0 all sources of my project.
                  Thanks for your help.

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

                    Your where close are wrong. For example, in SubRegionModel, it should be setFilter(QString("subregion.RegionId = %1").arg(parentId));.

                    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
                    • D Offline
                      D Offline
                      Diarby
                      wrote on last edited by
                      #16

                      Hello, I made corrections and it works !
                      My mistake were to not set the table's name as the class is subclassed a QSqlRelationalTableModel.
                      Thanks a lot for your help.

                      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