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. setupUi is not a member of my QT application
Qt 6.11 is out! See what's new in the release blog

setupUi is not a member of my QT application

Scheduled Pinned Locked Moved Unsolved General and Desktop
41 Posts 3 Posters 6.7k Views 2 Watching
  • 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.
  • SGaistS SGaist

    Hi,

    @lfreeman6490 said in setupUi is not a member of my QT application:

    ui(new Pathloss)

    It should be:

    ui(new Ui::Pathloss)
    

    You are missing the namespace for that class.

    L Offline
    L Offline
    lfreeman6490
    wrote on last edited by
    #13

    @SGaist Doing that tells me that there is no appropriate default constructor. Do I have to change all instances of 'Pathloss' to 'Ui::Pathloss'?

    1 Reply Last reply
    0
    • L lfreeman6490

      Where in my code should I add that? Would that go in my header file?

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #14

      @lfreeman6490 They are defined in ui_pathloss.h. Open it and check if the class name is Ui_Pathloss. It is possible that the class name is Ui_pathloss?

      L 1 Reply Last reply
      1
      • JoeCFDJ JoeCFD

        @lfreeman6490 They are defined in ui_pathloss.h. Open it and check if the class name is Ui_Pathloss. It is possible that the class name is Ui_pathloss?

        L Offline
        L Offline
        lfreeman6490
        wrote on last edited by
        #15

        @JoeCFD the class is named 'Ui_f_pathloss'. This was automated by QT so I didn't change it

        JoeCFDJ 1 Reply Last reply
        0
        • L lfreeman6490

          @JoeCFD the class is named 'Ui_f_pathloss'. This was automated by QT so I didn't change it

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #16

          @lfreeman6490 That is a typical Qt error. You define it in Qt Designer with the matching class name.
          Load your Qt ui file back to Qt Designer and set class name properly.

          L 1 Reply Last reply
          1
          • JoeCFDJ JoeCFD

            @lfreeman6490 That is a typical Qt error. You define it in Qt Designer with the matching class name.
            Load your Qt ui file back to Qt Designer and set class name properly.

            L Offline
            L Offline
            lfreeman6490
            wrote on last edited by
            #17

            @JoeCFD So I should change that to Ui_Pathloss?

            to look like this?

            namespace Ui {
                class Ui_Pathloss: public Ui_Pathloss {};
                class FileDeleteProgressDialog: public Ui_FileDeleteProgressDialog {};
            } // namespace Ui
            
            JoeCFDJ 1 Reply Last reply
            0
            • L lfreeman6490

              @JoeCFD So I should change that to Ui_Pathloss?

              to look like this?

              namespace Ui {
                  class Ui_Pathloss: public Ui_Pathloss {};
                  class FileDeleteProgressDialog: public Ui_FileDeleteProgressDialog {};
              } // namespace Ui
              
              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by JoeCFD
              #18

              @lfreeman6490 You do not do this. Load your Qt ui file back to Qt Designer and set class name properly.
              your class name is f_pathloss in the ui file. This is even not a good name.

              L JoeCFDJ 2 Replies Last reply
              1
              • JoeCFDJ JoeCFD

                @lfreeman6490 You do not do this. Load your Qt ui file back to Qt Designer and set class name properly.
                your class name is f_pathloss in the ui file. This is even not a good name.

                L Offline
                L Offline
                lfreeman6490
                wrote on last edited by
                #19

                @JoeCFD I did that and nothing changed, still getting the same error

                JoeCFDJ 1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #20

                  Fix what you have in your pathloss.h file to match what you have in your ui_pathloss.h file.

                  But it sure does look strange that there's such a name mismatch.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  L 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Fix what you have in your pathloss.h file to match what you have in your ui_pathloss.h file.

                    But it sure does look strange that there's such a name mismatch.

                    L Offline
                    L Offline
                    lfreeman6490
                    wrote on last edited by
                    #21

                    @SGaist I changed everything to be Ui_Pathloss. I now am getting a new error

                    "C2664: 'Ui_Ui_Pathloss::setupUi': cannot convert parameter 1 from 'Ui_Pathloss *const' to 'QFrame *'

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #22

                      Did you modify anything else than what I suggested ?
                      What is your actual code ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      L 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Did you modify anything else than what I suggested ?
                        What is your actual code ?

                        L Offline
                        L Offline
                        lfreeman6490
                        wrote on last edited by
                        #23

                        @SGaist main .cpp

                        #include "pathloss.h"
                        #include <QApplication>
                        
                        int main(int argc, char *argv[])
                        {
                            QApplication a(argc, argv);
                            Ui_Pathloss w;
                            w.show();
                            
                            return a.exec();
                        }
                        
                        

                        pathloss.cpp

                        #include "pathloss.h"
                        #include "ui_pathloss.h"
                        
                        Ui_Pathloss::Ui_Pathloss(QWidget *parent):
                            QWidget(parent),
                            ui(new Ui::Ui_Pathloss)
                        {
                            ui->setupUi(this);
                        }
                        
                        Ui_Pathloss::~Ui_Pathloss()
                        {
                            delete ui;
                        }
                        
                        

                        pathloss.h

                        #ifndef PATHLOSS_H
                        #define PATHLOSS_H
                        
                        #include <QWidget>
                        
                        namespace Ui {
                        class Ui_Pathloss;
                        }
                        
                        class Ui_Pathloss : public QWidget
                        {
                            Q_OBJECT
                            
                        public:
                            explicit Ui_Pathloss(QWidget *parent = 0);
                            ~Ui_Pathloss();
                        
                        private:
                            Ui::Ui_Pathloss *ui;
                        };
                        
                        #endif // PATHLOSS_H
                        

                        my ui_Pathloss.h file is too long to post here, but this is the namespace at the bottom

                        namespace Ui {
                            class Ui_Pathloss: public Ui_Pathloss {};
                        } // namespace Ui
                        
                        QT_END_NAMESPACE
                        
                        1 Reply Last reply
                        0
                        • L lfreeman6490

                          @JoeCFD I did that and nothing changed, still getting the same error

                          JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by
                          #24
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • JoeCFDJ JoeCFD

                            @lfreeman6490 You do not do this. Load your Qt ui file back to Qt Designer and set class name properly.
                            your class name is f_pathloss in the ui file. This is even not a good name.

                            JoeCFDJ Offline
                            JoeCFDJ Offline
                            JoeCFD
                            wrote on last edited by
                            #25

                            @JoeCFD Change your class to Pathloss in your ui file, not Ui_Pathloss.

                            L 1 Reply Last reply
                            0
                            • JoeCFDJ JoeCFD

                              @JoeCFD Change your class to Pathloss in your ui file, not Ui_Pathloss.

                              L Offline
                              L Offline
                              lfreeman6490
                              wrote on last edited by
                              #26

                              @JoeCFD
                              throws an error at

                              {
                                  ui->setupUi(this);
                              }
                              

                              "C2664: 'Ui_Ui_Pathloss::setupUi': cannot convert parameter 1 from 'Ui_Pathloss *const' to 'QFrame *'

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #27

                                Beside what wrote @JoeCFD, it seems you are piling up the various suggestions you got.

                                You should go back to your starting state before doing anything else.

                                You should also take the time to read the Qt Designer documentation to understand what you should get.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                1
                                • JoeCFDJ Offline
                                  JoeCFDJ Offline
                                  JoeCFD
                                  wrote on last edited by
                                  #28

                                  Your ui file looks similar like this:
                                  https://doc.qt.io/archives/3.3/designer-manual-16.html
                                  Widgets
                                  <!DOCTYPE UI><UI version="3.1" stdsetdef="1">
                                  <class>WinIntroPage</class>
                                  <widget class="QWidget">
                                  <property name="name">
                                  <cstring>WinIntroPage</cstring>
                                  </property>

                                  see the class tag: change it from f_pathloss to Pathloss
                                  That is the only thing you need to do. Then recompile your code.

                                  L 1 Reply Last reply
                                  0
                                  • JoeCFDJ JoeCFD

                                    Your ui file looks similar like this:
                                    https://doc.qt.io/archives/3.3/designer-manual-16.html
                                    Widgets
                                    <!DOCTYPE UI><UI version="3.1" stdsetdef="1">
                                    <class>WinIntroPage</class>
                                    <widget class="QWidget">
                                    <property name="name">
                                    <cstring>WinIntroPage</cstring>
                                    </property>

                                    see the class tag: change it from f_pathloss to Pathloss
                                    That is the only thing you need to do. Then recompile your code.

                                    L Offline
                                    L Offline
                                    lfreeman6490
                                    wrote on last edited by
                                    #29

                                    @JoeCFD I have no instances of f_pathloss, I changed them all to Pathloss

                                    @SGaist This basically is where I started from. Every change undoes the previous one. The difference between this and the original version is the 'f_pathloss' is now just 'Pathloss'

                                    1 Reply Last reply
                                    0
                                    • JoeCFDJ Offline
                                      JoeCFDJ Offline
                                      JoeCFD
                                      wrote on last edited by JoeCFD
                                      #30

                                      @lfreeman6490 said in setupUi is not a member of my QT application:

                                      ui_Pathloss.h

                                      do not change ui_Pathloss.h because it is generated. Change pathloss.ui or Pathloss.ui file
                                      Your class name has to match to the name defined in
                                      <class>*****</class> in pathloss.ui or Pathloss.ui file

                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #31

                                        Depending on what that interface contains, it could be simpler to just rebuilt it from scratch and be done with it.

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        L 1 Reply Last reply
                                        0
                                        • SGaistS SGaist

                                          Depending on what that interface contains, it could be simpler to just rebuilt it from scratch and be done with it.

                                          L Offline
                                          L Offline
                                          lfreeman6490
                                          wrote on last edited by
                                          #32

                                          @SGaist Yeah I think I might just do that. I've been at this all day. Thanks for trying to help. I appreciate it @JoeCFD

                                          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