Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to Qt Screen Capture using GrabWindow

How to Qt Screen Capture using GrabWindow

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt_Bg
    wrote on last edited by
    #1

    Hi,

    I am new to qt and programming world and please help me with this problem. I am runnign Qt on VxWorks and trying to capture Qt Window screen using grabWindow.

    below is the function that I used. When I run, it prints the debug msg but does not generate any files.
    Please correct me if I made any mistake.

    Also how to I change the path where the file is saved?

    @void ScanControlInterface::TopDisplay_Capture( )
    {
    QPixmap capture = QPixmap::grabWindow(QApplication::desktop()->winId(),0,0,QApplication::desktop()->width(),QApplication::desktop()->height());
    QByteArray ptrImgRawData;
    ptrImgRawData.clear();
    QBuffer buffer(&ptrImgRawData);
    buffer.open(QIODevice::WriteOnly);
    capture.save(&buffer,"PNG");

    qDebug ("ScanControlInterface::Screen captured");
    

    }@

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved