Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Save QWidget as image

Qt library is an excellent GUI library for C++ programmers developed by Nokia and now is an open source project. Often, we may use QPainter to draw strings, lines or images on a QWidget. We can override the QWidget's paintEvent() method when we want to use QPianter object to draw something on a QWidget.If we want to save the items drawn on QWidget as image for later reference, what can we do? We can save a QWidget as an image. Here is the code for achieving this:QPixmap pixmap(this->size());this->render(&pixmap);pixmap.save("test.png");Quite simple, right? Yes, these are all the code...

27,003 1       C++ IMAGE QT QWIDGET