如何在 qt 中为 GUI 添加可点击按钮

发布于 2024-12-12 17:41:43 字数 63 浏览 4 评论 0原文

我想让一个按钮绘制图形。我完成了图形的绘制,但是我需要等到单击“绘制按钮”才能绘制图形。

谢谢!

I want to make a button draw a graphic. I accomplished the drawing of the graphic, but I need it to wait until the "draw button" is clicked to draw the graphic.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伴我老 2024-12-19 17:41:43

如果您使用 QPushButton 那么它会发出一个 clicked () 当用户点击它时发出“信号”。您需要将该“信号”连接到“插槽”。

信号和槽机制是 Qt 工作原理的基础......所以你一定要阅读它:

http://doc.qt.nokia.com/stable/signalsandslots.html

本教程可能会对您有所帮助:

http://www.developer.nokia.com/Community/Wiki/How_to_use_QPushButton_in_Qt

If you are using a QPushButton then it will emit a clicked() "signal" when the user clicks it. You will need to connect that "signal" to a "slot".

The signal and slot mechanism is fundamental to how Qt works...so you should definitely read up on it:

http://doc.qt.nokia.com/stable/signalsandslots.html

This tutorial might help you some:

http://www.developer.nokia.com/Community/Wiki/How_to_use_QPushButton_in_Qt

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文