where is the generated code of “Qt Signals/Slots editor”?

坚强是说给别人听的谎言 提交于 2020-01-05 05:53:47

问题


QtCreator 2.7.2 ,I use the Qt Creator design a connection and i can see it in the file *.ui ,but I can't find it in the generated file ui_*.h after build, where is it ? I'm curious.


回答1:


It's there, usually by the end of setupUi method. Just look better.

For instance, this chunk in the .ui

 <connections>
  <connection>
   <sender>checkBox</sender>
   <signal>toggled(bool)</signal>
   <receiver>checkBox_2</receiver>
   <slot>setChecked(bool)</slot>
  </connection>
 </connections>

Results in

QObject::connect(checkBox, SIGNAL(toggled(bool)), checkBox_2, SLOT(setChecked(bool)));

in the generated header.




回答2:


The meta-object compiler (moc) generates the glue code for signals and slots. The UI editor just handles the connections and emits the necessary stuff to the ui file. Uic compiles these things into c++ headers which are then used my moc.



来源:https://stackoverflow.com/questions/17717835/where-is-the-generated-code-of-qt-signals-slots-editor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!