Yuya Nishihara  committed 751ec7f

labeleddelegate: make sure to have top/bottom margins on any styles

2px margin is not included in decorationSize because it may be added by
platform style. For example, QWindowsVistaStyle does sz.rheight() += 2.

Currently, this margin is also provided by GraphDelegate.sizeHint(), but in
principle, it isn't the job of GraphDelegate.

  • Participants
  • Parent commits 12e5281
  • Branches default

Comments (0)

Files changed (1)

File tortoisehg/hgqt/

+    def sizeHint(self, option, index):
+        size = super(LabeledDelegate, self).sizeHint(option, index)
+        # give additional margins for each row (even if it has no labels
+        # because uniformRowHeights is enabled)
+        option = QStyleOptionViewItemV4(option)
+        self.initStyleOption(option, index)
+        lay = self._makeLabelsLayout([], option)
+        return QSize(size.width(), max(size.height(), lay.height() + 2))
 class ColumnSelectDialog(QDialog):
     def __init__(self, name, model, curcolumns, parent=None):