Is there a way to visually edit a cpp file with Design
-
The interface of the application i work whit is entierly made of cpp , across some class, and adding a single box is absolytely tidious.
Is it possible to edit it like whit some sort of interface whit Design on .ui files, or am i condamned to do everything by hands ?
-
The interface of the application i work whit is entierly made of cpp , across some class, and adding a single box is absolytely tidious.
Is it possible to edit it like whit some sort of interface whit Design on .ui files, or am i condamned to do everything by hands ?
@AntGP said in Is there a way to visually edit a cpp file whit Design:
Is it possible to edit it like whit some sort of interface whit Design on .ui files,
No, the designer can only handle ui files since it does not know anything about c++
-
-
@AntGP
Still not sure what exactly your issue is. For, say, adding "a single box" or some other UI element to an existing project you have a choice of using Designer to produce code or writing the code directly yourself to create UI elements. As for interfacing with C++, if you use Designer from Creator you have that integration. -
No it was not interfacing whit C++, but making it on C++.
On my project everything is made of C++. So i wanted to know if there was a way to have a visual editor for it, or some way to make some part on a visual editor that i would then be able to add in. I also wanted to see if there was a visual editor to not have to compile the code everytime i change something to see if it fit on the interface while messing around whit the differents functions.I'v looked lot of doc and exemple on how to import a .ui file in cpp, but i just wanted to know if it was possible to convert a ui file to cpp that i would have missed.
-
I'v seen the IUC compiler, but it only make header as far as i understand https://doc.qt.io/archives/qt-5.15/uic.html
-
No it was not interfacing whit C++, but making it on C++.
On my project everything is made of C++. So i wanted to know if there was a way to have a visual editor for it, or some way to make some part on a visual editor that i would then be able to add in. I also wanted to see if there was a visual editor to not have to compile the code everytime i change something to see if it fit on the interface while messing around whit the differents functions.I'v looked lot of doc and exemple on how to import a .ui file in cpp, but i just wanted to know if it was possible to convert a ui file to cpp that i would have missed.
@AntGP
Still don't understand what you are actually saying.You have a "visual editor" for
.ui
files: it's Designer, and if you run that from within Creator you also have (some) integration with C++ code. If you change the design/.ui
file you have to recompile if you want to build and run the new code. However, if you just want to see what it looks like with your changes but without recompiling there is a key press inside Designer to preview what it will look like: https://doc.qt.io/qtcreator/creator-keyboard-shortcuts.html#qt-widgets-designer-shortcutsPreview Alt+Shift+R [Windows, Linux] Opt+Shift+R [MacOS] [Or it must be on a menu somewhere]
There are two things you can do with a
.ui
file:-
Read it in at run time without doing anything at design/compiler time. But you probably don't want to do this as it involves you doing quite a bit of coding to make it "useful".
-
Allow Creator's build system to run
uic
on it, which produces a.h
file and a class for code to use.
I'v looked lot of doc and exemple on how to import a .ui file in cpp, but i just wanted to know if it was possible to convert a ui file to cpp that i would have missed.
I'v seen the IUC compiler, but it only make header as far as i understand https://doc.qt.io/archives/qt-5.15/uic.html
That's what
uic
already does. It just happens to be a.h
rather than a.cpp
file --- so what, what's the problem? Your desire for a.cpp
over.h
simply makes no sense, it doesn't matter which one it produces. -
-
I'v seen the IUC compiler, but it only make header as far as i understand https://doc.qt.io/archives/qt-5.15/uic.html
-
@SGaist said in Is there a way to visually edit a cpp file with Design:
To add to @JonB, the header generated by uic is not to be edited. Check the designer examples. You have a pair of header/implementation files that will use that generated header and that's where you'll be adding the business logic
Yes i know, and i did not wanted to edit the .h generated from the .ui after i saw it was just a .h for interfacing
@JonB said in Is there a way to visually edit a cpp file with Design:
Still don't understand what you are actually saying.
It's just that i'm working on a project that is 13 year old, and all the interface is made whit C++, no ui file at all, only pure cpp and some java scripts.
Adding some elements in midle of the existing code of the interface is not possible whit .ui filesI wanted to know if there was a way to have any kind of interface editor for all the layout and widgets made in C++.
And after reasearch and the first answer that confirmed that we can't do anithing whit cpp files on designer, i understood that i can't have any interface editor for what i have.