# Date 1718911575 14400
# Thu Jun 20 15:26:15 2024 -0400
# Branch stable
# Node ID a00cdef7241b79519593aa9549140205fe7cf4ad
# Parent 59f312da84aa0a9649974ea8843fd959dbad0c37
commit: correct the commit button width for Qt6 (fixes #5968)
I don't recall seeing the truncated button myself on Windows with Qt6, but maybe
I used an earlier version of Qt6. In any case, the button doesn't seem much
larger (if it is at all) on Windows with Qt5 with this change, and I couldn't
track down the reason for the magic multiplication from afe08b4e6fd6, nor what
it is trying to do here. Even with the MQ extension enabled, the button looks
fine on Qt5. Maybe it was trying to make the button narrower than the menu
(since the menu has longer text than "Commit" or "Amend"), but that's still the
case with this change.
diff --git a/tortoisehg/hgqt/commit.py b/tortoisehg/hgqt/commit.py
--- a/tortoisehg/hgqt/commit.py
+++ b/tortoisehg/hgqt/commit.py
@@ -504,7 +504,7 @@
committb.setPopupMode(QToolButton.ToolButtonPopupMode.MenuButtonPopup)
fmk = lambda s: committb.fontMetrics().horizontalAdvance(hglib.tounicode(s[2]))
committb._width = (max(pycompat.maplist(fmk, acts))
- + 4*committb.menuButtonWidth())
+ + committb.width())
class CommitButtonMenu(QMenu):
def __init__(self, parent, repo):