'class UI::MainWindow' has no member named 'comboBox'
i added combox in mainwindow.ui file still i encountered error as 'class UI::MainWindow' has no member named 'comboBox' . What is the issue?
This post is deleted!
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.
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.
Yes, recompiling did the trick. Is this a feature or a bug? ;-)
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.
HI @aha_1980 ,
i recompiled after adding comboBox still error not disappeared?
XML code is :
<widget class="QComboBox" name="comboBox"/>
@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.
Compiling worked for me.. thanks.