Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. cpp file doesn't see the changes of the ui file
Forum Updated to NodeBB v4.3 + New Features

cpp file doesn't see the changes of the ui file

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 682 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gisac59
    wrote on last edited by
    #1

    Qt 6.8.1 - Mingw 13.1.0 - Windows 11 .
    Hello everyone. I had a dialog (generalita) with a buttonbox, connected to the accepted and rejected signals, that worked, but not as I intended. Then in the dialog I deleted the buttonbox and inserted two pushbuttons (pushButton_ok and pushButton_cancel). Now (after using run qmake, rebuild), I still don't see the pushbuttons:
    I:\xxx\Gestione_turni\generalita.cpp:9: error: 'class Ui::Generalita' has no member named 'pushButton_ok'
    ....\generalita.cpp:9:18: error: 'class Ui::Generalita' has no member named 'pushButton_ok'
    In UI_generalita.h the change is there:
    pushButton_ok = new QPushButton(Generalita);
    pushButton_ok->setObjectName("pushButton_ok");
    pushButton_cancel = new QPushButton(General);
    pushButton_cancel->setObjectName("pushButton_cancel");
    but in generalita.cpp it is not received.
    What can I do, please?

    jsulmJ 1 Reply Last reply
    0
    • JonBJ JonB

      @gisac59
      First thing to make sure is that UI_generalita.h is (a) being regenerated and (b) exists only in the build output directory and not in the source directory. So where is it? Delete it and ensure uic is being run and generates it in right directory.

      G Offline
      G Offline
      gisac59
      wrote on last edited by
      #5

      @JonB Bingo! A copy of all ui_* files were in the source directory. Deleted these files, all ok.
      Thanks!!!

      JonBJ 1 Reply Last reply
      0
      • G gisac59

        Qt 6.8.1 - Mingw 13.1.0 - Windows 11 .
        Hello everyone. I had a dialog (generalita) with a buttonbox, connected to the accepted and rejected signals, that worked, but not as I intended. Then in the dialog I deleted the buttonbox and inserted two pushbuttons (pushButton_ok and pushButton_cancel). Now (after using run qmake, rebuild), I still don't see the pushbuttons:
        I:\xxx\Gestione_turni\generalita.cpp:9: error: 'class Ui::Generalita' has no member named 'pushButton_ok'
        ....\generalita.cpp:9:18: error: 'class Ui::Generalita' has no member named 'pushButton_ok'
        In UI_generalita.h the change is there:
        pushButton_ok = new QPushButton(Generalita);
        pushButton_ok->setObjectName("pushButton_ok");
        pushButton_cancel = new QPushButton(General);
        pushButton_cancel->setObjectName("pushButton_cancel");
        but in generalita.cpp it is not received.
        What can I do, please?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @gisac59 Do a complete rebuild:

        • Delete build folder
        • Run qmake
        • Build

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        G 1 Reply Last reply
        0
        • jsulmJ jsulm

          @gisac59 Do a complete rebuild:

          • Delete build folder
          • Run qmake
          • Build
          G Offline
          G Offline
          gisac59
          wrote on last edited by
          #3

          @jsulm
          Done. Here's result:
          I:\programmi per Qt\Gestione_turni\generalita.cpp:9: error: 'class Ui::Generalita' has no member named 'pushButton_ok'
          ....\generalita.cpp: In constructor 'Generalita::Generalita(QWidget*, int, QString)':
          ....\generalita.cpp:9:18: error: 'class Ui::Generalita' has no member named 'pushButton_ok'

          JonBJ 1 Reply Last reply
          0
          • G gisac59

            @jsulm
            Done. Here's result:
            I:\programmi per Qt\Gestione_turni\generalita.cpp:9: error: 'class Ui::Generalita' has no member named 'pushButton_ok'
            ....\generalita.cpp: In constructor 'Generalita::Generalita(QWidget*, int, QString)':
            ....\generalita.cpp:9:18: error: 'class Ui::Generalita' has no member named 'pushButton_ok'

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #4

            @gisac59
            First thing to make sure is that UI_generalita.h is (a) being regenerated and (b) exists only in the build output directory and not in the source directory. So where is it? Delete it and ensure uic is being run and generates it in right directory.

            G 1 Reply Last reply
            1
            • JonBJ JonB

              @gisac59
              First thing to make sure is that UI_generalita.h is (a) being regenerated and (b) exists only in the build output directory and not in the source directory. So where is it? Delete it and ensure uic is being run and generates it in right directory.

              G Offline
              G Offline
              gisac59
              wrote on last edited by
              #5

              @JonB Bingo! A copy of all ui_* files were in the source directory. Deleted these files, all ok.
              Thanks!!!

              JonBJ 1 Reply Last reply
              0
              • G gisac59 has marked this topic as solved on
              • G gisac59 has marked this topic as solved on
              • G gisac59

                @JonB Bingo! A copy of all ui_* files were in the source directory. Deleted these files, all ok.
                Thanks!!!

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #6

                @gisac59 Yeah, this has bitten people on the bottom before! (however they get into that situation)

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved