Hello, Alejandro. I suggest switching to QListView with a model derived from QAbstractListModel. In your case this method should be quite similar to QListWidget-based one in terms of code complexity, but is somewhat more flexible and, probably, a bit faster because of removing an abstraction layer formed by QListWidget stuff around QListView&Co. On Apr 8, 2013 5:17 PM, "Alejandro Exojo" <aex...@modpow.es> wrote:
> Hi. > > I have to display a moderately simple list (6-8 rows at most, not > directly editable). I've done it quite simply with a class derived > form QListWidget, and a custom QListWidgetItem that creates new > widgets (one or two QLabels, nothing fancy), and places them in the > list with setItemWidget(). This works apparently fine, but when > changing the value of one of the labels in the widget, sometimes, and > only sometimes, the list displays pretty badly, and either shows one > row completely empty (because makes 0 the width of the elements > inside), or wants to leave one extra space for a phantom row. > > The documentation for setItemWidget says "This function should only be > used to display static content in the place of a list widget item". > Well, the content is static in the sense that the user doesn't have to > edit it. Is an embedded application, and is just one click here or > there that changes the values in a quite limited way (e.g. no keyboard > input, no special editor widget, etc.). > > The odd display bugs seem to tell me that I should be using the "full > blown" QListView and model/view classes, but still, QListWidget is > also based on these classes, so I have doubts that doing it on my own > is going to be much different. Seems a really simple use case. > > Any advice? > Thank you. > > -- > Alejandro Exojo Piqueras > > ModpoW, S.L. > Technova LaSalle | Sant Joan de la Salle 42 | 08022 Barcelona | > www.modpow.es > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest