mapToGlobal, wrong values with Linux
Unsolved
Qt 6
-
So I created a simple stupid program that creates a main window and prints out the mapToGlobal values, the MainWindow snipit:
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_testPushButton_clicked() { qDebug() << "MainWindow mapToGlobal" << this->mapToGlobal(QPoint(0,0)); }
On Windows and macOS this works perfectly. On a fresh install of Ubuntu 22.04 I move the window around the screen and get values like:
14:48:08: Debugging /home/user/projects/test/build/test ... MainWindow mapToGlobal QPoint(12,120) MainWindow mapToGlobal QPoint(180,1800) MainWindow mapToGlobal QPoint(552,5520) MainWindow mapToGlobal QPoint(654,6540) MainWindow mapToGlobal QPoint(831,8310) MainWindow mapToGlobal QPoint(900,9000) MainWindow mapToGlobal QPoint(1002,10020)
Just so you know, the display resolution is 2048x1280.
Has anyone else experienced this ?
-
-
What is the value of
this->pos()
at the same time you callmapToGlobal(QPoint(0,0))
? I woud think it should be close but will differ slightly since I think pos() includes the Window frame when reporting the position when the widget is a window. -
-
-
@Asperamanca said in mapToGlobal, wrong values with Linux:
Yup that looks like it.