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

How to have qmake made aware of QT Designer form changes?



  • I am working on a project that has multiple popup dialogs and noticed something curious in that I wanted to change the dialog box tab order and the changes where not detected by qmake/make.

    I ran project clean, qmake, rebuild project and the changes where not detected. I played around with changing a lot little things such as font size, etc., to try to get the changes detected. I also deleted the complete build directory, all moc files, all .o files and still could not get the changes detected.

    The symptom was that, when the dialog was invoked programmatically, it displayed the old dialog was displayed.

    I finally did get it to recognize the changes, but I sure don't know what I did.

    Any thoughts on how the QT Designer/qmake/make interact?

    Thanks.


    In the following code snippets , the culprit is "IconOptionsDialog....":

    ***********Project File: ****************
    SOURCES +=
    MainWindow.cpp
    Maintenance.cpp
    main.cpp

    HEADERS +=
    MainWindow.h
    Maintenance.h

    FORMS +=
    IconOptionsDialog.ui
    MaintenanceAdd.ui
    MaintenanceDelete.ui
    mainwindow.ui

    include(../Common/Common.pri)

    *******************Main Window invocation of Dialog *****************

    void MainWindow::iconRightButton(QMouseEvent *event, IconLabel * child)
    {
    QDialog * widget = new QDialog(this);
    Ui::IconOptionsDialog d_ui;
    d_ui.setupUi(widget);
    widget->setWindowTitle(child->m_fileName);
    ...........


  • Lifetime Qt Champion

    Hi @rjmoses,

    The simple answer is: qmake generates a Makefile. make then checks the timestamps of the xxxx.ui vs. the ui_xxxx.h and if the ui is newer, then uic is called to generate a new header.

    Your scenario can happen if e.g. the files are located on a network share and the timestamps don't match, or if you have build artifacts or Makefiles in your source folder that even if you do shadow building. At least I have seen these two cases.

    Regards


Log in to reply