problem with userdefined widget with qtcreator ...
-
Hi,
I extended a widget and so I used the qtcreator feature "use widget as placeholder for userdefined widget".
But when I build the app, my widget class will not be found.
Headers can be found by include paths added to qmake, but it looks like moc does not use include pathserror-message is kind of unspecific:
QFormBuilder was unable to create a custom widget ...
What am I missing?
I then tried to delete the widget created by formbuilder and replace it with a widget created by myself - but that was a big desaster :(
-
Hi,
I extended a widget and so I used the qtcreator feature "use widget as placeholder for userdefined widget".
But when I build the app, my widget class will not be found.
Headers can be found by include paths added to qmake, but it looks like moc does not use include pathserror-message is kind of unspecific:
QFormBuilder was unable to create a custom widget ...
What am I missing?
I then tried to delete the widget created by formbuilder and replace it with a widget created by myself - but that was a big desaster :(
-
@eyllanesc said in problem with userdefined widget with qtcreator ...:
please provide a minimal and reproducible example
That's not that easy as I don't know, what plays a role and what not.
Anyway - my workaround is:
Change the placeholder of custom widget to QWidget. Then in class I create my custom widget, add it to the layout and then hide the placeholder widget.
Its far from being elegant, but it works :) -
@eyllanesc said in problem with userdefined widget with qtcreator ...:
please provide a minimal and reproducible example
That's not that easy as I don't know, what plays a role and what not.
Anyway - my workaround is:
Change the placeholder of custom widget to QWidget. Then in class I create my custom widget, add it to the layout and then hide the placeholder widget.
Its far from being elegant, but it works :)@django-Reinhard
Hi
Your custom widget must have the standard constructor so that could be one reason
why Promotion didn't work. -
Hi,
thank you for your attention!
Yes, I already supposed that. My subclass of QTextEdit has of cause the usual standard constructor (with parent parameter set to default nullptr).
I suppose, that it has to do with the directory layout of my project, where all files live in separate subdirectories. But that's just a guess - far from any knowledge.
-
Hi,
thank you for your attention!
Yes, I already supposed that. My subclass of QTextEdit has of cause the usual standard constructor (with parent parameter set to default nullptr).
I suppose, that it has to do with the directory layout of my project, where all files live in separate subdirectories. But that's just a guess - far from any knowledge.
@django-Reinhard
Hi
If the file (the .h file) with the custom widget is not directly with the .PRO file then you
must add the relative path to the place where you give it the .h when you promotelike
subfolder/mywidget.h