I'm trying to read the color of a window's border (frame) of a regular window.
It seems that window->palette().color(QPalette::XXXX) would do it, but what's XXXX? or is it not possible with palette? If so, how?
You need to use it the native GetSysColorBrush function:
QColor getWindowFrameColor() {
// This is the only way to detect that a given color is supported
HBRUSH brush = GetSysColorBrush(COLOR_ACTIVEBORDER);
if (brush) {
DWORD color = GetSysColor(COLOR_ACTIVEBORDER);
return QColor(GetRValue(color), GetGValue(color), GetBValue(color));
// calling DeleteObject(brush) is unnecessary, but would be harmless
}
return QColor();
}
I've searched the Qt sources for COLOR_ACTIVEBORDER, and the only other way to retrieve it would be by running some custom javascript code on WebKit.
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