简体   繁体   English

在没有一个特定程序窗口的情况下截取屏幕截图

[英]take screenshot without one specific program window

I need to take a regular screenshot but i need for a way to disregard an open application. 我需要定期截图,但我需要一种忽略打开的应用程序的方法。 In the screenshot must appear the regular background as if the application/window wasn't open. 屏幕截图中必须显示常规背景,就像未打开应用程序/窗口一样。

In other words, i need one screenshot without an window/aplication (which is presemnt) but appearing what is behind of this window/aplication, disregarding the window/ap. 换句话说,我需要一个没有窗口/复制的屏幕快照(预设),但忽略了窗口/ ap,却显示了该窗口/复制后面的内容。

For get screenshot i have the folowing code in QT/c++: 要获取屏幕截图,我在QT / c ++中具有以下代码:

(...)
QScreen *screen = QGuiApplication::primaryScreen();

QPixmap qPImage = screen->grabWindow(0);

QImage qImg = qPImage.toImage();//convert to qImage

(...)

It is possible do what i need? 有可能我需要什么?

Regards Alex 问候亚历克斯

May be not the perfect solution, but this is what I did in the exact same situation: 可能不是完美的解决方案,但这是我在完全相同的情况下所做的事情:

void MainWindow::onUpdateClicked()
{
    hide();
    QTimer::singleShot(45, this, SLOT(updateScreenshotPicture()));
}

void MainWindow::updateScreenshotPicture()
{
    screenshotBorders->setPic(QPixmap::grabWindow(QApplication::desktop()->winId()));
    show();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM