Hi, im on Linux, and Im trying to save a screenshot.
I read that QPixmap::grabWindow() is deprecated, and that I should use QScreen::grabWindow() instead.
So I did.
The problem is: The image is not being saved right, and does not show up the correct part of screen (only 4 parts of screen, upside down and in all kind of ways).

This ma code.
Qt Code:
  1. void Widget::on_pushButton_clicked()
  2. {
  3. QScreen *QSCREEN = QGuiApplication::primaryScreen();
  4. QPixmap qpix = QSCREEN->grabWindow(this->winId(), 0, 0, QApplication::desktop()->width(),
  5. QApplication::desktop()->height());
  6. qpix.save("/home/marcus/Bilder/Hello.png");
  7. }
To copy to clipboard, switch view to plain text mode