jimbo
18th May 2015, 17:41
Hello,
Linux - Qt 4.8.2
I've an array of QPushButtons, I can change the text colour of a button (no problems).
In my program I have a 'GO' QPushbutton that takes a different action, depending on the text
colour of the buttons in the array.
I can't find a way to determine the button text colour.
if (eeButtons[3]->foregroundRole() == Qt::red) {
qDebug() << "RED";
}This compiles but does nothing, What should I put between the () in foregroundRole()?
I've found this.
QString test = eeButtons[3]->styleSheet();
qDebug() << test.toAscii().data();
output:-
* { color: rgb(255, 0, 0) } //red
This is probably the wrong approach. (Suggestions please)
I can get it working, by setting flags on colour changes (just a bit fiddly).
Regards
Linux - Qt 4.8.2
I've an array of QPushButtons, I can change the text colour of a button (no problems).
In my program I have a 'GO' QPushbutton that takes a different action, depending on the text
colour of the buttons in the array.
I can't find a way to determine the button text colour.
if (eeButtons[3]->foregroundRole() == Qt::red) {
qDebug() << "RED";
}This compiles but does nothing, What should I put between the () in foregroundRole()?
I've found this.
QString test = eeButtons[3]->styleSheet();
qDebug() << test.toAscii().data();
output:-
* { color: rgb(255, 0, 0) } //red
This is probably the wrong approach. (Suggestions please)
I can get it working, by setting flags on colour changes (just a bit fiddly).
Regards