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. Q_PROPERTY Creator integration and possible accessor naming convention standardization?
Forum Updated to NodeBB v4.3 + New Features

Q_PROPERTY Creator integration and possible accessor naming convention standardization?

Scheduled Pinned Locked Moved General and Desktop
17 Posts 4 Posters 6.9k 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.
  • A Offline
    A Offline
    andre
    wrote on last edited by
    #8

    Did you know that if you just type
    @
    Q_PROPERTY (int test READ test WRITE setTest NOTIFY testChanged)
    @
    and then press ALT-Enter on that in Creator, you already get the option to auto-generate the getter, the setter and have the notify properly connected?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kitizz
      wrote on last edited by
      #9

      gasp That's almost perfect =D
      Thank you Andre!

      Though I think I might see if it can be extended so that it places the implementation in the .cpp

      1 Reply Last reply
      0
      • U Offline
        U Offline
        utcenter
        wrote on last edited by
        #10

        [quote author="Andre" date="1360671493"]Did you know that [/quote]

        Obviously not :)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #11

          [quote author="utcenter" date="1360671251"]That is almost 3 years old and still not solved :)[/quote]

          I'd say it is is solved actually. Just not marked as such... I added a comment on that to the report.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #12

            [quote author="utcenter" date="1360671815"][quote author="Andre" date="1360671493"]Did you know that [/quote]

            Obviously not :)

            [/quote]

            Note that your generator does quite a bit more than the simple implementation in QtCreator, but it is not as nicely integrated of course. I do think that extending the implementation in QtCreator probably makes more sense than continue building your own. I'd like to see the one in creator get the feature to generate the code in the .cpp file instead, and you might be missing your chaining feature. Also, of course, the actual Q_PROPERTY declaration is not generated for you. It might be nice to find a good spot for that as well. Perhaps under a right-click or an ALT-Enter on the Q_OBJECT macro would be a nice place to add a Create New Q_PROPERTY command, that would show a little dialog with the different options...

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kitizz
              wrote on last edited by
              #13

              Good thoughts, I like it =)
              I might put it on my Rainy Days list.

              1 Reply Last reply
              0
              • U Offline
                U Offline
                utcenter
                wrote on last edited by
                #14

                Actually, I am considering creating a node based visual tool for programming that generates C++ source. Not just stubs but to replace typing altogether, with the exception of identifiers and stuff like that. Including visual class hierarchy editors, custom components that are like boilerplate snippets with UI and so on.

                I did some testing, it actually takes less space and memory than text source editors. Plus it is impossible to make typos, and developing should be somewhat faster and less constrained by the actual language syntax. My initial plan was to do something very basic as an educational tool, but it is possible to implement the entire C++ standard. Plus there are some cool possibilities, like pinning "probe" values to parameters and test-running functions without compiling, much like a debugger, but on the actual program nodes.

                When that's done, I guess Qt support can be hacked in fairly easy by people who are familiar with the Qt internals.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tobias.hunger
                  wrote on last edited by
                  #15

                  Andre: https://codereview.qt-project.org/#change,47638 adds a snippet for Q_PROPERTY to 2.7. Not perfect (the setter name is wrong...), but better than nothing (and something that could be done in a minute;-).

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #16

                    @Tobias: how would this work in practice? I am not familiar with the snippets stuff... Would this ask for the $name, and then generate the rest, or does the name come from somewhere else? Anyway, thanks for the quick action!

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tobias.hunger
                      wrote on last edited by
                      #17

                      Andre: Just type Q_PROP and trigger code completion. You can then select the Q_PROPERTY snippet and it will enter it as shown in Tools>Options>Text Editor>Snippets>C++. Using tab you can switch between the different variables and fill them in.

                      Note that Q_PROPERTY is considered an illegal trigger in anything but the 2.7 branch, so in 2.6.2 you will need to select a different trigger text (e.g. PROPERTY).

                      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