Skip to content

Commit

Permalink
Fix setFocus() in EditableListView
Browse files Browse the repository at this point in the history
How to reproduce:
- in Options > Interface > Top Tags, press button Add new tag

Traceback (most recent call last):
  File "/home/zas/src/picard/./picard/ui/widgets/editablelistview.py", line 87, in add_empty_row
    self.setFocus(True)
TypeError: arguments did not match any overloaded call:
  setFocus(self): too many arguments
  setFocus(self, reason: Qt.FocusReason): argument 1 has unexpected type 'bool'


Solution:

Call with QtCore.Qt.FocusReason.OtherFocusReason instead of True
  • Loading branch information
zas authored and phw committed May 6, 2024
1 parent b473f47 commit 81a1ddf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion picard/ui/widgets/editablelistview.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def items(self):

def add_empty_row(self):
# Setting the focus causes any open editor to getting closed
self.setFocus(True)
self.setFocus(QtCore.Qt.FocusReason.OtherFocusReason)
index = self.add_item()
self.setCurrentIndex(index)
self.edit(index)
Expand Down

0 comments on commit 81a1ddf

Please sign in to comment.