You are not logged in.

#1 2020-07-27 09:32:56

firewalker
Member
From: Hellas (Greece).
Registered: 2006-06-05
Posts: 481

Qt screenshot with multiple monitors

I have a problem with a program using Qt to screenshot. In order to try and solve it my self, I had a look to the screenshot example:

https://doc.qt.io/qt-5/qtwidgets-deskto … ample.html

Downloading and compiling the program, it works but only for the individual screens. In another post

https://forum.qt.io/topic/65813/screens … ry-monitor

I saw that the line (screenshot.cpp line 170)

 screen->grabWindow(0);

Should be change to

originalPixmap = screen->grabWindow(0, screen->geometry().x(), screen->geometry().y(), screen->size().width(), screen->size().height());

With this change when the program is moved to the secondary monitor; captures it just fine.

VrzobmHs.png

When moved to the primary monitor it just capture only a part of the screen and not the entire two monitors. The produced image has the dimensions of the primary monitor.

sVDTe2Us.png

Exactly the same issue I have with the software I need to use.

This is my monitor configuration:

LPneEcOs.png

And this is my entire desktop capture with KDE Spectacle.

DOCmdrGs.jpg

What could be the issue?


Γίνε ρεαλιστής, μείνε ονειροπόλος ...

Offline

#2 2020-07-27 19:13:21

koffeinfriedhof
Member
Registered: 2017-11-30
Posts: 56

Re: Qt screenshot with multiple monitors

Hi! I cannot see the images, but I think you should use the virtualSize on a multi-monitor setup.

You can try it using the qDebug-Output to get the different values using any Gui-Application.

#include <QDebug>
#include <QScreen>
// … anywhere in your code place
QScreen *screen = QGuiApplication::primaryScreen();
qDebug() << "Geo:" << screen->geometry()
              << ":Size:" << screen->size()
              << ":VSize:" << screen->virtualSize();

Offline

#3 2020-07-27 20:55:44

firewalker
Member
From: Hellas (Greece).
Registered: 2006-06-05
Posts: 481

Re: Qt screenshot with multiple monitors

koffeinfriedhof wrote:

Hi! I cannot see the images, but I think you should use the virtualSize on a multi-monitor setup.

You can try it using the qDebug-Output to get the different values using any Gui-Application.

#include <QDebug>
#include <QScreen>
// … anywhere in your code place
QScreen *screen = QGuiApplication::primaryScreen();
qDebug() << "Geo:" << screen->geometry()
              << ":Size:" << screen->size()
              << ":VSize:" << screen->virtualSize();

Thanks you!!!


Γίνε ρεαλιστής, μείνε ονειροπόλος ...

Offline

Board footer

Powered by FluxBB