QTableWidget: Cells updating event
-
Hi!
Is there some mechanism like 'OnDrawCell' from C++Builder/RAD Studio?
In that method, there is work with Canvas, I could dynamically change Color, Text, etc of any cell, even the header cell. I just want to create a simple code for any cell.
Thank you! -
If you want to modify the displaying of a cell you can either return e.g. a different color for e.g. BackgroundRole or similar or use a custom QStyledItemDelegate to draw the content by yourself.
-
Hi
A full blown OnDrawCell like CB would be a delegate however, you can
change color, font with Roles without resorting to custom drawing. -
Hi
A full blown OnDrawCell like CB would be a delegate however, you can
change color, font with Roles without resorting to custom drawing.@mrjj said in QTableWidget: Cells updating event:
Hi
A full blown OnDrawCell like CB would be a delegate however, you can
change color, font with Roles without resorting to custom drawing.Hi!
Is it possible to dynamically draw inside cells something like colored figures: square, rectangle, etc? -
@mrjj said in QTableWidget: Cells updating event:
Hi
A full blown OnDrawCell like CB would be a delegate however, you can
change color, font with Roles without resorting to custom drawing.Hi!
Is it possible to dynamically draw inside cells something like colored figures: square, rectangle, etc?@sitesv
Hi
Yes, that would be a job for a delegate.
here is a sample where its a rating box
https://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.htmlbut it could draw anything.