Open Binary-Vanguard-12138 opened 3 months ago
Hi, @mcallegari To solve this issue, I'm trying to update the code as follows. (This is just an example. VCSlider widget top label)
The VCSlider top label is defined like this. (vcslider.cpp)
m_topLabel = new QLabel(this);
m_topLabel->setAlignment(Qt::AlignHCenter);
layout()->addWidget(m_topLabel);
This works as follows.
I will update like this.
m_topLabel = new QLabel;
m_topLabel->setAlignment(Qt::AlignHCenter);
// Now the label is a top-level widget with no parent style sheet
m_topLabel->setAttribute(Qt::WA_NoSystemBackground);
m_topLabel->setAttribute(Qt::WA_TranslucentBackground);
m_topLabel->setPalette(QPalette());
m_topLabel->setStyleSheet("QLabel { color: palette(text); }");
m_topLabel->setParent(this); // Reparent the label to this widget
layout()->addWidget(m_topLabel);
The result as follows.
If we follow this, we have to check & update all of the VC widgets.
What do you think?
Without applying a theme, VCSlider top label font looks too light.(light gray color)
But the above code makes the font color black.
This is a quite complicated topic, since there are many variables involved:
What I found so far: OS colors can be retrieved via palette() like this:
m_topLabel->setStyleSheet(QString("QLabel{ background: %1; color: %2; }")
.arg(m_topLabel->palette().window().color().name())
.arg(m_topLabel->palette().windowText().color().name()));
however this doesn't consider enable/disable state and probably ignores user-defined colors.
VC items can be customized via style
VCSlider QLabel {
color: black;
background: red;
}
VCSlider QLabel:disabled {
color: gray;
}
But again, this ignores user-defined colors. There is no easy solution to this. I am still investigating
I've tried a bunch of ways to exclude the VC widgets from the QSS file (by manually selecting all the qWidgets excluding the vc widgets for each style) but it's super painful.
For now - my plan is to do what @mcallegari has suggested and theme the widgets individually.
We need to change the theme so it never interferes with the virtual console Because currently the theme file overrides the virtual console widgets and makes them look horrible.
The reason we need to fix this is because the user needs to be able to change the colours of things on the virtual console.