How to save the pixmap of QWidget without borders/ what is way we can save best quality image
-
wrote on 20 Jun 2017, 13:44 last edited by Qt Enthusiast
QPixmap * pixmap = new QPixMap(this->size())
this render(pixmap)
pixmap->save(fileName) -
wrote on 20 Jun 2017, 14:03 last edited by
Not sure what the question is...
QWidget::grab().save(fileName)
P.S.
Your code leaks memory -
Hi
What borders ?
a widget don't have borders unless you do not give it a parent and it becomes a window? -
Hi
What borders ?
a widget don't have borders unless you do not give it a parent and it becomes a window?wrote on 20 Jun 2017, 16:01 last edited by@mrjj borders means we are getting scrollbars
-
@mrjj borders means we are getting scrollbars
Well if the widget has scrollbar shown, then render will also show them.
You could disable the scrollbars. -
wrote on 21 Jun 2017, 14:11 last edited by Qt Enthusiast
I have QGraphicsView and scene() is QGraphicsscene
QRectF rect = scene()->sceneRect();
QImage img(rect.width(),rect.height(), QImage::Format_RGB32);
QPainter painter(&img);
render(&painter); // , QRechow to save the pixmap without scrollbars . is it possible to get the pixmap of canvas without scrollbars how to get width of witdh of vertical and horizonal scrollbar so that I can get only rectangle for Canvas without scrollbar
-
I have QGraphicsView and scene() is QGraphicsscene
QRectF rect = scene()->sceneRect();
QImage img(rect.width(),rect.height(), QImage::Format_RGB32);
QPainter painter(&img);
render(&painter); // , QRechow to save the pixmap without scrollbars . is it possible to get the pixmap of canvas without scrollbars how to get width of witdh of vertical and horizonal scrollbar so that I can get only rectangle for Canvas without scrollbar
wrote on 21 Jun 2017, 15:16 last edited by@Qt-Enthusiast said in How to save the pixmap of QWidget without borders:
how to get width of witdh of vertical and horizonal scrollbar so that I can get only rectangle for Canvas without scrollbar
verticalScrollBar()->width()
horizontalScrollBar()->width()
Of course you'll have to make sure they are visible first
-
wrote on 21 Jun 2017, 15:36 last edited by
how to do that
-
wrote on 21 Jun 2017, 15:36 last edited by Qt Enthusiast
what is way we can save best quality image
-
how to do that
wrote on 21 Jun 2017, 15:38 last edited by@Qt-Enthusiast isVisible function
7/10