View Full Version : How to owner draw the item for QListWidget?
tszzp
25th November 2009, 03:10
I want to owner draw the item for QListWidget, not simple change the background color,and I notice the QListWidget isn't derived from QWidget, so it hasn't the paintEvent. how to implement it? thanks.
aamer4yu
25th November 2009, 04:20
and I notice the QListWidget isn't derived from QWidget, so it hasn't the paintEvent.
QWidget > QFrame > QAbstractScrollArea > QAbstractItemView > QListView > QListWidget.
See the inheritance ? so paintevent is available in QListWidget.
However for your need, its simple to use delegates. Have a look at QItemDelegate and QStyledItemDelegate
tszzp
27th November 2009, 02:41
QWidget > QFrame > QAbstractScrollArea > QAbstractItemView > QListView > QListWidget.
See the inheritance ? so paintevent is available in QListWidget.
However for your need, its simple to use delegates. Have a look at QItemDelegate and QStyledItemDelegate
Sorry, I type error. I want to type the QListWidgetItem. thank you for your reply. I will try to use the QItemDelegate to owner draw the item for QListWidget. thanks.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.