Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.4.0
Description
User wanted to raise possible issue points with QScreen::name() update on Qt 6.4:
From the latest official 6.4 release note (https://code.qt.io/cgit/qt/qtreleasenotes.git/about/qt/6.4.0/release-note.md) it was mentioned:
"e9fd1c6aab QScreen_win: retrieve user friendly monitor name
QScreen::name() now returns the user friendly name instead of the GDI
device name on Windows. This is consistent with other platforms and also
obeys the documentation."
I'm confident that such a change will break many applications that rely on that "name" to be unique so that one is able correlate a QScreen with other API like "Winuser::EnumDisplayDevices".
The problem is that currently there isn't a single unique identifier in QScreen because in a multiple-screen setup all screens can be identical, and have the same model, manufacturer, resolution etc. so the name was the only way to bridge different APIS.
I'm my current setup for example, I get this:
BOOL enum_result = TRUE; for (int device_index = 0;; ++device_index) { DISPLAY_DEVICEW device; device.cb = sizeof(device); enum_result = EnumDisplayDevicesW(NULL, device_index, &device, 0); // `enum_result` is 0 if we have enumerated all devices. if (!enum_result) { break; } // We only care about active displays. if (!(device.StateFlags & DISPLAY_DEVICE_ACTIVE)) { continue; } const auto name = QString::fromWCharArray(device.DeviceName); const auto dstring = QString::fromWCharArray(device.DeviceString); const auto id = QString::fromWCharArray(device.DeviceID); const auto key = QString::fromWCharArray(device.DeviceKey); qDebug() << "DISPLAY" << device_index << name << dstring << id << key; } for (int i = 0; i < qApp->screens().count(); ++i) { auto const screen = d->m_availableScreens[i]; qDebug() << "SCREEN" << i << screen->name() << screen->serialNumber() << screen->model() << screen->manufacturer(); } DISPLAY 0 "\\\\.\\DISPLAY1" "Intel(R) UHD Graphics 630" "PCI\\VEN_8086&DEV_3E9B&SUBSYS_09051028&REV_02" "\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\{1F8A6638-777F-11EC-A310-CD886247916D}\\0000" DISPLAY 1 "\\\\.\\DISPLAY2" "Intel(R) UHD Graphics 630" "PCI\\VEN_8086&DEV_3E9B&SUBSYS_09051028&REV_02" "\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\{1F8A6638-777F-11EC-A310-CD886247916D}\\0001" DISPLAY 2 "\\\\.\\DISPLAY3" "Intel(R) UHD Graphics 630" "PCI\\VEN_8086&DEV_3E9B&SUBSYS_09051028&REV_02" "\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\{1F8A6638-777F-11EC-A310-CD886247916D}\\0002" SCREEN 0 "LG HDR 4K" "" "" "" SCREEN 1 "\\\\.\\DISPLAY1" "" "" "" SCREEN 2 "DELL P2418HT" "" "" ""
See how no QScreen property can be used to find a relationship with the Windows API.
In my specific case, I need this unique identifier because it's the only way to match a QScreen with WEBRTC sources.