I am trying to find out the background color of a QWidget
or QGLWidget
so that I can use it with qglClearColor()
to make the OpenGL part appear natively within the widget (without for example a black background).
I figured I could fetch backgroundRole()
of my widget but I am having problems converting it to a QColor
. There is QPalette::color(QColorRole)
but it isn't static and I have no idea how I would have to create an instance of QPalette
to do the transformation.
Open your device's Settings app . Select Accessibility. Under "Display," turn on Dark theme.
ui->frame->setStyleSheet(""); ui->frame->setStyleSheet("background-color: rgb(255,255,255)");
Use QWidget::palette().color(QWidget::backgroundRole())
to receive the color of the background color role for that widget. Obviously, this should also work with any class that inherits QWidget.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With