Q_PROPERTY Creator integration and possible accessor naming convention standardization?
-
Wait, nevermind, found this fellow:
https://bugreports.qt-project.org/browse/QTCREATORBUG-1532 -
That is almost 3 years old and still not solved :)
-
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? -
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
-
[quote author="Andre" date="1360671493"]Did you know that [/quote]
Obviously not :)
-
[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.
-
[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...
-
Good thoughts, I like it =)
I might put it on my Rainy Days list. -
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.
-
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;-).
-
@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!
-
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).