Applying the color of Custom widgets to the controls inside it
-
I have created a custom widget derived from QWidget.
-
it contain 2 buttons and on label.
-
I am applying the background color to the QWidget using the
QStylePainter painter(this);
painter.fillRect(rect(), QColor(255,255,255);
when I do this , the color is filled on the rectangular area of the custom widget and also to the label inside it.
For the buttons it is not applied. What is the reason for this and what is the potential solution.
Second issue I am facing , is the button is not appearing as a if it is not integrated to the custom control. it is projected out. If you see the below image the button is not flat and integrated with the parent control. So how to achieve this also?
I tried stylesheet, it resolved both the issues. But I am looking for alternate for stylesheet
-
-
Hi
-For the buttons, it is not applied. What is the reason for this and what is the potential solution?
Hi, the labels are transparent (no background color) so you see your custom widget through them.
Buttons do have a background normally.You could use ToolButtons and set auto raise
which allows seeing through the button.