Converting Qt compliant C++ to ui XML(QtDesigner) format:

倖福魔咒の 提交于 2019-12-12 04:28:59

问题


I have C++ widget code that was generated by QtDesigner (Qt open source v 4.7.3, using the Form->View Code menu in QtDesigner).

I have modified that code in a manner that is entirely Qt compliant - just hand coded a few more signals, slots and wigdets based on the patterns of the generated code - code runs perfectly when built with Code::Blocks.

Now I'd like to convert my modified C++ source back into the ui XML format that QtDesigner uses. I'm looking for a quick way of doing that (Win7-32 platform).

Any suggestions?

TIA


回答1:


The c++ is a really complex language to parse, so it would be really hard / long / expensive to develop such a tool I guess.

The general rule is to never modify generated code ( in your case the code is generated by Qt designer)

You can

  • Subclass the generated class and put your modifications in the sub class
  • Code all your interfaces by yourself from scratch.
  • If you think Qt designer lack features you can request them or submit patches to Qt. But I don't think Qt intend to extend that, since QML has become the new way to go with interfaces.

The best option for you is probably the first.



来源:https://stackoverflow.com/questions/7060862/converting-qt-compliant-c-to-ui-xmlqtdesigner-format

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