如何在 qt 中为 GUI 添加可点击按钮
我想让一个按钮绘制图形。我完成了图形的绘制,但是我需要等到单击“绘制按钮”才能绘制图形。
谢谢!
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 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