Qt GUI does not change after compilation

I created a graphical interface using Qt Designer, compiled and run.
Then I made several changes to the GUI and recompiled again, but the GUI remained the same.
Even if I remove the widgets and recompile them ...

I tried Clean All and Clean Project , but did not succeed ...
What could be the problem?

+8
qt qt-creator qt-designer
source share
4 answers

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

 uic mainwindow.ui>ui_mainwindow.h 
+6
source share

I think this is a summary of what should happen.

1. start with an empty project. 2. Use the QT constructor to create the mainwindow.ui file. 3. The qt creator should create the ui_mainwindow.h header file for you, containing the necessary definitions for your user interface, as well as the member function functionUi (). The creator of QT creates this ui_mainwindow.h file by calling uic (the user interface compiler) . 4. Now that you have this file, add this code to your project and I think that it will display your Qt GUI correctly. you can 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 Ui :: MainWindow class contains the setupUi () member function , which sets up a graphical interface for you.
Make sure you have the exact class name, because C ++ is case sensitive. Good luck.

+3
source share

I know this is an old thread, but I think it is still active. One of the reasons for this buggy behavior is the Shadow build checkmark. Click the "Project" icon in the Qt creator, in the "Assembly-> General" section, uncheck the "Shadow assembly" box. Rebuild again.

+3
source share

You must clear the source directory. Perhaps you have two ui_mainwindow.h files in different directories. One file from your build on the command line, another from your build from Qt Creator. This happened to me, and after cleaning everything works well.

+1
source share

Source: https://habr.com/ru/post/650765/


All Articles