Unsolved How to generate .h and .cpp from .ui???
-
used to be able to generate both .h and .cpp from uic...
HOW do I do this now...
I have a .ui file from qt designer, I need the cpp and .h files.I do NOT want to run qt creator, it crashes.
I want the command line which I need to run, giving it the UI file and ending up with
a cpp, a .h along with the .ui
From a windows command prompt (cmd.exe) -
A Ui file is a XML file.
A UI File can also run as an embedded application inside other IDEs (Eclipse and VIsual Studio).
The UI files are translated to .cpp and .h files by the User Interface Compiler (uic).
This is only what I know, I hope it works for you.
Carlos Hdz.
-
You used to be able to do this:
uic -i PizzaEntry.h -o PizzaEntry.cpp pizza.uiand it would generate the PizzaEntry.cpp file, but the -i option is now missing...
Anyone have any ideas?
Anyone know which uic version had it last? I'll try to find that and stick with the old version if theres
no new way to generate the cpp files -
uic now generates only a header file containing all methods as inline (inside the class) methods. There is no need for a cpp file.
-
@squirrlmcbuttcheeks said in How to generate .h and .cpp from .ui???:
used to be able to generate both .h and .cpp from uic...
HOW do I do this now...
I have a .ui file from qt designer, I need the cpp and .h files.I do NOT want to run qt creator, it crashes.
I want the command line which I need to run, giving it the UI file and ending up with
a cpp, a .h along with the .ui
From a windows command prompt (cmd.exe)One thing I like about Qt is that you can write everything in C++. I don't think I have ever used a UI generated file as intended. I am sure it works and all that but it seems ugly in some aspects (which is not really a good reason) so I have never used it.
There is a downside of creating classes in C++ (source + header). You tend to add in additional functionallity to the generated code which becomes a problem if you want to use the Qt Designer to 'edit' the class. This works fine if you are willing to adjust the GUI without using the Qt Designer but it is a bit harder to do.
My preference is to convert the UI files directly to cpp/h source files and live with the downsides of doing this. If the new version has changed what the generated code looks like you can either use an older version of UIC or write something to convert the XML UI file into the source code you would like to see.
-
uic -o PizzaEntry.h
This will generate the inline header for the UI, no more .cpp file. if you want to move implementation to source file you are free to do it manually afterwards
-
Hello did you find a way to translate into cpp hpp with old uic?
-
@Giakara said in How to generate .h and .cpp from .ui???:
Hello did you find a way to translate into cpp hpp with old uic?
@VRonin said
If you want to move implementation to source file you are free to do it manually afterwards