Commit 4e032cad authored by Dan Pascu's avatar Dan Pascu

Fixed undating LineEdit if inactiveText changes at runtime

parent 3258d51b
...@@ -79,14 +79,19 @@ class LineEdit(QLineEdit): ...@@ -79,14 +79,19 @@ class LineEdit(QLineEdit):
self.right_widget.setGeometry(text_rect) self.right_widget.setGeometry(text_rect)
def event(self, event): def event(self, event):
if event.type() == QEvent.LayoutDirectionChange: event_type = event.type()
if event_type == QEvent.LayoutDirectionChange:
box_direction = QBoxLayout.RightToLeft if self.isRightToLeft() else QBoxLayout.LeftToRight box_direction = QBoxLayout.RightToLeft if self.isRightToLeft() else QBoxLayout.LeftToRight
self.left_layout.setDirection(box_direction) self.left_layout.setDirection(box_direction)
self.right_layout.setDirection(box_direction) self.right_layout.setDirection(box_direction)
elif event.type() == QEvent.DynamicPropertyChange and event.propertyName() == 'widgetSpacing': elif event_type == QEvent.DynamicPropertyChange:
self.left_layout.setSpacing(self.widgetSpacing) property_name = event.propertyName()
self.right_layout.setSpacing(self.widgetSpacing) if property_name == 'widgetSpacing':
self._update_text_margins() self.left_layout.setSpacing(self.widgetSpacing)
self.right_layout.setSpacing(self.widgetSpacing)
self._update_text_margins()
elif property_name == 'inactiveText':
self.update()
return QLineEdit.event(self, event) return QLineEdit.event(self, event)
def resizeEvent(self, event): def resizeEvent(self, event):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment