Apr-29-2017, 01:10 PM
I create a dilaog in Qt Designer and I use PyQT5. After a selcetion of users and the ouput format, I will open a Filedialog to chouse the Filename and the path. But the problem is, that the Dilaog is inherit by object and the Filedialog need in the first parameter a QWidget
My CreateReportDialog:
[inline][
The function in my mainwindow to Open this dialog:
Greets niesel
My CreateReportDialog:
[code]from PyQt5 import QtCore, QtGui, QtWidgets
from Database.DatabaseOperations import *
from rebezcheck_main import *
class CreateReport_Dialog(object):
def __init__(self):
self.ownerId = None
self.firmId = None
self.format = None
def setupUi(self, createreport):
createreport.setObjectName("Dialog")
createreport.resize(400, 300)
....
def createReport(self):
msgbx = DataChangeMsgBx()
check_input_list = self.check_input()
if len(check_input_list) > 0:
error_strg = "\n".join(check_input_list)
msgbx.checkInputsMsgBx(error_strg)
else:
fileName = QFileDialog.getSaveFileName(self, 'Dialog Title', '/path/to/default/directory', selectedFilter='*.txt') # Error_Message
if fileName:
print("filename")[/code]If I ty to open this Dialog I get the errormessage:[inline][
TypeError: getSaveFileName(parent: QWidget = None, caption: str = '', directory: str = '', filter: str = '', initialFilter: str = '', options: Union[QFileDialog.Options, QFileDialog.Option] = 0): argument 1 has unexpected type 'CreateReport_Dialog'/inline]
The function in my mainwindow to Open this dialog:
def showCreateReportDialog(self): createReportDialog = QtWidgets.QDialog() ui = CreateReport_Dialog() ui.setupUi(createReportDialog) createReportDialog.exec_()I understand the problem but I don't know how I can fix them
Greets niesel

You are welcome