Important: Please read the Qt Code of Conduct -

[Solved]Qt designer generates two classes with same name from two different ui files.

  • I have weird problem with adding new form to my project, I have two different widgets created in qt designer, one is mainTab, I added it to project time ago, second is history I am trying to add now. The problem is the designer generated .h files from the .ui files but both have same class names, Ui_Form, so I can't use it in main window together. I run qmake but nothing changed. What can I do?

    /root/MD-build-desktop/ui_history.h:25: error: redefinition of ‘class Ui_Form’
    /root/MD-build-desktop/ui_mainTab.h:31: error: previous definition of ‘class Ui_Form’ ()
    /root/MD-build-desktop/ui_history.h:68: error: redefinition of ‘class Ui::Form’ (this makes new class Form as public class of Ui_Form in namespace Ui)
    /root/MD-build-desktop/ui_mainTab.h:327: error: previous definition of ‘class Ui::Form’

  • You can rename one of the files to something other than Form

  • How? One file is history.ui and other maintab.ui, they generate ui_history.h and ui_maintab.h but classes declared in those files are both named Ui_Form, I have no file named Form.

  • Maybe if you open them in Designer you can change "Form" in properties?

  • Ok find out where it is set, I'm just lame^

Log in to reply