9

I created a GUI using the Qt Designer compiled and run.
Then I made a few changes in the GUI and recompiled again but the GUI remained the same.
Even if I delete the widgets and recompile they appear...

I tried Clean All and Clean Project but no success...
What might be the problem?

Venemo
  • 18,515
  • 13
  • 84
  • 125
kaycee
  • 1,199
  • 4
  • 24
  • 42

4 Answers4

7

You can recompile your UI with the following command. It worked for me.

uic mainwindow.ui>ui_mainwindow.h
Celal Ergün
  • 955
  • 2
  • 14
  • 30
5

I know this is an old thread, but I guess it is still active. One reason for this buggy behavior is the Shadow build checkbox is enabled. Click on the "Project" icon in the Qt creator, under Build-> General, uncheck Shadow build. Rebuild again.

osbuilder
  • 196
  • 2
  • 6
3

I think this is a summary of what should happen.

  • 1. start with an empty project.
  • 2. use QT designer to create a mainwindow.ui file.
  • 3. qt creator is supposed to create for you a header file ui_mainwindow.h containing the necessary definitions for your user interface plus a member function setupUi(). QT creator generates this ui_mainwindow.h file by calling uic(user interface compiler).
  • 4.Now that you have this file, add this code to your project and i think it will display your Qt GUI properly
  • you are free to edit your GUI in Qt designer and recompile to show updated changes(i think) :)
  • #include "ui_mainwindow.h"
    #include <QMainWindow.h>
    #include <QApplication.h>
    
    int main(int argumentCount, char * argumentValues[])
    {
        QApplication app(argumentCount, argumentValues);
        Ui::MainWindow ui;
        QMainWindow * myMainWindow= new QMainWindow();
        ui.setupUi(myMainWindow);
        myMainWindow->show();
        return app.exec();
    }
    

    ps: The class Ui::MainWindow contains a member function setupUi() that setsup for you the GUI.
    Make sure that you have the exact class name because c++ is case sensitive. Good luck.

    Dr Deo
    • 4,650
    • 11
    • 43
    • 73
    • i can see it created a .h file named ui_mainwindow with correct values (new ones). but still when i run it - it uses old design... – kaycee Jan 06 '11 at 19:11
    • try using the mentioned ui_mainwindow.h file as outlined above and see if it works. – Dr Deo Jan 08 '11 at 09:20
    1

    You should clean your source directory. Probably you have two ui_mainwindow.h files in different directories. One file from your build by command line, other one frome your build by Qt Creator. It happened with me, and after cleanup everything works well.

    AGo
    • 284
    • 2
    • 6