Qt-interest Archive, August 2007
Re: Dual Monitor Screenshot
Message 1 in thread
On 7/31/07, Dutton, Sam <Sam.Dutton@xxxxxxxxx> wrote:
>
> In Qt4, take a look at the examples\desktop\screenshot example.
>
> Screenshot of the desktop containing the focus widget, in Qt 3 or 4:
>
> QPixmap pixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
>
> You should be able to use QDesktopWidget::primaryScreen (), QDesktopWidget::screen (), QDesktopWidget::isVirtualDesktop() and QDesktopWidget::numScreens() to do what you want.
>
> You can grab a widget with QPixmap::grabWidget().
>
> I think the naming is a bit confusing, given that grabWindow gets a pixmap of a screen/desktop, not a window: it should be grabDesktop or screenGrab or whatever (or am I missing something?)
I don't think it would make sense to rename QPixmap::grabWindow() at
all. It does primarily get images of individual windows. The fact that
the full desktop can be seen as a window is an exception, not the
rule.
--
[ signature omitted ]
Message 2 in thread
On 7/31/07, Dutton, Sam <Sam.Dutton@xxxxxxxxx> wrote:
> I think the naming is a bit confusing, given that grabWindow gets a pixmap of a screen/desktop, not a window: it should be grabDesktop or screenGrab or whatever (or am I missing something?)
grabWindow() gets a pixmap of anything represented by an X11 Window
object, grabWidget() can only grab things that are QWidgets. For
example you can use grabWindow() to take a picture of windows from
other applications.
Rich.
--
[ signature omitted ]