void ScreenShotPage::takeScreenshot()
{
    QPixmap screenshot;

    screenshot = QPixmap::grabWindow(scene()->views().at(0)->effectiveWinId());

    QString path;

    if (QDir(ImagesPath).exists())
        path = ImagesPath;
    else
        path = QDir::homePath();

    QString fileFormat(QString("%1/%2-%3.png").arg(path).arg(QDate::currentDate().toString("yyyyMMdd")).arg(QTime::currentTime().toString("hhmmss")));

    if (!screenshot.save(fileFormat))
        mWarning("MWindow") << "Could not save screenshot to" << path;

    playScreenshotEffect();

    MBanner * bannerPath = new MBanner();
    bannerPath->setObjectName("pathBanner");
    bannerPath->setStyleName("InformationBanner");
    bannerPath->setTitle("Screenshot has been saved in: " + fileFormat);
    bannerPath->appear(scene(), MSceneWindow::DestroyWhenDone);
}
Esempio n. 2
0
void AppWindow::showMessage(QString msg, int timeout)
{
	Q_UNUSED(timeout);

	MBanner *infoBanner = new MBanner();
	infoBanner->setStyleName("ShortEventBanner");
	infoBanner->setTitle(msg);
	infoBanner->appear(this, MSceneWindow::DestroyWhenDone);
	// Не работает, делается через CSS для #ShortEventBanner
	//infoBanner->style()->setProperty("disappear-timeout", 100);
}