Hello,

there's a need for each thread to make screenshots and to compare them with
loaded picture using QImage.
Since there's only on GUI thread, I moved the the thread context to the
main thread to make the screenshot in there.

Here's the code snipper from the worker-threads:

       QPixmap screenshot;

    try

    {

        auto const this_thread = this->thread();

        moveToThread(QApplication::instance()->thread());

        screenshot = QPixmap::grabWindow( QApplication::desktop()->winId() );

        moveToThread(this_thread);

        screenshots.append(screenshot);

        // Compare it with the trigger if there was no match before.

        if ( !matched && event_p && event_p->get_trigger_path().size()
&& images_comparator::cmp( screenshot.toImage(), QImage(
event_p->get_trigger_path() ), pattern() ) )

        {

            qDebug() << "!!! matched !!!";

            matched = true;


However, the grabWindow returns null QPixmap always.

Who knows how to achive what's needed here?
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to