Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-120325

QScreen size not correct on Windows when starting the application from Microsoft Teams



    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.6.1
    • GUI: High-DPI
    • None
    • Windows


      Microsoft Teams has recently introduced the possibility to open any file with "Open in App".
      When you open a file that is associated with a QT application, the QT application apparently get a wrong screen size and look small. The problem is particular evident with HDPI monitors.

      The "Open a file in a desktop app"  in teams and onedrive was a very requested functionality.
      It is very new. Here I found some explanation on how it work:
      Once you do it copy the file locally with onedrive and the starts the registered application with the argument of the file copy on the local system. I was not able to find information from Microsoft.

      It happens with our application and also with Qt Creator. 
      I added here a file "mainwindow.ui" you can add in microsoft teams.
      The file contains reference to the documentviewer.qrc so you get a warning that the file does not exists that you should ignore.

      Here is QT creator started from opening a file in File explorer (open file). 

      Here is QT creator opened on the same computer opening from Microsoft Teams with Open in App.

      On the same computer the application started from MS-Teams report screen size of 539x303.
      The actual screen size is 3840x2160 with scale of 250%

      Here is the code used

      QScreen *screen = QGuiApplication::primaryScreen();
      s1->addInfo("Size x", screen->size().width());
      s1->addInfo("Size y", screen->size().height());
      s1->addInfo("Logical dpi x", screen->logicalDotsPerInchX());
      s1->addInfo("Logical dpi y", screen->logicalDotsPerInchY());
      s1->addInfo("Phisical dpi x", screen->physicalDotsPerInchX());
      s1->addInfo("Phisical dpi y", screen->physicalDotsPerInchY());

      Here the result when started from MS Teams

      Here the result when the application started from File Explorer we get this sizes.


      The app launched from file explorer and the one from microsoft teams are always the same.
      So I have no idea why this happen.
      I have tried to open file that use other desktop applications (like image editing) and they work as usual.
      It may be a problem of Microsoft Windows of Microsoft Teams, but due to the fact that it affect QT Creator and apparently all QT Application I do report here.

      I did a brief check of QT bug related issues an found something, but not sure they really relate to the same problem.



      I did not investigate further due to the need to register the application on windows to open a specific file. I hope that the information is sufficient to frame the problem.  





        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            sorvig Morten Sørvig
            domezuk Domenico Zucchetti
            1 Vote for this issue
            2 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes