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. Increasing usage for C++ new operators based on data model indexes?

Increasing usage for C++ new operators based on data model indexes?

Scheduled Pinned Locked Moved Unsolved General and Desktop
data modelscreateindexallocationnew operatorssoftware design
116 Posts 6 Posters 51.4k 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.
  • K kshegunov
    24 Oct 2018, 23:57

    @elfring said in Increasing usage for C++ new operators based on data model indexes?:

    Why do you think in this direction?

    Experience.

    E Offline
    E Offline
    elfring
    wrote on 25 Oct 2018, 05:27 last edited by
    #55

    Does your software development experience include the usage of placement new?

    V K 2 Replies Last reply 25 Oct 2018, 07:57
    0
    • E elfring
      25 Oct 2018, 05:27

      Does your software development experience include the usage of placement new?

      V Offline
      V Offline
      VRonin
      wrote on 25 Oct 2018, 07:57 last edited by
      #56

      Does your software development experience include the usage of QAbstractItemModel?

      I wouldn't question @kshegunov 's abilities as he's firmly in the top tier of developers contributing on this forum.

      "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

      E 1 Reply Last reply 25 Oct 2018, 08:45
      1
      • V VRonin
        25 Oct 2018, 07:57

        Does your software development experience include the usage of QAbstractItemModel?

        I wouldn't question @kshegunov 's abilities as he's firmly in the top tier of developers contributing on this forum.

        E Offline
        E Offline
        elfring
        wrote on 25 Oct 2018, 08:45 last edited by
        #57

        Does your software development experience include the usage of QAbstractItemModel?

        My knowledge is growing also in this software area.

        … he's firmly in the top tier of developers contributing on this forum.

        This is fine.

        Our experiences are varying in several areas, don't they?

        Understanding difficulties can happen then when someone (like me) dares to present special development ideas.

        V 1 Reply Last reply 25 Oct 2018, 08:59
        0
        • E elfring
          25 Oct 2018, 08:45

          Does your software development experience include the usage of QAbstractItemModel?

          My knowledge is growing also in this software area.

          … he's firmly in the top tier of developers contributing on this forum.

          This is fine.

          Our experiences are varying in several areas, don't they?

          Understanding difficulties can happen then when someone (like me) dares to present special development ideas.

          V Offline
          V Offline
          VRonin
          wrote on 25 Oct 2018, 08:59 last edited by
          #58

          @elfring said in Increasing usage for C++ new operators based on data model indexes?:

          Understanding difficulties can happen then when someone (like me) dares to present special development ideas.

          Sorry if it came out wrongly before, we are not against new development ideas at all, not on this forum and not in the Qt Project.

          I think what is clear from the discussion above is that nobody here can think of an elegant, efficient, functional and safe way to introduce the concept you suggest in the QAbstractItemModel (or any of its subclasses) interface.
          Having said that, you are correct by saying

          Our experiences are varying in several areas, don't they?

          So our point is, if you have an idea for an implementation then please go ahead and propose it to the community. I'd be very happy to participate in the review process of such an innovation as well as I might end up learning something new (punt not intended)

          "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

          E 1 Reply Last reply 25 Oct 2018, 09:06
          2
          • V VRonin
            25 Oct 2018, 08:59

            @elfring said in Increasing usage for C++ new operators based on data model indexes?:

            Understanding difficulties can happen then when someone (like me) dares to present special development ideas.

            Sorry if it came out wrongly before, we are not against new development ideas at all, not on this forum and not in the Qt Project.

            I think what is clear from the discussion above is that nobody here can think of an elegant, efficient, functional and safe way to introduce the concept you suggest in the QAbstractItemModel (or any of its subclasses) interface.
            Having said that, you are correct by saying

            Our experiences are varying in several areas, don't they?

            So our point is, if you have an idea for an implementation then please go ahead and propose it to the community. I'd be very happy to participate in the review process of such an innovation as well as I might end up learning something new (punt not intended)

            E Offline
            E Offline
            elfring
            wrote on 25 Oct 2018, 09:06 last edited by
            #59

            …, if you have an idea for an implementation then please go ahead and propose it to the community.

            I guess that progress will depend on this basic clarification:
            Are you familiar with the usage of placement new?

            1 Reply Last reply
            0
            • V Offline
              V Offline
              VRonin
              wrote on 25 Oct 2018, 09:14 last edited by
              #60

              The project maintainers are seasoned (15-20 years experience) developers and are familiar with all aspects of standard C++ (especially its oldest parts like placement new).

              It's safe to assume a total mastery of the placement new concept by people reviewing code, don't worry

              "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

              E 1 Reply Last reply 25 Oct 2018, 09:20
              2
              • V VRonin
                25 Oct 2018, 09:14

                The project maintainers are seasoned (15-20 years experience) developers and are familiar with all aspects of standard C++ (especially its oldest parts like placement new).

                It's safe to assume a total mastery of the placement new concept by people reviewing code, don't worry

                E Offline
                E Offline
                elfring
                wrote on 25 Oct 2018, 09:20 last edited by
                #61

                It's safe to assume a total mastery of the placement new concept by people reviewing code, don't worry

                This information is very promising.

                • Unfortunately, I could not extract corresponding indications of understanding for my proposal so far.
                • How would you like to clarify a possible mapping from data model indexes to pointers further?
                V S 2 Replies Last reply 25 Oct 2018, 09:22
                0
                • E elfring
                  25 Oct 2018, 09:20

                  It's safe to assume a total mastery of the placement new concept by people reviewing code, don't worry

                  This information is very promising.

                  • Unfortunately, I could not extract corresponding indications of understanding for my proposal so far.
                  • How would you like to clarify a possible mapping from data model indexes to pointers further?
                  V Offline
                  V Offline
                  VRonin
                  wrote on 25 Oct 2018, 09:22 last edited by
                  #62

                  @elfring said in Increasing usage for C++ new operators based on data model indexes?:

                  How would you like to clarify a possible mapping from data model indexes to pointers further?

                  That's what we are asking you to propose.
                  We can't think of a way unfortunately

                  "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

                  E 1 Reply Last reply 25 Oct 2018, 09:23
                  0
                  • V VRonin
                    25 Oct 2018, 09:22

                    @elfring said in Increasing usage for C++ new operators based on data model indexes?:

                    How would you like to clarify a possible mapping from data model indexes to pointers further?

                    That's what we are asking you to propose.
                    We can't think of a way unfortunately

                    E Offline
                    E Offline
                    elfring
                    wrote on 25 Oct 2018, 09:23 last edited by
                    #63

                    We can't think of a way unfortunately

                    Why do you stumble on limitations in your imaginations here?

                    J V 2 Replies Last reply 25 Oct 2018, 09:26
                    0
                    • E elfring
                      25 Oct 2018, 09:20

                      It's safe to assume a total mastery of the placement new concept by people reviewing code, don't worry

                      This information is very promising.

                      • Unfortunately, I could not extract corresponding indications of understanding for my proposal so far.
                      • How would you like to clarify a possible mapping from data model indexes to pointers further?
                      S Offline
                      S Offline
                      sierdzio
                      Moderators
                      wrote on 25 Oct 2018, 09:24 last edited by
                      #64

                      @elfring said in Increasing usage for C++ new operators based on data model indexes?:

                      Unfortunately, I could not extract corresponding indications of understanding for my proposal so far.

                      Because you have not proposed anything. Show an API and it will be judged. Show a usage example of that API and it will help us know if the API is convenient. Measure with benchmark and we'll know if it improves performance.

                      Without concrete foundations, any idea can be argued endlessly without result.

                      (Z(:^

                      E 1 Reply Last reply 25 Oct 2018, 09:28
                      2
                      • E elfring
                        25 Oct 2018, 09:23

                        We can't think of a way unfortunately

                        Why do you stumble on limitations in your imaginations here?

                        J Offline
                        J Offline
                        J.Hilk
                        Moderators
                        wrote on 25 Oct 2018, 09:26 last edited by
                        #65

                        @elfring said in Increasing usage for C++ new operators based on data model indexes?:

                        We can't think of a way unfortunately

                        Why do you stumble on limitations in your imaginations here?

                        I guess that will depend on this basic clarification:
                        Are you familiar with the usage of placement new?


                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                        Q: What's that?
                        A: It's blue light.
                        Q: What does it do?
                        A: It turns blue.

                        1 Reply Last reply
                        0
                        • E elfring
                          25 Oct 2018, 09:23

                          We can't think of a way unfortunately

                          Why do you stumble on limitations in your imaginations here?

                          V Offline
                          V Offline
                          VRonin
                          wrote on 25 Oct 2018, 09:28 last edited by VRonin
                          #66

                          @elfring said in Increasing usage for C++ new operators based on data model indexes?:

                          Why do you stumble on limitations in your imaginations here?

                          Honestly I just think I'm not smart enough to get into this. It wouldn't be the first time. On the other hand I'd be really happy to see how it could be implemented so I could learn something new

                          "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
                          0
                          • S sierdzio
                            25 Oct 2018, 09:24

                            @elfring said in Increasing usage for C++ new operators based on data model indexes?:

                            Unfortunately, I could not extract corresponding indications of understanding for my proposal so far.

                            Because you have not proposed anything. Show an API and it will be judged. Show a usage example of that API and it will help us know if the API is convenient. Measure with benchmark and we'll know if it improves performance.

                            Without concrete foundations, any idea can be argued endlessly without result.

                            E Offline
                            E Offline
                            elfring
                            wrote on 25 Oct 2018, 09:28 last edited by
                            #67

                            Show an API and it will be judged.

                            Can this application programming interface be just “placement new” (which got the parameters “row” and “column” passed)?

                            V 1 Reply Last reply 25 Oct 2018, 09:30
                            0
                            • E elfring
                              25 Oct 2018, 09:28

                              Show an API and it will be judged.

                              Can this application programming interface be just “placement new” (which got the parameters “row” and “column” passed)?

                              V Offline
                              V Offline
                              VRonin
                              wrote on 25 Oct 2018, 09:30 last edited by VRonin
                              #68

                              @elfring said in Increasing usage for C++ new operators based on data model indexes?:

                              Can this application programming interface be just “placement new” (which got the parameters “row” and “column” passed)?

                              See, I struggle already, what would the return type be? (void* is a bit useless...)

                              "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

                              E 1 Reply Last reply 25 Oct 2018, 09:33
                              0
                              • V VRonin
                                25 Oct 2018, 09:30

                                @elfring said in Increasing usage for C++ new operators based on data model indexes?:

                                Can this application programming interface be just “placement new” (which got the parameters “row” and “column” passed)?

                                See, I struggle already, what would the return type be? (void* is a bit useless...)

                                E Offline
                                E Offline
                                elfring
                                wrote on 25 Oct 2018, 09:33 last edited by
                                #69

                                See, I struggle already, what would the return type be?

                                C++ new operators are returning non-void-pointer types, don't they?

                                1 Reply Last reply
                                0
                                • V Offline
                                  V Offline
                                  VRonin
                                  wrote on 25 Oct 2018, 09:41 last edited by
                                  #70

                                  I still can't see a way forward.
                                  The simplest example would probably be QStringListModel. Could you help me understand how the placement new operator would work in that case?

                                  "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

                                  E 1 Reply Last reply 25 Oct 2018, 09:44
                                  0
                                  • V VRonin
                                    25 Oct 2018, 09:41

                                    I still can't see a way forward.
                                    The simplest example would probably be QStringListModel. Could you help me understand how the placement new operator would work in that case?

                                    E Offline
                                    E Offline
                                    elfring
                                    wrote on 25 Oct 2018, 09:44 last edited by
                                    #71

                                    Could you help me understand how the placement new operator would work in that case?

                                    Can you understand already that “placement new” provides a pointer to an existing object?

                                    V 1 Reply Last reply 25 Oct 2018, 09:49
                                    0
                                    • E elfring
                                      25 Oct 2018, 09:44

                                      Could you help me understand how the placement new operator would work in that case?

                                      Can you understand already that “placement new” provides a pointer to an existing object?

                                      V Offline
                                      V Offline
                                      VRonin
                                      wrote on 25 Oct 2018, 09:49 last edited by
                                      #72

                                      Yes, I can't see a safe way to use that pointer though

                                      "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

                                      E 1 Reply Last reply 25 Oct 2018, 09:57
                                      0
                                      • V VRonin
                                        25 Oct 2018, 09:49

                                        Yes, I can't see a safe way to use that pointer though

                                        E Offline
                                        E Offline
                                        elfring
                                        wrote on 25 Oct 2018, 09:57 last edited by
                                        #73

                                        Yes,

                                        I find this answer confusing in combination with the subsequent information.

                                        I can't see a safe way to use that pointer though

                                        You are used to the application of ordinary pointers.

                                        auto x(new my_ball);
                                        

                                        How many ball variants would you manage by your QStringListModel example?

                                        1 Reply Last reply
                                        0
                                        • V Offline
                                          V Offline
                                          VRonin
                                          wrote on 25 Oct 2018, 10:15 last edited by
                                          #74

                                          of, let's say you have a new that takes the row as an int parameter (QStringListModel has only 1 column).

                                          I imagine that the implementation would check that the argument is within the range (row>=0 && row < lst.size() ) and then return something like &lst[row] (which is of type QString*).

                                          Now we are back to the point we discussed here. How can we make sure that if the QString is modified then the dataChanged signal is sent?

                                          "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

                                          E 1 Reply Last reply 25 Oct 2018, 12:28
                                          2

                                          64/116

                                          25 Oct 2018, 09:24

                                          • Login

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