Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
DrawTextItemDevice::metric: Invalid metric command on OS X
I get a lot of messages "DrawTextItemDevice::metric: Invalid metric command" when outputting static text.
I'm simply doing it like this (the painter was created in a QWidget with "QPainter painter(this);"):
painter.drawStaticText(pos.x, pos.y, text);
The call stack is the following:
(anonymous namespace)::DrawTextItemDevice::metric(QPaintDevice::PaintDeviceMetric) const
QPainter::setWorldTransform(QTransform const&, bool)
QPainter::setTransform(QTransform const&, bool)
QPainter::drawStaticText(QPointF const&, QStaticText const&)
QPainter::drawStaticText(int, int, QStaticText const&)
To me it seems that I can't fix this myself since in QPainterPrivate::effectiveDevicePixelRatio() there is a Mac-specific call to device->metric(QPaintDevice::PdmDevicePixelRatio)
Does anybody have any suggestions? Thanks for any help!
Hi and welcome to devnet,
What combination of OS X/Qt are you using ?
Did you check the "bug report system":http://bugreports.qt-project.org to see it if was something known ?
I'm using OS X 10.8.5 and Qt 5.2.0
Not only the Qt bug report system but also Google doesn't return this as a known issue.
Btw: outputting a string with painter.drawText(x, y, string) outputs no message.
Can you provide a minimal compilable example that shows the behavior ?
Fortunately the issue is reproducible with a very simple example:
The (unwanted) warning message output is located at line 570 of https://qt.gitorious.org/qt/qt/source/cf179ef3e38516555ce60517aa8e085b33e75744:src/gui/text/qstatictext.cpp
Confirmed, can you open a bug report "here":http://bugreports.qt-project.org with your example ?
Don't forget to post the link here
The issue can be tracked on on https://bugreports.qt-project.org/browse/QTBUG-36419