qdialog 返回值_python-PyQt QDialog返回响应是或否

我有一个QDialog类confirmation_dialog=uic.loadUiType(“ui\confirmation_dialog.ui”)[0]classConfirmationDialog(QDialog,confirmation_dialog):def__init__(self,parent=None):QDialog.__init__(self,parent)self.s…

大家好,又见面了,我是你们的朋友全栈君。

我有一个QDialog类

confirmation_dialog = uic.loadUiType(“ui\confirmation_dialog.ui”)[0]

class ConfirmationDialog(QDialog,confirmation_dialog):

def __init__(self,parent=None):

QDialog.__init__(self,parent)

self.setupUi(self)

message = “Hello, Dialog test”

self.yes_button.clicked.connect(self.yes_clicked)

self.no_button.clicked.connect(self.no_clicked)

self.message_box.insertPlainText(message)

def yes_clicked(self):

self.emit(SIGNAL(“dialog_response”),”yes”)

def no_clicked(self):

self.emit(SIGNAL(“dialog_response”),”no”)

我有一个需要确认是否继续的功能,但是对于当前的实现,它不等待QDialog关闭.

如何使我的函数等待QDialog的响应,然后进行相应处理.

我想实现类似于确认功能的内容,如下所示

def function(self):

….

….

if self.confirm() == ‘yes’:

#do something

elif self.confirm() == ‘no’:

#do something

def confirm(self):

dialog = ConfirmationDialog()

dialog.show()

return #response from dialog

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/127958.html原文链接:https://javaforall.net

(0)
上一篇 2022年4月16日 下午1:20
下一篇 2022年4月16日 下午1:20


相关推荐

  • C# SqlTransaction的使用[通俗易懂]

    C# SqlTransaction的使用[通俗易懂]Sqltransaction是用在多sql任务写数据库时的Codeusing(SqlConnectionconn=newSqlConnection(SqlHelper.ConnectionString)){conn.Open();…

    2022年5月1日
    110
  • Declare 语句

    Declare 语句原文 http blog csdn net u0 article details 本文是看了网上很多零碎的知识点总结而成 要感谢广大网友的智慧 Declare 语句用于在模块级别中声明对动态链接库 DLL 中外部过程的引用 语法 1 Public nbsp nbsp Private nbsp Declare nbsp Sub nbsp name nbsp Lib nbsp libname nbsp Alias nbsp aliasnam

    2026年3月18日
    3
  • 光纤交换机划分zone方法

    光纤交换机划分zone方法以是"wwn",还可以是zone的别名和QuickloopAL_PAs。交换机默认域为1,端口号从0-15。可以用switchshow来查看配置。重要的是记住必须用cfgsave保存,和cfgenable让其生效。  ***********************************************************在IBM2109光纤通道交换机上设置分区的步骤 环境 SAN2109如何在IBM2109光纤通道交换机上设置分区(Zoning)在存

    2022年5月11日
    148
  • html获取表单提交数据_提交表单的两种方法

    html获取表单提交数据_提交表单的两种方法转载于:https://blog.csdn.net/yongwoozzang/article/details/83029128HttpURLConnectionx-www-form-urlencodedpublicstaticStringPost(StringhttpUrl,Stringdata){ PrintWriterout=null; InputStr…

    2022年10月6日
    5
  • R语言DCC-GARCH模型

    R语言DCC-GARCH模型QXQ

    2026年3月16日
    2
  • Springboot+netty实现Web聊天室

    Springboot+netty实现Web聊天室Web聊天室的实现一、项目的创建一、项目的创建新建Spring项目:选择JDK版本:选择SpringWeb:项目名称和位置的设置:

    2022年6月22日
    30

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号