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

ui_mainwindow.h does not update when adding something to the MainWindow



  • Hello, I'm new to Qt and I wanted to try to build something on my own but i noticed that whenever I add something to mainwindow.ui, the file ui_mainwindow.h does not update so when I try to refer to it (ui->label1) it says "No member named 'label1' in Ui::MainWindow.
    49db0aec-d9f2-4e00-baee-a49647f3cfb3-image.png
    (It is named "splashscreen" because I'm trying to make one for an app)
    ui_splashscreen.h:
    47867ae9-2bbf-4897-a11e-1cd989d94b60-image.png
    How do I fix this?
    As I said at the beginning, I'm new and I don't know much about it.



  • @HenkCoder

    Build / Rebuild and qmake after you modify your *.ui files. Then you can access your new stuff.

    Edit:
    QMake is not even necessary but after a rebuild and qmake, everything should be up to date and your QLabel should be accessible from your code.
    Btw: Don't edit the ui_xxx.h file, changes will get overwritten by moc / uic anyway.



  • @Pl45m4
    Thank you very much man, I was looking for a solution for the past two days.
    Thanks again!


Log in to reply