Hi List !
I work on an Application that needs to draw specific device RGB colors
to multiple monitors on OSX 10.9 using Qt 5.3.2.
If i just draw a QColor(240,120,60) to a Widget, this is measured
exactly as 240/120/60 on the primary monitor but if i create the same
widget on a secondary monitor is is measured e.g. 240/117/51 .
OSX tries to be smart ant to make the color on the second screen appear
as the color on the primary screen. While this is nice its not usable
for my Application.
In former Qt / OSX versions we had this approach (c_ containg the
current RGB Values to be painted):
void RGBFrame::paintEvent(QPaintEvent* e)
{
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
float components[4] = { 1.0, 1.0, 1.0, 1.0 };
components[0] = ((float)c_.red() * 1000 / 255) / 1000;
components[1] = ((float)c_.green() * 1000 / 255) / 1000;
components[2] = ((float)c_.blue() * 1000 / 255) / 1000;
CGColorRef color = CGColorCreate (colorSpaceRef, components);
CGRect cgrect = CGRectMake(e->rect().x(), e->rect().y(), e->rect().x() +
e->rect().width(), e->rect().y() + e->rect().height());
CGContextRef context = qt_mac_cg_context(this);
CGContextSetFillColorWithColor(context, color);
CGContextFillRect(context, cgrect);
CGColorRelease(color);
CGColorSpaceRelease(colorSpaceRef);
}
i tried to upgrade this to Qt5 using QMac::currentCGContext() instead of
the no more available qt_mac_cg_context(this) but it simply does not work.
Do you guys have a working or even more elegant approach ?
Greetings & thank you,
Nils Heidorn
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest