[PyQt] QAbstractListModel.layoutChanged not repainting a QListView (was: (no subject))

Jerome Leclanche adys.wh at gmail.com
Wed Jan 15 14:25:52 GMT 2014


Grr. Sorry for the missing subject, I picked a fight with my email
client this morning.

J. Leclanche


On Wed, Jan 15, 2014 at 2:23 PM, Jerome Leclanche <adys.wh at gmail.com> wrote:
> Hi list
>
> I just picked up and updated one of my old pyside projects to work
> with PyQt5 on Python 3. It is a file manager, using a QListView with a
> QAbstractListModel to represent the files.
>
> This is the model:
> https://github.com/Adys/flipper/blob/master/flipper/main.py#L190
>
> This is the view:
> https://github.com/Adys/flipper/blob/master/flipper/views.py#L44
>
> (Note, I haven't worked on the code in ages and it was ported directly
> from pyside/qt4 on python 2 to pyqt/qt5 on python 3, so it's likely
> terrible - bear with me)
>
> When I change directory, the custom directoryChanged signal is emitted
> (line 220). In turn, that calls updateDirectoryInfo(), which calls
> refresh(), which emits layoutChanged (line 342).
>
> When I last tested it (over a year ago), layoutChanged would force a
> repaint of the contents of the listview. However, now that it's been
> ported, it's not repainting unless I focus out of the window or select
> things:
> https://mediacru.sh/0srBTnDrt8k1
>
> Any idea what might be going on?
>
> J. Leclanche


More information about the PyQt mailing list