Take a screenshot of current monitor
General and Desktop
3
Posts
2
Posters
1.1k
Views
1
Watching
-
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());
}@