Qt Designer - 编辑|编辑信号/槽
在Qt Designer
中,当进入编辑信号/槽
模式时,我有两个按钮OK
和Cancel
。
如何为按钮设置以下内容:
确定
SIGNAL(clicked())
SLOT(accept())
取消
SIGNAL(clicked())
SLOT(reject())
谢谢。
In Qt Designer
, and when entering the Edit Signals/Slots
mode, I have two buttons OK
and Cancel
.
How can I set the following for the buttons:
OK
SIGNAL(clicked())
SLOT(accept())
Cancel
SIGNAL(clicked())
SLOT(reject())
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需将信号发射器拖到插槽所有者即可。您将看到可以从 GUI 连接的信号和插槽列表。所有其他(未显示)您将必须手动连接(从代码)
Just drag signal emitter to slot owner. You will be presented a list of signals and slots that you may connect from GUI. All others (not displayed) you will have to connect manually (from the code)
如果您使用的是 QButtonBox,则单击“确定”将发出accepted(),单击“取消”将发出rejected()。
如果您使用 QPushButton,则每个按钮都会发出 clicked() 信号。
您只需将其连接到接收器的相应插槽即可。
If you're using QButtonBox, then click OK will emit accepted() and Cancel will emit rejected().
If you're using QPushButton, then each button emit a clicked() signal.
You just have to connect it to the corresponding slot of the receiver.
还有一个“信号/槽编辑器”,您可以在其中添加连接,而无需与表单交互。可以在“查看”->“查看”中找到。信号/时隙编辑器。
There's also a 'Signal/Slot Editor' in which you can add connections without interacting with the form. It's found in View -> Signal/Slot Editor.