Qt Creator - 如何编写用户界面? [英] Qt Creator - How to write the UI?

查看:54
本文介绍了Qt Creator - 如何编写用户界面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 Qt Creator,我想编写 UI.

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?

我拖拽了一些小部件,但我看到并非所有的 QWidget 内置,如 QIconQMultiLineEdit 都在小部件框中.如何添加?

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?

谢谢!

推荐答案

在我看来,如果你刚开始使用 Qt,如果你有时间制作一个大家都编写的简单 UI/程序,这可能是一件好事手动,一点也不使用 Qt Creator.我完全同意 Qt Creator 构建 UI 的速度更快,但是您可以通过至少手动执行一次来了解更多关于 QWidget、QMainWindow、QLayout 等类的机制.如果您遇到问题需要了解更多细节而不是拖放一个小部件,它真的可以帮助您.

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.

当然,如果您对如何在 Qt 中编写 UI 没有任何想法,您可以在 Qt Creator 中创建一个简单的 UI,并查看它是如何编码的,并尝试自己重现类似的东西.

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.

希望这会有所帮助.

这篇关于Qt Creator - 如何编写用户界面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆