Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
QTableView and It's Model, Decoration Role With Rectangle
DzCode last edited by DzCode
I know that we can put a color inside decoration role of the model.
What about ptting a rectabgle? I want to put a rectangle inside decoration role (whose inside is empty). However decoration role cannot be a QRect. Is there any way to do it without doing inside paintevent of the qtableview custom class or inside a delegate because it is very slow when we write it inside paintevent.
Also I need to give different color into each rectangle
Create an image with your rectangle and return it for the decoration role.
I've just edited my description. I have assign different colors for each rectangle. So that setting an image is not a proper way for me. I have more than 1k rows with different colors.
Then create an image per color and store them in a container
@Christian-Ehrlicher do you mean creating QPixMap?
Decoration role accepts QPixmap, QImage, QIcon or a simple QColor - so yes create a pixmap for each color and return it accordingly.
@Christian-Ehrlicher Thank you