[Qt-interest] Sizing according to the selection in a QTableView
Gustavo Federico Bett
gfbett at gmail.com
Fri May 15 23:46:05 CEST 2009
Hi all
I'm working with a QTableView and a custom QStyledItemDelegate, and what I'm
trying to accomplish is to change the height of the selected rows (make the
selected row twice the height of the rest).
I've already implemented the sizeHint() method in the delegate, and set the
resizeMode of the headers of the view to QHeaderView::ResizeToContents. I'm
also connectiong the currentChanged signal of the selection model to emit
the dataChanged signal in the model, and thus sizeHint is called everytime
the selection changes.
But the problem that I have now is that the state of the
QStyleOptionViewItem in the sizeHint method doesn't show if the item is
selected or not (it's always QStyle::State_Active | QStyle::State_Enabled).
In the paint method the flag does indicate the selection state, and I'm able
to change the painting according to that.
Any idea on why I'm not getting the QStyle::State_Selected flag in
sizeHint?????
Thanks in advance
Federico
--
Gustavo Federico Bett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090515/55da9da8/attachment.html
More information about the Qt-interest-old
mailing list