Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the text color of a QLabel?

I'm wondering how to get the text color of a specific QLabel. I'm setting text color earlier in my code an need to read it out again later to determine which action to take...

like image 885
user3100895 Avatar asked Oct 03 '22 04:10

user3100895


1 Answers

I think you can use:

QLabel::palette()

To get the palette of this widget. Once you have the palette I guess you could retrieve the color via:

ColorRole r = QPalette::Text;
const QBrush & QPalette::brush(r); 

Once you have the QBrush you can simply use:

const QColor & QBrush::color() const
like image 131
Kirell Avatar answered Oct 12 '22 23:10

Kirell