--- a/eric6/E5Gui/E5LineEdit.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5LineEdit.py Tue Mar 02 17:17:09 2021 +0100 @@ -39,7 +39,7 @@ @param evt reference to the event (QEvent) @return flag indicating, whether the event was recognized (boolean) """ - if evt.type() == QEvent.LayoutRequest: + if evt.type() == QEvent.Type.LayoutRequest: self.sizeHintChanged.emit() return QWidget.event(self, evt) @@ -74,31 +74,34 @@ self.__leftLayout = QHBoxLayout(self.__leftWidget) self.__leftLayout.setContentsMargins(0, 0, 2, 0) if QApplication.isRightToLeft(): - self.__leftLayout.setDirection(QBoxLayout.RightToLeft) + self.__leftLayout.setDirection(QBoxLayout.Direction.RightToLeft) else: - self.__leftLayout.setDirection(QBoxLayout.LeftToRight) - self.__leftLayout.setSizeConstraint(QLayout.SetFixedSize) + self.__leftLayout.setDirection(QBoxLayout.Direction.LeftToRight) + self.__leftLayout.setSizeConstraint( + QLayout.SizeConstraint.SetFixedSize) self.__rightWidget = E5LineEditSideWidget(self) self.__rightWidget.resize(0, 0) self.__rightLayout = QHBoxLayout(self.__rightWidget) self.__rightLayout.setContentsMargins(0, 0, 2, 0) if self.isRightToLeft(): - self.__rightLayout.setDirection(QBoxLayout.RightToLeft) + self.__rightLayout.setDirection(QBoxLayout.Direction.RightToLeft) else: - self.__rightLayout.setDirection(QBoxLayout.LeftToRight) + self.__rightLayout.setDirection(QBoxLayout.Direction.LeftToRight) horizontalSpacer = QSpacerItem( - 0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum) + 0, 0, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) self.__mainLayout.addWidget( - self.__leftWidget, 0, Qt.AlignVCenter | Qt.AlignLeft) + self.__leftWidget, 0, + Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignLeft) self.__mainLayout.addItem(horizontalSpacer) self.__mainLayout.addWidget( - self.__rightWidget, 0, Qt.AlignVCenter | Qt.AlignRight) + self.__rightWidget, 0, + Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignRight) if self.isRightToLeft(): - self.__mainLayout.setDirection(QBoxLayout.RightToLeft) + self.__mainLayout.setDirection(QBoxLayout.Direction.RightToLeft) else: - self.__mainLayout.setDirection(QBoxLayout.LeftToRight) + self.__mainLayout.setDirection(QBoxLayout.Direction.LeftToRight) self.setWidgetSpacing(3) self.__leftWidget.sizeHintChanged.connect(self._updateTextMargins) @@ -127,15 +130,21 @@ @param evt reference to the event (QEvent) @return flag indicating, whether the event was recognized (boolean) """ - if evt.type() == QEvent.LayoutDirectionChange: + if evt.type() == QEvent.Type.LayoutDirectionChange: if self.isRightToLeft(): - self.__mainLayout.setDirection(QBoxLayout.RightToLeft) - self.__leftLayout.setDirection(QBoxLayout.RightToLeft) - self.__rightLayout.setDirection(QBoxLayout.RightToLeft) + self.__mainLayout.setDirection( + QBoxLayout.Direction.RightToLeft) + self.__leftLayout.setDirection( + QBoxLayout.Direction.RightToLeft) + self.__rightLayout.setDirection( + QBoxLayout.Direction.RightToLeft) else: - self.__mainLayout.setDirection(QBoxLayout.LeftToRight) - self.__leftLayout.setDirection(QBoxLayout.LeftToRight) - self.__rightLayout.setDirection(QBoxLayout.LeftToRight) + self.__mainLayout.setDirection( + QBoxLayout.Direction.LeftToRight) + self.__leftLayout.setDirection( + QBoxLayout.Direction.LeftToRight) + self.__rightLayout.setDirection( + QBoxLayout.Direction.LeftToRight) return QLineEdit.event(self, evt) def _updateTextMargins(self):