Hello all,
I am trying to capture a screenshot of my Application in a QPixmap and then save it to a QIODevice. But it's giving segmentation fault.
Not able to figure out why.
Here's the code-
ui.myLabel->setPixmap(pix); //This is fine. Displays the Screenshot
ui.myLabel->setScaledContents(true);
qDebug()<<"before";
pix.save(&buffer); //Gives SEGV Error
qDebug()<<"after";
buffer.close();
QPixmap pix = QPixmap::grabWindow(QApplication::desktop()->winId());
ui.myLabel->setPixmap(pix); //This is fine. Displays the Screenshot
ui.myLabel->setScaledContents(true);
QByteArray bArray;
QBuffer buffer(&bArray);
buffer.open(QIODevice::WriteOnly);
qDebug()<<"before";
pix.save(&buffer); //Gives SEGV Error
qDebug()<<"after";
buffer.close();
To copy to clipboard, switch view to plain text mode
Not able to figure out what the problem is.
Bookmarks