Skip to content

Instantly share code, notes, and snippets.

@the-nose-knows
Created February 8, 2018 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-nose-knows/45f872e5a4809657523270e2429a615e to your computer and use it in GitHub Desktop.
Save the-nose-knows/45f872e5a4809657523270e2429a615e to your computer and use it in GitHub Desktop.
#include <QGuiApplication>
#include <QScreen>
#include <Qpixmap>
#include <QDebug>
int main(int argc, char *argv[])
{
QGuiApplication a(argc, argv);
QList<QScreen *> screens = QGuiApplication::screens();
QList<QPixmap> pixmapsList;
for (int i=0; i<screens.size(); i++)
{
pixmapsList.push_back(screens[i]->grabWindow(0));
}
for (int i=0; i<pixmapsList.size(); i++)
{
qDebug()<< "Screen" << i << ":";
qDebug()<< "height:" << pixmapsList[i].height();
qDebug()<< "width:" <<pixmapsList[i].width();
qDebug()<< "rect:" <<pixmapsList[i].rect();
qDebug()<< "size:" <<pixmapsList[i].size();
qDebug()<< "cacheKey:" <<pixmapsList[i].cacheKey();
qDebug()<< "depth:" <<pixmapsList[i].depth();
qDebug()<< "isQBitmap:" <<pixmapsList[i].isQBitmap();
qDebug()<< "isNull:" <<pixmapsList[i].isNull();
qDebug()<< "defaultDepth:" <<pixmapsList[i].defaultDepth();
qDebug()<< "";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment