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

Mac下有QOpenGLWidget情况下的程序拖动问题

retamia opened this issue · 3 comments

Mac下有QOpenGLWidget的情况下把程序拖到另一个屏幕程序会出现4分之三的黑屏
image

NSWindowStyleMaskFullSizeContentView 去掉这个style就不会出现这问题

解决这问题了。在窗口移动的事件里面加下面代码
`
void CFramelessWindow::moveEvent(QMoveEvent *event)
{

NSView *view = (NSView *)this->winId();

if (view.layer == nil)
    return QWidget::moveEvent(event);
QDesktopWidget *desktop = QApplication::desktop();
int curMonitor = desktop->screenNumber(this);
CGFloat ratio = (CGFloat)QApplication::desktop()->screen(curMonitor)->devicePixelRatio();
[view.layer setContentsScale: ratio];

}
`