From what I understand, QListWidget is built on QListView, and implements a "traditional" list widget, without any model/view concept.
Is there any situation where QListWidget should be preferred over QListView, or is QListView always a better answer once the model/view concept is understood ?
QListWidget
is easier to use, even once you understood how models work. It can be handy to use in dialogs where a strict MVC separation is not that much of a concern.
QListView
is harder to understand, but far more extensible. For example, by implementing methods on it like canFetchMore
and fetchMore
on the model, you can create lists that gather more data as you scroll.
QListWidget
is a narrow implementation of a QListView
. It's perfect for prototyping and any situation where you might add and subtract small amounts of data to/from the list.
If your app isn't dependent on the list as its main element, you can probably get away with a QListWidget
. If your core functionality comes from the list, you're better off tailoring a QListView
to your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With