问题
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?
回答1:
You can recompile your UI with the following command. It worked for me.
uic mainwindow.ui>ui_mainwindow.h
回答2:
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.
回答3:
I think this is a summary of what should happen.
#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.
回答4:
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.
来源:https://stackoverflow.com/questions/4616932/qt-gui-doesnt-change-after-compilation