Qt Creator - How to write the UI?

耗尽温柔 提交于 2019-12-10 19:06:42

问题


I've just started working with Qt Creator and I want to write the UI.

My question is: what is the best way to write it? By drag and drop from widget box or writing code?

I've dragged some widgets and I saw that not all of build in QWidget like QIcon and QMultiLineEdit are in the widget box. How to add them?

Thanks!


回答1:


In my opinion, if you just started with Qt, it could be a good thing if you have the time to make a simple UI/Program that you all write manually, not using Qt Creator a single bit. I completely agree that Qt Creator is faster to build your UI, but you can learn more about the mechanics of the QWidget, QMainWindow, QLayout, etc. classes by doing it manually at least once. It could really help you if you get a problem to know a bit more details than to drag-and-drop widgets one on the other.

Of course, if you don't have any ideas on how to write a UI in Qt, you could create a simple UI in Qt Creator and look at how it is coded and try to reproduce something similar on your own.

Hope this helps.




回答2:


You should use QT Designer whenever possible because it has loads of useful backend things, like automatic code generation for i18n widgets.

It considerably reduces the time cost of developing GUI's and also makes it easier.

Keep in mind that you can extend and add functionality to any design(widget(s)) you create in the designer and add new widgets that are not present in the Designer Widget list.

If you wish for a more tailored response on a specific issue you've encountered, than create a question tailored on that specific issue and we'll be happy to answer.



来源:https://stackoverflow.com/questions/3985051/qt-creator-how-to-write-the-ui

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