Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. 'class UI::MainWindow' has no member named 'comboBox'
QtWS25 Last Chance

'class UI::MainWindow' has no member named 'comboBox'

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
11 Posts 8 Posters 21.9k 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.
  • S shree_121

    i added combox in mainwindow.ui file still i encountered error as 'class UI::MainWindow' has no member named 'comboBox' . What is the issue?

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #2
    This post is deleted!
    1 Reply Last reply
    0
    • P Offline
      P Offline
      ProfK
      wrote on last edited by
      #3

      Have the same problem. Added comboBox to existing GUI via drag and drop. Here's the automatically generated code:

      <widget class="QComboBox" name="comboBox">
          <property name="geometry">
           <rect>
            <x>890</x>
            <y>170</y>
            <width>73</width>
            <height>22</height>
           </rect>
          </property>
         </widget>
      

      All of the other widgets are accessible. If I type ui-> in mainwindow, comboBox is not offered as autocompletion and I get the same error message as shree.

      1 Reply Last reply
      0
      • aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Does it work if you compile your project again after adding the widget?

        The automatic generated code in XML format must be converted to an ui_xxx.h file for the code completion to jump in. I noticed too, that it sometimes does not work immediately.

        Qt has to stay free or it will die.

        1 Reply Last reply
        4
        • P Offline
          P Offline
          ProfK
          wrote on last edited by
          #5

          Yes, recompiling did the trick. Is this a feature or a bug? ;-)

          aha_1980A T 2 Replies Last reply
          0
          • P ProfK

            Yes, recompiling did the trick. Is this a feature or a bug? ;-)

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Hi @ProfK,

            It's a bug related to the Clang Code Model. This problem does not appear with the Classic Code Model, because (IIRC), there the XML file was pre-compiled in memory to feed the code model. That seems no longer the case with Clang.

            I've created QTCREATORBUG-21045 to track this issue. Feel free to comment and vote there.

            Regards

            Qt has to stay free or it will die.

            1 Reply Last reply
            4
            • S Offline
              S Offline
              shree_121
              wrote on last edited by
              #7

              HI @aha_1980 ,
              i recompiled after adding comboBox still error not disappeared?
              XML code is :
              <widget class="QComboBox" name="comboBox"/>

              A 1 Reply Last reply
              1
              • S shree_121

                HI @aha_1980 ,
                i recompiled after adding comboBox still error not disappeared?
                XML code is :
                <widget class="QComboBox" name="comboBox"/>

                A Offline
                A Offline
                ambershark
                wrote on last edited by
                #8

                @shree_121 Did you rerun qmake too? It may need to moc that UI again. I find Qt needs qmake run quite a bit when changing things that need moc'ing. Specifically interface files. I pretty much assume I need make distclean && qmake && make (or a windows equivalent) to truly rebuild.

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                1 Reply Last reply
                1
                • P ProfK

                  Yes, recompiling did the trick. Is this a feature or a bug? ;-)

                  T Offline
                  T Offline
                  Togar1560
                  wrote on last edited by Togar1560
                  #9

                  @ProfK
                  Compiling worked for me.. thanks.

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    Induwara.super
                    wrote on last edited by
                    #10

                    Compiling worked for me too,
                    Thanks @aha_1980

                    1 Reply Last reply
                    1
                    • CN_CabbageC Offline
                      CN_CabbageC Offline
                      CN_Cabbage
                      wrote on last edited by
                      #11

                      Click the hammer icon on the bottom left to build the project.

                      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