28 from eric6config import getConfig |
28 from eric6config import getConfig |
29 |
29 |
30 import Preferences |
30 import Preferences |
31 |
31 |
32 |
32 |
33 pyqtSignatureRole = Qt.UserRole + 1 |
33 pyqtSignatureRole = Qt.ItemDataRole.UserRole + 1 |
34 pythonSignatureRole = Qt.UserRole + 2 |
34 pythonSignatureRole = Qt.ItemDataRole.UserRole + 2 |
35 rubySignatureRole = Qt.UserRole + 3 |
35 rubySignatureRole = Qt.ItemDataRole.UserRole + 3 |
36 returnTypeRole = Qt.UserRole + 4 |
36 returnTypeRole = Qt.ItemDataRole.UserRole + 4 |
37 parameterTypesListRole = Qt.UserRole + 5 |
37 parameterTypesListRole = Qt.ItemDataRole.UserRole + 5 |
38 parameterNamesListRole = Qt.UserRole + 6 |
38 parameterNamesListRole = Qt.ItemDataRole.UserRole + 6 |
39 |
39 |
40 |
40 |
41 class CreateDialogCodeDialog(QDialog, Ui_CreateDialogCodeDialog): |
41 class CreateDialogCodeDialog(QDialog, Ui_CreateDialogCodeDialog): |
42 """ |
42 """ |
43 Class implementing a dialog to generate code for a Qt5 dialog. |
43 Class implementing a dialog to generate code for a Qt5 dialog. |
58 @param parent parent widget if the dialog (QWidget) |
58 @param parent parent widget if the dialog (QWidget) |
59 """ |
59 """ |
60 super(CreateDialogCodeDialog, self).__init__(parent) |
60 super(CreateDialogCodeDialog, self).__init__(parent) |
61 self.setupUi(self) |
61 self.setupUi(self) |
62 |
62 |
63 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
63 self.okButton = self.buttonBox.button( |
|
64 QDialogButtonBox.StandardButton.Ok) |
64 |
65 |
65 self.slotsView.header().hide() |
66 self.slotsView.header().hide() |
66 |
67 |
67 self.project = project |
68 self.project = project |
68 |
69 |
342 if ( |
343 if ( |
343 methodDict["methods"][0] in signatureList or |
344 methodDict["methods"][0] in signatureList or |
344 methodDict["methods"][1] in signatureList |
345 methodDict["methods"][1] in signatureList |
345 ): |
346 ): |
346 itm2.setFlags( |
347 itm2.setFlags( |
347 Qt.ItemFlags(Qt.ItemIsEnabled)) |
348 Qt.ItemFlags(Qt.ItemFlag.ItemIsEnabled)) |
348 itm2.setCheckState(Qt.Checked) |
349 itm2.setCheckState(Qt.CheckState.Checked) |
349 if e5App().usesDarkPalette(): |
350 if e5App().usesDarkPalette(): |
350 itm2.setForeground(QBrush(QColor("#75bfff"))) |
351 itm2.setForeground(QBrush(QColor("#75bfff"))) |
351 else: |
352 else: |
352 itm2.setForeground(QBrush(Qt.blue)) |
353 itm2.setForeground(QBrush(Qt.GlobalColor.blue)) |
353 continue |
354 continue |
354 |
355 |
355 itm2.setData(methodDict["pyqt_signature"], |
356 itm2.setData(methodDict["pyqt_signature"], |
356 pyqtSignatureRole) |
357 pyqtSignatureRole) |
357 itm2.setData(methodDict["python_signature"], |
358 itm2.setData(methodDict["python_signature"], |
362 parameterTypesListRole) |
363 parameterTypesListRole) |
363 itm2.setData(methodDict["parameter_names"], |
364 itm2.setData(methodDict["parameter_names"], |
364 parameterNamesListRole) |
365 parameterNamesListRole) |
365 |
366 |
366 itm2.setFlags(Qt.ItemFlags( |
367 itm2.setFlags(Qt.ItemFlags( |
367 Qt.ItemIsUserCheckable | |
368 Qt.ItemFlag.ItemIsUserCheckable | |
368 Qt.ItemIsEnabled | |
369 Qt.ItemFlag.ItemIsEnabled | |
369 Qt.ItemIsSelectable) |
370 Qt.ItemFlag.ItemIsSelectable) |
370 ) |
371 ) |
371 itm2.setCheckState(Qt.Unchecked) |
372 itm2.setCheckState(Qt.CheckState.Unchecked) |
372 |
373 |
373 self.slotsView.sortByColumn(0, Qt.AscendingOrder) |
374 self.slotsView.sortByColumn(0, Qt.SortOrder.AscendingOrder) |
374 |
375 |
375 def __generateCode(self): |
376 def __generateCode(self): |
376 """ |
377 """ |
377 Private slot to generate the code as requested by the user. |
378 Private slot to generate the code as requested by the user. |
378 """ |
379 """ |
518 topItem = self.slotsModel.item(row) |
519 topItem = self.slotsModel.item(row) |
519 for childRow in range(topItem.rowCount()): |
520 for childRow in range(topItem.rowCount()): |
520 child = topItem.child(childRow) |
521 child = topItem.child(childRow) |
521 if ( |
522 if ( |
522 child.checkState() and |
523 child.checkState() and |
523 child.flags() & Qt.ItemFlags(Qt.ItemIsUserCheckable) |
524 child.flags() & Qt.ItemFlags( |
|
525 Qt.ItemFlag.ItemIsUserCheckable) |
524 ): |
526 ): |
525 slotsCode.append('{0}\n'.format(indentStr)) |
527 slotsCode.append('{0}\n'.format(indentStr)) |
526 slotsCode.append('{0}{1}\n'.format( |
528 slotsCode.append('{0}{1}\n'.format( |
527 indentStr, |
529 indentStr, |
528 pyqtSignatureFormat.format( |
530 pyqtSignatureFormat.format( |
606 """ |
608 """ |
607 Private slot called, when thext of the filter edit has changed. |
609 Private slot called, when thext of the filter edit has changed. |
608 |
610 |
609 @param text changed text (string) |
611 @param text changed text (string) |
610 """ |
612 """ |
611 rx = QRegularExpression(text, QRegularExpression.CaseInsensitiveOption) |
613 rx = QRegularExpression( |
|
614 text, |
|
615 QRegularExpression.PatternOption.CaseInsensitiveOption) |
612 self.proxyModel.setFilterRegularExpression(rx) |
616 self.proxyModel.setFilterRegularExpression(rx) |
613 |
617 |
614 @pyqtSlot() |
618 @pyqtSlot() |
615 def on_newButton_clicked(self): |
619 def on_newButton_clicked(self): |
616 """ |
620 """ |
618 """ |
622 """ |
619 path, file = os.path.split(self.srcFile) |
623 path, file = os.path.split(self.srcFile) |
620 objName = self.__objectName() |
624 objName = self.__objectName() |
621 if objName: |
625 if objName: |
622 dlg = NewDialogClassDialog(objName, file, path, self) |
626 dlg = NewDialogClassDialog(objName, file, path, self) |
623 if dlg.exec() == QDialog.Accepted: |
627 if dlg.exec() == QDialog.DialogCode.Accepted: |
624 className, fileName = dlg.getData() |
628 className, fileName = dlg.getData() |
625 |
629 |
626 self.classNameCombo.clear() |
630 self.classNameCombo.clear() |
627 self.classNameCombo.addItem(className) |
631 self.classNameCombo.addItem(className) |
628 self.srcFile = fileName |
632 self.srcFile = fileName |