Bringer-of-Light / Qt-Nice-Frameless-Window

Qt Frameless Window for both Windows and OS X, support Aero Snap, drop shadow on Windows, and support Native Style such as round corner, drop shadow on OS X. Based on QMainWindow.
Other
812 stars 202 forks source link

Setting fixed size on MainWindow makes the window undraggable. macOS. Qt 5.14.2 #45

Open 956MB opened 4 years ago

956MB commented 4 years ago

Using the CFramelessWindow in my project, if I try to set a fixed window size or set the maximum window size at all, I can no longer move the window.

Can be recreated by opening a new project, importing the framelesswindow.h, framelesswindow.cpp, and framelesswindow.mm, then setting CFramelessWindow, then try either setting maximum window size in designer, or use something like setFixedSize(w,h).

956MB commented 4 years ago

So something I noticed is that if you are trying to set the window a fixed size, and you cant move it anymore, you can change the line in 'framelesswindow.mm':

[window setMovable:NO]; to [window setMovable:YES];

...the window becomes movable again, however, only movable by the slight 20px height of the original macOS titlebar that was there. Which if youre using a frameless window, is a little small.

On the other hand, if you uncomment the line in 'framelesswindow.mm':

window.movableByWindowBackground = YES;

...the window is now movable with a larger drag area, but with two draw backs.

  1. It seems like you can no longer set a specific drag area for the window. The window continues to have an 'm_draggableHeight' of 0 (the whole window).
  2. It also seems like now the window is draggable on top of buttons and labels, where it wasnt previously.

So. If this has already been an enstablished fact here, I appologize, I just figured it out. And if im missing something like a fix to the drag area thing in the second solution there, lmk. Also, I have not looked into this "problem", or for a "solution" in the windows 'framelesswindow.cpp', but I assume thered be an equivalent fix.