[SailfishDevel] Please help me, how to get the screen capture without block UI

Raine Mäkeläinen raine.makelainen at jolla.com
Fri Feb 14 09:25:08 UTC 2014


Hi,

If you want to capture something on your application side, you can grab whole window through QQuickItem. This part is blocking but you can do capture manipulations in async manner quite simple by using QFutureWatcher.

Like:

void ScreenShow::screenShot(QQuickItem *item)
{
    if (item && item->window()) {
        // Blocks for a short moment
        QImage image = item->window()->grabWindow();
        // Could be done in later
        image.save("/home/nemo/Pictures/iface.png")
    }
}

-Raine

________________________________
Lähettäjä: devel-bounces at lists.sailfishos.org [devel-bounces at lists.sailfishos.org] käyttäjän itviewer [itviewer at jolladev.net] puolesta
Lähetetty: 14. helmikuuta 2014 9:19
Vastaanottaja: devel
Aihe: [SailfishDevel] Please help me, how to get the screen capture without block UI

Dear ,
attachment is all my code,and I have been tried many times
but it still block the UI(about 3 seconds)  when the program starts ( or after click  the label“Hello Sailors”)
While, it seems that there is no such blocking when using the harbor store app "screenshot".

Very grateful,thanks everybody。
________________________________
ma xinjun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140214/a27fdccf/attachment.html>


More information about the Devel mailing list