Making screenshot of a primary screen on openSUSE 12.3, Qt 4.8.4[SOLVED]
-
Hello,
how to make a screenshot only of a primary screen?
-
Use QDesktopWidget::screen to get a widget of the screen in question. Create a QPixmap or a QImage, which ever one works for you. Then use QWidget::render to draw onto your image.
-
@auto const & primary_scr = QApplication::desktop()->screen(QApplication::desktop()->primaryScreen());
QImage screenshot_img(primary_screen->size(),QImage::Format_RGB32);
primary_scr->render(&screenshot_img);@Does not work. Empty image is made this way.
-
@auto const & primary_scr_raw_ptr = QApplication::desktop()->screen(QApplication::desktop()->primaryScreen());
QPixmap::grabWindow(primary_scr_raw_ptr->winId()).toImage();
@
works. -
However, when using virtual desktops it doesn't!