Answer the question
In order to leave comments, you need to log in
How to highlight a whole line in PyQt5?
I am writing a music player . I
display a playlist in QTableWidget. Selecting rows with selectRow().
The code that fires on startup to highlight the first row:
self.window.playlist_table.clearSelection()
self.window.playlist_table.setSelectionMode(QAbstractItemView.MultiSelection)
self.window.playlist_table.selectRow(0)
self.window.playlist_table.setSelectionMode(QAbstractItemView.NoSelection)
self.window.playlist_table.clearSelection()
self.window.playlist_table.setSelectionMode(QAbstractItemView.MultiSelection)
row_num = self.window.playlist_table.currentRow()
self.window.playlist_table.selectRow(row_num)
self.media_playlist.setCurrentIndex(row_num)
self.playSong()
self.window.playlist_table.setSelectionMode(QAbstractItemView.NoSelection)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question