Autosave rule edits and sort centered table controls

This commit is contained in:
AttilaNet
2026-11-08 10:28:55 +08:00
parent aa27b1673d
commit d0fd15c785
10 changed files with 402 additions and 54 deletions
+15
View File
@@ -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."""