'class UI::MainWindow' has no member named 'comboBox'
-
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.
-
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
-
@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 too,
Thanks @aha_1980 -
Click the hammer icon on the bottom left to build the project.