How to get the geometry of the screen on which the app is started
-
Hi,
#include "mainwindow.h" #include <QDebug> #include <QScreen> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { qDebug() << screen()->availableGeometry(); resize(screen()->availableGeometry().width() * 2/3, screen()->availableGeometry().height() * 2/3); move((screen()->availableGeometry().width() - width()) / 2, (screen()->availableGeometry().height() - height()) / 2); } MainWindow::~MainWindow() {}
When I start the app on the external monitor, I get the geometry of the notebook display.
How do I get the geometry of the screen on which the app is started?Setup is Arch, Wayland, and KDE on a notebook(FullHD, secondary) with an external monitor(QHD, primary display)
Thanks
-
Is QGuiApplication::primaryScreen() useful?