Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Generate .ui file from .cpp file



  • Hello !

    I'm new to Qt Creator, here's my problem

    I created a simple project consisting of 2 pages:

    • a Login Page
    • a Contact list

    I created a new .ui file for the ContactList (I only got a .ui file no .cpp associated :( ) and accidently deleted my LoginPage.ui
    I thought all was lost but when I ran the program again, my LoginPage displayed as described in the old .ui

    Q: Is there a way to regenerate the LoginPage.ui ?

    It doesn't seem impossible since the programm "remembers" the way I set it up, but I can't find a way to do it


  • Lifetime Qt Champion

    @kopo said in Generate .ui file from .cpp file:

    Q: Is there a way to regenerate the LoginPage.ui ?

    No, unless you can "undelete" it with some tool.

    It doesn't seem impossible since the programm "remembers" the way I set it up, but I can't find a way to do it.

    No, the LoginPage.ui file (which is a XML file) will be converted to a ui_LoginPage.h file containing the needed program logic. As long as this file is there, you can still compile and run your program.

    Sorry for that :(



  • Well, thank you very much for the quick answer ! :)



  • Are you not using git or some other revision control system for your project? If not, you really should be. Reverting an accidental deletion of a file should be a trivial thing to do if you are using git.


Log in to reply