Autosave rule edits and sort centered table controls
This commit is contained in:
@@ -7,6 +7,7 @@ class ComboBox(W.QComboBox):
|
||||
"""Size popups for their text, independently of narrow table columns."""
|
||||
def __init__(self, parent=None):
|
||||
self._text_width = None
|
||||
self._text_alignment = None
|
||||
super().__init__(parent)
|
||||
self.setSizeAdjustPolicy(W.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||
self.setMinimumContentsLength(6)
|
||||
@@ -71,6 +72,20 @@ class ComboBox(W.QComboBox):
|
||||
return True
|
||||
return super().event(event)
|
||||
|
||||
def setTextAlignment(self, alignment):
|
||||
self._text_alignment = alignment
|
||||
self.update()
|
||||
|
||||
def paintEvent(self, event):
|
||||
if self._text_alignment is None:
|
||||
return super().paintEvent(event)
|
||||
painter = W.QStylePainter(self)
|
||||
option = W.QStyleOptionComboBox()
|
||||
self.initStyleOption(option)
|
||||
option.textAlignment = self._text_alignment
|
||||
painter.drawComplexControl(W.QStyle.ComplexControl.CC_ComboBox, option)
|
||||
painter.drawControl(W.QStyle.ControlElement.CE_ComboBoxLabel, option)
|
||||
|
||||
|
||||
class RowBatch(C.QObject):
|
||||
"""Create Qt rows in short event-loop slices, keeping input responsive."""
|
||||
|
||||
Reference in New Issue
Block a user