#include #include #include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow window; window.setWindowTitle("Screen Capture Test"); window.resize(400, 300); window.show(); QScreenCapture screenCapture; QObject::connect(&screenCapture, &QScreenCapture::activeChanged, [&](bool active) { qDebug() << "Screen capture active:" << active; }); QObject::connect(&screenCapture, &QScreenCapture::errorOccurred, [&](QScreenCapture::Error error) { qWarning() << "Screen capture error:" << error; }); // Start screen capture after a short delay to ensure window is visible QTimer::singleShot(1000, [&]() { qDebug() << "Attempting to start screen capture..."; screenCapture.start(); }); return a.exec(); }