1

I am using the following code to take screenshot in a Nokia device using Qt

QDesktopWidget *w = QApplication::desktop();
if (w)
{
        QRect r = w->screenGeometry();
        originalPixmap = QPixmap::grabWindow(w->winId(),0,0,r.width(), r.height());

}
originalPixmap.save(folder_path, format.toAscii().constData());

The code is working fine for portrait orientation. When I tilt the device to landscape, the captured image contains only half the width of the screen. Please help. Thanks in advance.

Naveen Ramanathan
  • 2,166
  • 1
  • 19
  • 21

1 Answers1

0

If you want to grab the whole window anyway, have you tried just using originalPixmap = QPixmap::grabWindow(w->winId())? Leaving out the size parameters should use the size of the whole window automatically.

Steffen
  • 2,888
  • 19
  • 19