Avoid Mouse pointer flicker while taking screenshot of the entire screen

  • hello ,

    I am using the below mentioned method to take screenshot of my screen and as the process is continuous the mouse pointer keeps on flickering, is there any alternative method using which i can take screenshot without causing the mouse pointer to flicker,

    Code snipppet used in our case
    QImage qimg(QGuiApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId()).toImage());

    Please suggest any alternative method if possible

  • Qt Champions 2017

    Hi and welcome
    Have you checked if the sample
    also flickers with mouse?

  • @mrjj hello, thank you for the link, but i have implemented the given example before, the flickering of mouse pointer is still there,

    This issue occurs on windows OS as i am taking continous screenshots of the desktop

  • Hi @jash156 ,
    Try this,
    QPixmap screenshot;
    screenshot = QPixmap::grabWindow(QApplication::desktop()->winId()) ;

  • This post is deleted!

  • @Ni.Sumi I tired the method provided by u as well, the issue occurs due to taking screenshot in milliseconds continuously in a loop, can u suggest something for that

  • Hi @jash156 ,

    usually, QPixmap::grabWindow does not take cursor or some flickering(as per documentation).

    Are you using QgraphicsView or a normal widget like Qdialog /QWidget?
    If possible, could you please share code here. so that its easy to find out.

  • hello @Ni.Sumi ,

    I am just using the method mentioned by you using a QWidget and sending then sending the screenshot in jpg format over network

    and for the code, it is just the first example you gave which i run in a while loop to get continuous screenshot.

  • Qt Champions 2017

    Hi if you only take picture of you own window, then maybe call
    setCursor( QCursor( Qt::BlankCursor ) );
    to hide it while sending ?

  • From what i know.
    Just paint another mouse pointer

    I think windows OS hides the mouse while taking a capture.
    It is something internal.

    Only option i see is to paint another mouse pointer that Windows will not hide while making the capture call.

    Just make a fast check... keep pressing "imp pant" key and look... it is the same effect.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.