ウィジェットのスクリーンショットを Qt に保存したいと考えています。動作するはずの次のコードを作成しました。
QWidget* activeWidget = getActiveWidget();//a function that returns the current widget.
if (activeWidget == NULL)
{
return;
}
QPixmap screenshot;
screenshot = QPixmap::grabWidget(activeWidget,activeWidget->rect());
if(screenshot.isNull()){
printf("ERROR");
}
bool a= screenshot.save("c:\\temp\\asd.jpg", "JPG", 50);
しかし、残念ながらこれはうまくいかないようです。誰が問題が何であるか知っていますか?