Is it possible to draw a colored rectangle on a toolButton?
-
I‘ve learned from this topic about how to draw a rectangle on a pushButton:
https://forum.qt.io/topic/80901/is-it-possible-to-draw-a-colored-rectangle-on-a-pushbutton/2What about a toolbutton?
I want to add a toolbutton which can change font color(like the button in MS office shown in picture).
After choosing a color from the QColorDialog, put a rectangle on the toolButton and keep the icon.Furthermore, can I put a transparent icon in front of the rectangle?
-
I‘ve learned from this topic about how to draw a rectangle on a pushButton:
https://forum.qt.io/topic/80901/is-it-possible-to-draw-a-colored-rectangle-on-a-pushbutton/2What about a toolbutton?
I want to add a toolbutton which can change font color(like the button in MS office shown in picture).
After choosing a color from the QColorDialog, put a rectangle on the toolButton and keep the icon.Furthermore, can I put a transparent icon in front of the rectangle?
-
@Yue-JIN You can do the same with tool button: subclass QToolButton and override paintEvent.
-
@jsulm So I need to add custom tool button to tool bar in code instead of adding action in qt designer?