Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.5.1
-
None
-
openSUSE Tumbleweed, Plasma 5.5.3, Qt 5.5.1
ATI Radeon 7850
Description
Given the following RandR setup:
- Screen 0 - 1680x1050, right of
- Screen 1 - 1280x1024,
QDesktopWidget::screenNumber always returns screen 1 during startup,
even if it is started on screen 0.
This behavior already existed with KDE 4, and it persists with Plasma 5.5.3 and Qt 5.5.1. The reason I noticed it is that the KDE feature to restore window sizes on startup seems to depend on that screenNumber call during application startup as well - and it does not work screen 0.
In the attached test program, the following method is called both in the main window constructor and manually through a button:
void MainWindow::logCurrentScreenInfo() { const int scnum = QApplication::desktop()->screenNumber(window()); QRect desk = QApplication::desktop()->screenGeometry(scnum); qDebug() << "Screen #" << scnum << ",\nDesktop=" << desk << ",\nWindow=" << window()->pos() << " " << window()->geometry(); }
MainWindow constructor:
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); qDebug() << "Screen info during main window construction:\n"; logCurrentScreenInfo(); }
When I start the attached project in QtCreator on screen #0, the output looks like the following:
Screen info during main window construction: Screen # 1 , Desktop= QRect(0,0 1280x1024) , Window= QPoint(0,0) QRect(0,0 258x96) Screen info on button click: Screen # 0 , Desktop= QRect(1280,0 1680x1050) , Window= QPoint(2625,0) QRect(2629,29 258x96)
When I launch the program on screen #1, the output is as expected (screen 1 is returned from both calls).
I don't know if the Qt behavior is expected and the issue is with KDE (or KWin), or if this behaviour is indeed a bug that should be fixed.
Attachments
Issue Links
- relates to
-
QTBUG-62094 Investigate usefulness of QDesktopWidget::screenNumber API and the QDesktopWidget in general.
- Closed