Skip to content

Commit 66f33ff

Browse files
committed
Unset current row of event list before clearing it.
Closes PacktPublishing#16. Thanks eramey16!
1 parent 627a70a commit 66f33ff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Chapter03/calendar_app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ def clear_form(self):
146146
self.event_detail.setPlainText('')
147147

148148
def populate_list(self):
149+
# As reported by github user eramey16, we need the following line
150+
# to unselect list items since the selected index may not exist
151+
# in the new list. This line is not in the book code.
152+
self.event_list.setCurrentRow(-1)
153+
149154
self.event_list.clear()
150155
self.clear_form()
151156
date = self.calendar.selectedDate()

0 commit comments

Comments
 (0)