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. Resize client area for borderless window
Forum Updated to NodeBB v4.3 + New Features

Resize client area for borderless window

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.5k 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.
  • P Offline
    P Offline
    philk
    wrote on last edited by
    #1

    I remove the Windows default frame using:
    @
    MARGINS margins = {-1,-1,-1,-1};
    DwmExtendFrameIntoClientArea((HWND)winId(), &margins);
    setWindowFlags(Qt::FramelessWindowHint | Qt::CustomizeWindowHint /| Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint/);
    @
    This works ok. However when I enable the minimize, maximize and close commands Qt seems to add a border internally to its calculations again, although I have specified FramelessWindowHint.
    Then all the popup menus are vertically off by the amount of pixels Qt thinks the caption of the window consumes. Also it does no longer completely fill the (still borderless)
    window with its client area.
    Is there a way to stop Qt from adding the borders to its calculations?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thEClaw
      wrote on last edited by
      #2

      My uneducated assumption is that you should not use a frameless window and ask for standard buttons. I think there is an example in the documentation regarding this.

      Short quotation from memory with no guarantee of delivering the perfect solution: If you remove the frame, you should implement your own buttons to minimize, maximize and close the window. You can position these buttons however you want, and query QStyle::standardIcon (maybe there is a better way) to receive some recogniable icons for these buttons.

      What you are describing sounds like a bug in Qt, by the way. Did I misinterpret your words?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        philk
        wrote on last edited by
        #3

        thanks for your reply. Adding the button hints should not modify the internal rect Qt thinks the Window has, if it is still frameless. Because the hints are primarily used to have the minimize/maximize/close functionality in the programs system menu (and the keyboard shortcuts).
        So it does seem to be a bug then.

        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