Having templates for both private and public API (pimpl or not) versions for
subclassing common base Qt classes helps to speed up creation of new code.
Details
- Reviewers
mwolff - Group Reviewers
KDevelop - Commits
- R32:3d0ddda8d659: Add file templ: QObject, QAbstractItemModel, QWidget, QDialog (pimpl & not)
Diff Detail
- Repository
- R32 KDevelop
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Code generation with file templates sadly has regressed a little again with 5.2, so results are not yet perfect::
a) Abstract virtual methods are not generated as overriding, but still abstract (since 5.2)
b) Some template code copied around is assuming properties which got removed from codegen code. Snippets like this currently are dead code, fix yet to be done (so template code kept for consistency in templates)
{% if method.type %} return {{ method.default_return_value }}; {% endif %}
type should be returnType these days, and default_return_value once got removed without replacement, might need to be done via the grantlee filter similar to filter arg_type.
But the templates themselves in the patch here should be fine also once the regressions are fixed.
I'm not using this feature myself, but trust you on that part
We should extend and/or fix our unit tests then :)
Do we really need all these templates? Maybe we can make sure the file creator has a good insight of the class we are extending...
Agreed that would be better, in my list for Santa "Developer" Claus would be making codegen smarter, e.g. for all the Qt specific stuff.
Until someone has coded that though, these templates serve and have served for me as intermediate solution ...