将值从filepicker设置为调用它的对话框

时间:2016-10-03 11:01:05

标签: python qt python-3.x pyqt qt-creator

我有一个操作按钮,可以调用我做过的对话框:

class MainPanelManager(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.actionLocation.triggered.connect(self.editsettings)

    def editsettings(self):
        dialog = QDialog()
        dialog.ui = Ui_Dialog()
        dialog.ui.setupUi(dialog)
        dialog.ui.pushButton.clicked.connect(self.openfile)
        dialog.exec_()


    def openfile(self):
        folder = QFileDialog.getExistingDirectory(self, 'Select Folder', 'C:/')
        # folder value must be set to dialog textedit

按下按钮时,对话框可以工作并打开文件选择器。选择文件夹时如何设置值。我需要将值放在textedit

1 个答案:

答案 0 :(得分:0)

一个简单的解决方案是将<form> <select id="filter" name="leavetype" required> <option value="selected">Select Leave Type</option> <option value="Absent">Absent</option> <option value="Annual">Annual</option> <option value="Medical">Medical</option> <option value="Casual">Casual</option> <option value="LWOP">LWOP</option> <option value="ShortLeave">Short Leave</option> <option value="HalfDay">Half Day</option> </select> <br>Leave From Date <input type="text" id="leavefromdate"> <br>Leave To Date <input type="text" id="leavetodate"> <br>Leave Count <input type="text" id="leavecount"> <br> </form> <script src="https://code.jquery.com/jquery-1.8.3.js"></script> <script src="https://code.jquery.com/ui/1.10.0/jquery-ui.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/redmond/jquery-ui.css" /> <script> </script>变量声明为const ( // stream types MPEGDASHStream = iota HLSStream = iota MPEGTSUDPStream = iota MPEGTSRTPStream = iota ) 对象的属性。因此,您可以在所有方法中广泛使用它。

dialog