From 618e6a099b4cc3e3e1fb12f951e6d600e0e47a50 Mon Sep 17 00:00:00 2001 From: rankun Date: Sun, 27 Jan 2019 19:32:02 +0800 Subject: [PATCH] =?UTF-8?q?update:mac=E5=BC=82=E5=BD=A2=E7=AA=97=E5=8F=A3+?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtScrcpy/videoform.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/QtScrcpy/videoform.cpp b/QtScrcpy/videoform.cpp index 06791f7..b98fe5e 100644 --- a/QtScrcpy/videoform.cpp +++ b/QtScrcpy/videoform.cpp @@ -79,13 +79,12 @@ void VideoForm::initUI() } setAttribute(Qt::WA_DeleteOnClose); - // TODO mac: Qt::FramelessWindowHit full screen is abnormal -#ifndef Q_OS_OSX + // 去掉标题栏 - setWindowFlags(Qt::FramelessWindowHint); + setWindowFlags(windowFlags() | Qt::FramelessWindowHint); // 根据图片构造异形窗口 setAttribute(Qt::WA_TranslucentBackground); -#endif + setMouseTracking(true); ui->loadingWidget->setAttribute(Qt::WA_DeleteOnClose); ui->videoWidget->setMouseTracking(true); @@ -258,12 +257,20 @@ void VideoForm::switchFullScreen() { if (isFullScreen()) { showNormal(); +#ifdef Q_OS_OSX + setWindowFlags(windowFlags() | Qt::FramelessWindowHint); + show(); +#endif updateStyleSheet(height() > width()); showToolFrom(true); #ifdef Q_OS_WIN32 ::SetThreadExecutionState(ES_CONTINUOUS); #endif } else { + // mac fullscreen must show title bar +#ifdef Q_OS_OSX + setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint); +#endif showToolFrom(false); layout()->setContentsMargins(0, 0, 0, 0); showFullScreen();