Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QScreen on Windows returns empty manufacturer and model string
Forum Updated to NodeBB v4.3 + New Features

QScreen on Windows returns empty manufacturer and model string

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qDebug
    wrote on last edited by qDebug
    #1

    Hey guys!

    I'm susing Qt 5.10.1 on Win and VS2013.

    QList<QScreen *> screens = QGuiApplication::screens();
    foreach(QScreen *screenInfo, screens)
    {
        qDebug() << "name: " << screenInfo->name();
        qDebug() << "geometry: " << screenInfo->geometry();
        qDebug() << "refreshRate: " << screenInfo->refreshRate();
        qDebug() << "manufacturer: " << screenInfo->manufacturer();
        qDebug() << "size: " << screenInfo->size().width() << screenInfo->size().height();
        qDebug() << "model: " << screenInfo->model();
    }
    

    The code above returns:

    name:  "\\\\.\\DISPLAY1"
    geometry:  QRect(0,0 3840x2160)
    refreshRate:  60
    manufacturer:  ""
    size:  3840 2160
    model:  ""
    
    name:  "\\\\.\\DISPLAY2"
    geometry:  QRect(3840,0 1280x800)
    refreshRate:  60
    manufacturer:  ""
    size:  1280 800
    model:  ""
    

    First screen is my Monitor and second one is a small projector from LG.

    I'd like to include the hardware name like "LG Projector" or "SAMSUNG ..." as well because it is more meaningful to a human. Sure, i can include the Windows.h and the dada but that is not really the point using Qt and platform independent code.

    Am i doing something wrong?

    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From a quick look at Qt's sources, it's currently not available on Windows. But if you know the API to use to get that information, you could consider improving the Windows QPA to add support for it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        ...or at least create a bug report with the appropriate calls :)

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2
        • Q Offline
          Q Offline
          qDebug
          wrote on last edited by
          #4

          Well you can do

          DISPLAY_DEVICE dd;
          dd.cb = sizeof(DISPLAY_DEVICE);
          
          DWORD deviceNum = 0;
          while(EnumDisplayDevices(NULL, deviceNum, &dd, 0) )
          {
              // qDebug() << "display: " << QString::fromWCharArray(dd.DeviceName)<< QString::fromWCharArray(dd.DeviceString);
          
              DISPLAY_DEVICE ddmon = {0};
              ddmon.cb = sizeof(DISPLAY_DEVICE);
              DWORD monitorNum = 0;
              while(EnumDisplayDevices(dd.DeviceName, monitorNum, &ddmon, 0))
              {
                  qDebug() << "monitor: " << QString::fromWCharArray(ddmon.DeviceName) << QString::fromWCharArray(ddmon.DeviceString);
          
                  monitorNum++;
              }
              deviceNum++;
          }
          

          But the result is not perfect. The code above returns

          monitor:  "\\\\.\\DISPLAY1\\Monitor0" "Generic PnP Monitor"
          monitor:  "\\\\.\\DISPLAY2\\Monitor0" "Generic PnP Monitor"
          

          Since "Generic PnP Monitor" is not the results i'm looking for i guess there is not much i can do for now. I guess display1, display2 will do for now.

          M 1 Reply Last reply
          2
          • Q qDebug

            Well you can do

            DISPLAY_DEVICE dd;
            dd.cb = sizeof(DISPLAY_DEVICE);
            
            DWORD deviceNum = 0;
            while(EnumDisplayDevices(NULL, deviceNum, &dd, 0) )
            {
                // qDebug() << "display: " << QString::fromWCharArray(dd.DeviceName)<< QString::fromWCharArray(dd.DeviceString);
            
                DISPLAY_DEVICE ddmon = {0};
                ddmon.cb = sizeof(DISPLAY_DEVICE);
                DWORD monitorNum = 0;
                while(EnumDisplayDevices(dd.DeviceName, monitorNum, &ddmon, 0))
                {
                    qDebug() << "monitor: " << QString::fromWCharArray(ddmon.DeviceName) << QString::fromWCharArray(ddmon.DeviceString);
            
                    monitorNum++;
                }
                deviceNum++;
            }
            

            But the result is not perfect. The code above returns

            monitor:  "\\\\.\\DISPLAY1\\Monitor0" "Generic PnP Monitor"
            monitor:  "\\\\.\\DISPLAY2\\Monitor0" "Generic PnP Monitor"
            

            Since "Generic PnP Monitor" is not the results i'm looking for i guess there is not much i can do for now. I guess display1, display2 will do for now.

            M Offline
            M Offline
            maxigsilva
            wrote on last edited by
            #5

            @qDebug Hi! It’s okay for me, i can use this but how can I get this information with python? Do you have any idea? Thanks in advance.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved