I draw something like line, arc ,eclipse etc on QPaiter ,NOw I want to save them in an image.But how to do it? can anybody help me ?
I draw something like line, arc ,eclipse etc on QPaiter ,NOw I want to save them in an image.But how to do it? can anybody help me ?
You will need to specify the paint device for the QPainter
Something like
Qt Code:
.... .... //Your drawing code .... pm.save(filename,format);To copy to clipboard, switch view to plain text mode
Mithin
www.mithin.in
thanks for reply soon. YES, what you said can pait them to an image .but there comes another problem, which will not show on paiter widget . I Want to show them on a widget, but at the same ,i can save to an image file.
why QPAINTER not provide the save function ? just like delphi TCANVAS ?
QPainter can paint on a single QPaintDevice at time. You can use QPainter::setRedirected() to redirect the painting to another device. But maybe QPixmap::grabWidget() is more like what you're after?
J-P Nurmi
Bookmarks