Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get DC from QPainter in windows?
qingyun last edited by
I have a very very strange question, it is very urgent, hope anybody can help me!
I want to get a native DC from QPainter. I tried like this:
QPaintEngine* pe = painter.paintEngine();
HDC dc = pe->getDC();
This works fine if this painter is from a widget, like:
QPainter painter(this); //"this" is widget
But my painter is from a QPixmap:
QPixmap pix(w, h);
This always fails!!! The DC in paintEngine() is always 0!
Can anybody help me?