Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] How would you set an alpha "texture" for QBrush?
I'm developing a custom color picker for an OpenGL application and I'm using QGraphicsView to preview the changes of color the user inputs. Since I have 4 sliders (one per channel) that alter the resulting color, I realized that if I moved the alpha one to zero, the preview will turn white. I would like it to turn something else, like that common squared texture from image editors like Gimp.
Is there any way to achieve this with QBrush?
Are you thinking for something like :
@QBrush(QColor(0, 0, 255, 128))@
It should give you a half-transparent blue brush.
No, what I would like to achieve is to show a texture on the background as the alpha channel reduces.
Just as the background of this picture:
Then what about QBrush::setTexture ?
I forgot I was using a QBrush for the background, so I could use one for the foreground too. By setting a texture for the background one and tweaking the foreground colors I achieved what I was looking for.