[Qt-interest] Howto grab window from X11 display other than applications display

Wilhelm wilhelm.meier at fh-kl.de
Wed May 25 16:44:46 CEST 2011


Am 25.05.2011 16:20, schrieb Bill Crocker:
> Wilhelm wrote:
>> Am 25.05.2011 13:00, schrieb venkat reddy:
>>> try below code
>>>
>>> QPixmap screenPixmap=QPixmap();
>>> QDesktopWidget* dektop=QApplication::desktop();
>>
>> this gets the display the application ist connected to.
>>
>> But I wanted e.g. localhost:1.0
>>
> 
> You will probably need to spawn a child process
> which connects (-display command line option)
> to this different display and then does the deed.

No, I want to avoid that. As I said before: I got it working stealing
the code from QPixmap_p and modifying it to my needs.

> 
> This from the QApplication class doc.
> 
>      The X11 version of Qt supports some traditional X11 command line options:
>          * -display display, sets the X display (default is $DISPLAY).
> 
> Bill
> 
>>> screenPixmap=QPixamp::grabWidget(dektop,dektop->rect());
>>>
>>>
>>> -- 
>>> Thanks&Regards,
>>> Venkat Reddy pasya
>>> Senior Software Engineer.
>>> Sling Media Pvt Ltd.
>>> Bangalore
>>> Ph: 9620418382
>>>
>>>
>>>
>>> On Wed, May 25, 2011 at 3:53 PM, Wilhelm <wilhelm.meier at fh-kl.de
>>> <mailto:wilhelm.meier at fh-kl.de>> wrote:
>>>
>>>     Am 25.05.2011 00:27, schrieb Andreas Pakulat:
>>>     > On 24.05.11 21:03:02, Wilhelm wrote:
>>>     >> Hi,
>>>     >>
>>>     >> with QPixmap::grabWindow() i can grab the contents of windows on the
>>>     >> applications display, say localhost:0.0.
>>>     >>
>>>     >> How can my application (connected to localhost:0.0) grab windows from
>>>     >> another display e.g. localhost:1.0 ?
>>>     >>
>>>     >> I tried to use the code of QPixmap but with no luck due to the
>>>     private
>>>     >> headers in Qt.
>>>     >
>>>     > No idea wether X11 allows this at all, but you'll have to dive
>>>     into the
>>>     > X11 api to do this anyway. Qt does not have any way to do this.
>>>
>>>     Ok, thank you.
>>>     Now got it working using the conversion code from QPixmap_p and
>>>     XGetImage().
>>>
>>>     >
>>>     > Andreas
>>>     >
>>>     > _______________________________________________
>>>     > Qt-interest mailing list
>>>     > Qt-interest at qt.nokia.com <mailto:Qt-interest at qt.nokia.com>
>>>     > http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>>
>>>
>>>     --
>>>     Wilhelm
>>>
>>>     _______________________________________________
>>>     Qt-interest mailing list
>>>     Qt-interest at qt.nokia.com <mailto:Qt-interest at qt.nokia.com>
>>>     http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>>
>>>
>>>
>>>
>>
>>
> 
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest


-- 
Wilhelm




More information about the Qt-interest-old mailing list