PDA

View Full Version : Qt Creator Create new plugin based on plugin GenericProjectManager (Import existing project)



aphlA
27th October 2020, 08:33
Hi all,

I try to create a new import wizard based on this genericprojectmanager (https://github.com/qt-creator/qt-creator/tree/master/src/plugins/genericprojectmanager) plugin with Qt5 and QtCreator 4.12.

I naively copy pasted all code and inserted my changes.

Add run configuration + factory
Adapt makefile steps
Insert default values for .include and .cflag file


My custom plugin works, but only when there is no genericprojectmanager loaded in qtcreator. I think it has to do with these factorys (https://github.com/qt-creator/qt-creator/blob/master/src/plugins/genericprojectmanager/genericprojectplugin.cpp#L66). That they have global impact.
Welp, I don't need a factory, I just need some confiugration changes of the project. Currently I think by copy-pasting everything it is some overkill.

My question is:
Do I need these factorys? I think it makes more sense just adding a configuration config and initializing them in GenericProjectPluginPrivate.

My approach would be getting the target and then run the constructor of the class RunConfiguration(Target* target) in the constructor of GenericProjectPluginPrivate;

Currently I get the error of redefinition of target in this line of code:



auto genericProject = qobject_cast<GenericProject *>(ProjectTree::currentProject());
Target *target;
GenericExecutableRunConfiguration(target);


As you can see, I'm not so proficient about Qt yet. It would be nice, if you could clarify some steps for me!

Edit:
If you know a simple example, it would help me a lot!! Thanks

Best regards
Fabian