Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How can I create a frameless fixed size window compatible with high DPI?
Forum Update on Monday, May 27th 2025

How can I create a frameless fixed size window compatible with high DPI?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
windows 10high dpimonitorwindowconfiguration
4 Posts 2 Posters 2.5k Views
  • 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.
  • J Offline
    J Offline
    jeanmilost
    wrote on 13 Jan 2021, 13:43 last edited by
    #1

    I'm creating an application in a frameless fixed size window, which must support the Windows 10 per-monitor high DPI features, and be visible in the taskbar and behaves as any other normal Windows application. I also needed to implement my own form header instead of the default system one.

    However I'm in trouble with the high DPI behavior, which isn't working as I expect. What I need is a form which keeps the same proportions on the different DPI and monitors, but keeping its visual size unchanged.

    However what I get is a completely buggy high DPI behavior, which I described in the unfortunately never answered following thread: https://forum.qt.io/topic/122389/some-trouble-with-high-dpi

    I tried to play around the following configuration:

    ApplicationWindow
    {
        // common properties
        id: awMainForm
        width: 602
        height: 728
        minimumWidth: 602
        minimumHeight: 728
        maximumWidth: 602
        maximumHeight: 728
        flags: Qt.FramelessWindowHint | Qt.Window
        visible: true
    
        // form content isn't relevant
        ...
    }
    

    I'm aware that the error comes from the way I configured my form rather than a bug in Qt. The issue seems to come from the window flags, in association with the non-sizeable constraint. For example, if I remove the Qt.Window flag, all works fine with the high DPI, but several other side effects appear, e.g I can no longer find my window onto the taskbar, nor restore it after a minimize.

    NOTE as I said above, I implemented my own form header, it's the reason why I still can move my window despite of removing the Qt.Window flag.

    So, what is the correct way to create a frameless fixed size window which can be minimized and visible onto the taskbar and supports correctly the Windows 10 per-monitor high DPI feature? How should I configure my window to reach a such behavior, or which functions/messages should I override to reach that?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jeanmilost
      wrote on 20 Jan 2021, 23:19 last edited by jeanmilost
      #4

      I finally found a solution which seems to work in my case. I added the Qt.MSWindowsFixedSizeDialogHint window flag, which seems to fix the issue.

      So below is the modified code:

      ApplicationWindow
      {
          // common properties
          id: awMainForm
          width: 602
          height: 728
          flags: Qt.Window | Qt.FramelessWindowHint | Qt.MSWindowsFixedSizeDialogHint
          visible: true
      
          // form content isn't relevant
          ...
      }
      
      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mammamia
        wrote on 15 Jan 2021, 15:46 last edited by Mammamia
        #2

        @jeanmilost Have you had a look at this project
        https://github.com/wangwenx190/framelesshelper

        Which has

        Features
        Support Windows, X11, Wayland and macOS.
        Frameless but have frame shadow.
        Draggable and resizable.
        Automatically high DPI scaling.
        Multi-monitor support (different resolution and DPI).
        Have animations when minimizing, maximizing and restoring.
        Support tiled and stack windows by DWM (Win32 only).
        Won't cover the task bar when maximized (Win32 only).
        Won't block the auto-hide task bar when maximized (Win32 only).
        No flickers when resizing.
        Load all native APIs at run-time, no need to link to any system libraries directly (Win32 only).
        
        J 1 Reply Last reply 20 Jan 2021, 23:15
        0
        • M Mammamia
          15 Jan 2021, 15:46

          @jeanmilost Have you had a look at this project
          https://github.com/wangwenx190/framelesshelper

          Which has

          Features
          Support Windows, X11, Wayland and macOS.
          Frameless but have frame shadow.
          Draggable and resizable.
          Automatically high DPI scaling.
          Multi-monitor support (different resolution and DPI).
          Have animations when minimizing, maximizing and restoring.
          Support tiled and stack windows by DWM (Win32 only).
          Won't cover the task bar when maximized (Win32 only).
          Won't block the auto-hide task bar when maximized (Win32 only).
          No flickers when resizing.
          Load all native APIs at run-time, no need to link to any system libraries directly (Win32 only).
          
          J Offline
          J Offline
          jeanmilost
          wrote on 20 Jan 2021, 23:15 last edited by
          #3

          @Mammamia Thank you for the suggestion, the project looks very interesting. I'll take a look as soon as possible.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jeanmilost
            wrote on 20 Jan 2021, 23:19 last edited by jeanmilost
            #4

            I finally found a solution which seems to work in my case. I added the Qt.MSWindowsFixedSizeDialogHint window flag, which seems to fix the issue.

            So below is the modified code:

            ApplicationWindow
            {
                // common properties
                id: awMainForm
                width: 602
                height: 728
                flags: Qt.Window | Qt.FramelessWindowHint | Qt.MSWindowsFixedSizeDialogHint
                visible: true
            
                // form content isn't relevant
                ...
            }
            
            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