Important: Please read the Qt Code of Conduct -

Suggestion for capturing screen in full screen mode.

  • We need the suggestion for capturing screen in full screen mode.

    Following are the requirement we are trying to achieve :

    1. Application shall be in full screen mode – with no title bar. As it is full screen mode Windows task bar shall be not directly accessible.

    2. We need to capture the full screen mode screen as screenshot in one of the directory.
      We are using following code but actual screen is not captured. Instead, it captures white screen.

      QScreen *screen = QGuiApplication::primaryScreen();
              QPixmap pixMap = screen->grabWindow(0, 0,0,1920,1080);
      qDebug() << "Writing image to " << filename;
      QImage snapshot = pixMap.toImage();“C:\\test, nullptr, 100);

    In Maximized mode it is working.

    Any pointers for the same will be great help.

    Using a magic number of 0 for the WID is probably not a good idea. I would use the QWidget::winId function to get the ID.

    Is this a QWidget? You could use grab from that to get a pixmap as well.

Log in to reply