如何设置 QDialog 在 exec() 方法上不可见?

发布于 2024-12-23 03:27:30 字数 373 浏览 7 评论 0原文

我使用 exec() 方法启动 QDialog,现在我喜欢它不可见,直到它内部的某个内部对象(Qwebkit)完成它的工作。
在 QDialog 构造函数中,我将其设置为:

setVisible(false);
hide()

但是当我这样做时,pAuthenticationDialogContainer 是指向 QDialog 的指针:

if(pAuthenticationDialogContainer->exec() != QDialog::Accepted ) { ....}

我可以看到 QDialog 几秒钟(1-2 秒)
我怎样才能让它完全隐形?
谢谢

i start QDialog with exec() method , now i like it to invisible until some inner object inside it (Qwebkit ) will finish its stuff.
in the QDialog constructor i set it to :

setVisible(false);
hide()

but will when i do where pAuthenticationDialogContainer is pointer to QDialog :

if(pAuthenticationDialogContainer->exec() != QDialog::Accepted ) { ....}

i can see the QDialog for few seconds (1-2 seconds )
how can i make it fully invisible ?
Thanks

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

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

发布评论

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

评论(1

送你一个梦 2024-12-30 03:27:30

您是否考虑过将用户按下的按钮与 QDialog 中的 close()accept() 槽连接起来?

connect(pAuthenticationDialogContainer->loginButton,
        SIGNAL(clicked()),
        pAuthinticationDialogContainer,
        SLOT(accept()));

应该隐藏对话框。您必须使此代码准确并进行测试,但这应该会自动为您完成此操作。除此之外,我认为发布条件的 else 子句的代码会很有帮助。

Have you considered connecting the button the user presses with close() or accept() slots from QDialog?

connect(pAuthenticationDialogContainer->loginButton,
        SIGNAL(clicked()),
        pAuthinticationDialogContainer,
        SLOT(accept()));

Which supposed to hide the dialog. You will have to make this code exact and test it but this should do this automatically for you. Beyond that I think posting code for the else clause of the condition would be helpful.

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