[Qt-interest] save widget snapshot in file

Brilliantov Kirill Vladimirovich brilliantov at byterg.ru
Thu Aug 18 10:07:27 CEST 2011


Hello!
I have to save snapshot from widget to file.
My function:
  void Image::make_snapshot()
{
	QString name = 
QDateTime::currentDateTime().toString(QString("yyyyMMddhhmmsszzz.jpg"));
	QPixmap img = QPixmap::grabWidget(this);
	if (!img.save(name))
		QMessageBox::warning(this, QString("JPEG snapshot"),QString(tr("Can't 
save snapshot in file %1").arg(name)),QMessageBox::Ok);
}

This is function work with static image, but not work with dynamic.

How can I solve this problem?
Thank you and excuse me for my bad english.





More information about the Qt-interest-old mailing list