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. Auto Generating Model code
QtWS25 Last Chance

Auto Generating Model code

Scheduled Pinned Locked Moved Solved General and Desktop
modeldata
7 Posts 3 Posters 2.0k Views
  • 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.
  • C Offline
    C Offline
    clogwog
    wrote on 7 Nov 2017, 23:58 last edited by
    #1

    Hi,

    I have just gone through a simple ToDo list tutorial (https://www.youtube.com/watch?v=9BcAYDlpuT8) that uses QML and stores the model in C++

    There seems to be a lot of 'gotcha's that need to be implemented for each model in C++ (overriding QAbstractListModel). I guess once you do a few it gets easier.

    My Question: Is there an Code generator around that you give an IDL to that can do all this tedious work for you ? (In the same way that DJango does this perhaps ?)

    thanks,
    tom

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 8 Nov 2017, 21:30 last edited by
      #2

      Hi,

      AFAIK, no, there's no such tool.

      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
      • C Offline
        C Offline
        clogwog
        wrote on 10 Nov 2017, 09:07 last edited by
        #3

        thanks..
        if you haven't seen it i bet it doesn't exist

        1 Reply Last reply
        0
        • C Offline
          C Offline
          clogwog
          wrote on 10 Nov 2017, 12:37 last edited by
          #4

          Just found Thomas Boutroue's macro's that look after a lot of the gotcha's

          https://www.youtube.com/watch?v=96XAaH97XYo

          very interesting . i'll try the same todo list with this and report back

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 10 Nov 2017, 12:50 last edited by
            #5

            The fact that I'm not aware of such a tool doesn't mean it doesn't exist. There are lots of stuff going on around Qt ;)

            IIRC, he has several libraries and helpers that might be of interest, thanks for the reminder !

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

            C 1 Reply Last reply 12 Nov 2017, 04:42
            0
            • S SGaist
              10 Nov 2017, 12:50

              The fact that I'm not aware of such a tool doesn't mean it doesn't exist. There are lots of stuff going on around Qt ;)

              IIRC, he has several libraries and helpers that might be of interest, thanks for the reminder !

              C Offline
              C Offline
              clogwog
              wrote on 12 Nov 2017, 04:42 last edited by
              #6

              Oh wow. I just re-implemented the todo list example with heaps less code.
              i think i'll keep using this.

              now see if i can also use QuickFlux in the same application....
              (third try but i usually get lost towards the end of the tutorial )

              1 Reply Last reply
              0
              • V Offline
                V Offline
                VRonin
                wrote on 13 Nov 2017, 10:36 last edited by
                #7

                What I usually feel like suggesting is not to subclass the model at all. use QStandardItemModel only via the QAbstractItemModel interface (you can force yourself by declaring QAbstractItemModel* model =new QStandardItemModel(parent);).

                If the model's performance is really a drag for your application you can go the length and implement a model subclass (with all its gotchas) changing just 1 line in your existing code

                "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
                1

                4/7

                10 Nov 2017, 12:37

                • Login

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