Do you understand what promoting a widget is?
Can you explain what it is?
Do you understand what promoting a widget is?
Can you explain what it is?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Yes I have read the help. And see :
But ... I dont want to spent time building the plugin.In all other cases, where the source code to the custom widgets is available, we can adapt the custom widget for use with Qt Designer.
And.... I remember (when begin to learn QT) that I could to use 'promote' to use custom widgets....
Can you help me ?
You didn't answer my question:
What does promoting a widget do?
I ask, to be sure you understand what it is.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
As you said a time ago :
But, I cant do this ....Promoting a widget is nothing more than telling designer that it should trust you, and in the UI file, it will create the class you promoted to, and put the include file for your custom file in the ui.
So when the ui compiler makes C++ code out of your ui, in your project where your custom class is known, it will compile and when you run the application, your gui will show your custom widget where the promoted widget is on the from.
Ergo - in designer, at design time, designer knows nothing about your promoted widget, and it will only show the base widget it knows.
If you want to have your custom widget "designable" in designer, you will have to create a designer plugin out of your custom widget.
I have see other posts.... 'Simply write the name of the class and the header ....' This is just what I do .... but QTCreator-Designer says me 'class already exists' ....
Lol.
So you posted my answer - good to know I know what promotion is.
But ok, lets go one step further:
Now if you only explain what 'this' means, we might be able to help you - what it is you are trying to achieve?But, I cant do this ....
Please note:
I ask about the end result you are after, not the way you are trying to do it!
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Promote can let me to use custom widgets without building the plugin ?
This is the main idea I have about it, I'm wrong ?
now you have answered my questions from before.Promote can let me to use custom widgets without building the plugin ?
This is the main idea I have about it, I'm wrong ?
Good.
It depends how you mean what you said, to judge if you are wrong or not.
Promoting allows you to use a custom widget in designer, which IS implemented in your code, but not as a designer plugin.
Now by "use in designer" I mean, you can have a base widget of your custom widgets serve as a place holder in the form for your custom widget.
You then "promote" the base widget to your own custom widget, so that creator will generate the right headers, and class names when it generates the ui.
But you wont see your custom widget in designer just because you promoted a widget!
You can only have instances of widgets that are supplied to designer via the designer plugins system.
That is all!
It will not save you from actually implementing your custom widget!
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Thanks for your patience H.F.
But.... You say :
But I can't write the correct name of my class.... (because QT says me that 'it's already exists...)You then "promote" the base widget to your own custom widget, so that creator will generate the right headers, and class names when it generates the ui.
Ok, then I see the ui_form.h code and see 'mywidget' instance. I change it to 'MyWidget' (I have MyWidget.h and MyWidget.cpp), and I build my project. Ok ! It works. But, if I re-open the .ui form, QT rewrites my ui_form.h again bad...
I dont want to see MyWidget in designer (I know that I have to build the plugin) But I want to test it .
If I have the h and cpp files for MyWidget.... What more must i do ?
Thanks again-
I have hard time understanding what it is you are doing, but you are clearly doing something you shouldn't.
Do you mean you are changing the ui_form.h?Ok, then I see the ui_form.h code and see 'mywidget' instance. I change it to 'MyWidget' (I have MyWidget.h and MyWidget.cpp), and I build my project.
If this is what you are doing you should not do it, since the uic will overwrite it each time it builds the ui file.
If you promote your widget correctly, it will appear correctly in the ui_form.h with out the need to modify it.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Bookmarks