Take a screenshot of current monitor



  • I have three monitors and when I start my QT application, it starts on the monitor where the mouse cursor is in. Is there a way to specify the monitor number when taking a screenshot with QScreen::grabWindow() (on QT5)?
    I tried this but it does not work (the taken screenshot is always of the primary monitor).
    @
    QDesktopWidget* desktop = QApplication::desktop();
    QPixmap screenShot;
    QScreen* myScreen = QApplication::screens()[desktop->screenNumber(m_mainAreaWidget)];

    if (myScreen)
    {
    screenShot = myScreen->grabWindow(desktop->screen(desktop->screenNumber(m_mainAreaWidget))->winId());
    }@



  • Which OS to you use?



  • Windows 7, with Visual studio 2013.


Log in to reply
 

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