[Qt-interest] Problem/possible bug in QDesktopWidget

simion ploscariu simion314 at gmail.com
Thu Oct 21 14:07:19 CEST 2010


I have installed tha latest SDK (2010.5) on aWindows XP SP3, i want to
get a screenshot of the desktop but i have problems on multimonitor
situation with virtual desktop. I always get the image with the first
screen. See here more details
http://stackoverflow.com/questions/3966429/capture-multiple-screens-desktop-image-using-qt4

I investigated more and runing this code

QDesktopWidget* desktop=QApplication::desktop();
    QWidget *screen1=desktop->screen(0);
    QWidget *screen2=desktop->screen(1);
    QRect deskGeometry=desktop->geometry();
    QRect scr1Geometry=screen1->geometry();
    QRect scr2Geometry=screen2->geometry();

    qDebug()<<"Desktop Id "<<desktop->winId()<<" geometry "<<deskGeometry<<"\n";
     qDebug()<<"screen1 Id "<<screen1->winId()<<" geometry
"<<scr1Geometry<<"\n";
     qDebug()<<"Desktop Id "<<screen2->winId()<<" geometry
"<<scr2Geometry<<"\n";

I get this

Desktop Id  0x10014  geometry  QRect(0,0 3200x1080)

screen1 Id  0x10014  geometry  QRect(0,0 3200x1080)

Desktop Id  0x10014  geometry  QRect(0,0 3200x1080)


This is strange i get an image of the first screen only but the
geometry contains the entire virtual desktop.   IF someone can run
this code on a XP with dual monitors oranu other Windows i wuld like
to know the result.
I think this is a bug, should i report it? Will Qt sport Windows XP in
the future?

P.S. i am notw tring to find other way to get the geometry of the each
screen, i managed to grab a image with all the virtual desktop, i will
have to save it in a temp file and load it from there in a QPixmap.



More information about the Qt-interest-old mailing list