36 |
36 |
37 self.__lineEdit = E5ClearableLineEdit(self) |
37 self.__lineEdit = E5ClearableLineEdit(self) |
38 self.__layout.addWidget(self.__lineEdit) |
38 self.__layout.addWidget(self.__lineEdit) |
39 |
39 |
40 self.__buttonBox = QDialogButtonBox( |
40 self.__buttonBox = QDialogButtonBox( |
41 QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) |
41 QDialogButtonBox.StandardButton.Ok | |
|
42 QDialogButtonBox.StandardButton.Cancel, self) |
42 self.__layout.addWidget(self.__buttonBox) |
43 self.__layout.addWidget(self.__buttonBox) |
43 |
44 |
44 self.__buttonBox.accepted.connect(self.accept) |
45 self.__buttonBox.accepted.connect(self.accept) |
45 self.__buttonBox.rejected.connect(self.reject) |
46 self.__buttonBox.rejected.connect(self.reject) |
46 |
47 |
105 @rtype str |
106 @rtype str |
106 """ |
107 """ |
107 return self.label.text() |
108 return self.label.text() |
108 |
109 |
109 |
110 |
110 def getText(parent, title, label, mode=QLineEdit.Normal, text="", |
111 def getText(parent, title, label, mode=QLineEdit.EchoMode.Normal, text="", |
111 minimumWidth=300): |
112 minimumWidth=300): |
112 """ |
113 """ |
113 Function to get create a dialog to enter some text and return it. |
114 Function to get create a dialog to enter some text and return it. |
114 |
115 |
115 @param parent reference to the parent widget |
116 @param parent reference to the parent widget |
133 dlg.setLabelText(label) |
134 dlg.setLabelText(label) |
134 dlg.setTextEchoMode(mode) |
135 dlg.setTextEchoMode(mode) |
135 dlg.setTextValue(text) |
136 dlg.setTextValue(text) |
136 dlg.setMinimumWidth(minimumWidth) |
137 dlg.setMinimumWidth(minimumWidth) |
137 |
138 |
138 if dlg.exec() == QDialog.Accepted: |
139 if dlg.exec() == QDialog.DialogCode.Accepted: |
139 return True, dlg.textValue() |
140 return True, dlg.textValue() |
140 else: |
141 else: |
141 return False, "" |
142 return False, "" |