QToolButton:按下回车键时单击

发布于 2025-01-07 21:06:14 字数 167 浏览 4 评论 0原文

我必须将 QPushButton 更改为 QToolButton。我使用 QPushButton 的 setDefault() 和 setautoDefault() 选项在按下 Enter(返回)时单击按钮,但现在我找不到对 QToolButton 执行相同操作的方法。

有什么建议我可以解决这个问题吗?

I had to change a QPushButton to a QToolButton. I used the setDefault() and setautoDefault() options for the QPushButton to click the button when enter(return) pressed but now I cant find a way to do the same with the QToolButton.

Is there any advice how I can solve this?

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

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

发布评论

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

评论(1

断肠人 2025-01-14 21:06:14

如果您由于某种原因被迫使用 QToolButton 而不是 QPushButton,那么这些方法将不再可用。您需要手动连接来自其他小部件的信号才能触发按钮的点击。

If you are for some reason forced to use a QToolButton instead of QPushButton, then those methods are no longer available to you. You would need to manually hook up signals from the other widgets to trigger a click on your button.

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