我在 UI 中有浏览按钮,单击它会触发打开文件对话框。我的问题是打开文件对话框甚至在单击浏览按钮之前就已触发。下面是我的代码
class GisedifySupportDialog(QtWidgets.QDialog, FORM_CLASS):
def __init__(self, parent=None):
"""Constructor."""
super(GisedifySupportDialog, self).__init__(parent)
self.setupUi(self)
self.img_upload=Upload_Image()
self.img_upload.setupUi(self.upload_image_dialog)
self.img_upload.pushButton.clicked.connect(self.browseTheFileAudio(self.img_upload.lineEdit))
def browseTheFileAudio(self,lineedit_name):
self.fileName = QtWidgets.QFileDialog.getOpenFileName(self, "Browse for the file", os.getenv("HOME"))
self.fileName=self.fileName
lineedit_name.setText(str(self.fileName))
return self.fileName
为什么 briwseTheFileAudio 函数在单击按钮之前就触发了?
互换的青春
相关分类