textBrowser - setEnabled problem
Seems like setEnabled isn't working when text color for textBrowser is changed.
ui->textBrowser->setTextColor(QColor("#45EEFE")); ui->textBrowser->setText("Some text"); ui->textBrowser->setEnabled(false);
If I don't change the color then it works fine.
Am I missing something ?
Hi and welcome to devnet,
What are you expecting from setEnabled ?
What are you currently getting ?
With which version of Qt ?
On which platform ?
Hi, sorry if I wasn't clear enough.
setEnabled actually works as it should (not visually), for example if you setEnabled(false) for a pushbutton you wouldn't be able to click it, but the same thing happens with pushbutton as with textBrowser if you change the color :
ui->pushButton->setStyleSheet("color: rgb(255, 0, 0)");
I guess this happens with any widget, what happens is that the color of a widget stays the same and it should be grayed out, like it does when you don't change a color, basically that's the problem.
Qt is 5.9 on linux.
I think you're stating that without an explicit color disabled changes color, but once a color is specified explicitly it does not. Explicit color overrides default behaviour. To get the "dimming" I believe you have to now choose a dimmed color and attach via something like
QPushButton:disabled(or however you specify that property in stylesheet?), or set dimmed color explicitly in code on disablement.
@kajzer you need to adjust your StyleSheet for the textbrowser, something like this:
This works, thanks!