mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 22:28:39 +00:00
update:mac不去掉标题栏
This commit is contained in:
parent
1c36bf1895
commit
be616458a2
1 changed files with 9 additions and 5 deletions
|
@ -80,10 +80,13 @@ void VideoForm::initUI()
|
||||||
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
// mac下去掉标题栏影响showfullscreen
|
||||||
|
#ifndef Q_OS_OSX
|
||||||
// 去掉标题栏
|
// 去掉标题栏
|
||||||
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
||||||
// 根据图片构造异形窗口
|
// 根据图片构造异形窗口
|
||||||
setAttribute(Qt::WA_TranslucentBackground);
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
#endif
|
||||||
|
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
ui->loadingWidget->setAttribute(Qt::WA_DeleteOnClose);
|
ui->loadingWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -138,7 +141,6 @@ void VideoForm::initSignals()
|
||||||
float diff = m_startTimeCount.elapsed() / 1000.0f;
|
float diff = m_startTimeCount.elapsed() / 1000.0f;
|
||||||
qInfo(QString("server start finish in %1s").arg(diff).toStdString().c_str());
|
qInfo(QString("server start finish in %1s").arg(diff).toStdString().c_str());
|
||||||
|
|
||||||
|
|
||||||
// update ui
|
// update ui
|
||||||
setWindowTitle(deviceName);
|
setWindowTitle(deviceName);
|
||||||
updateShowSize(size);
|
updateShowSize(size);
|
||||||
|
@ -257,9 +259,10 @@ void VideoForm::switchFullScreen()
|
||||||
{
|
{
|
||||||
if (isFullScreen()) {
|
if (isFullScreen()) {
|
||||||
showNormal();
|
showNormal();
|
||||||
|
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
//setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
||||||
show();
|
//show();
|
||||||
#endif
|
#endif
|
||||||
updateStyleSheet(height() > width());
|
updateStyleSheet(height() > width());
|
||||||
showToolFrom(true);
|
showToolFrom(true);
|
||||||
|
@ -267,10 +270,10 @@ void VideoForm::switchFullScreen()
|
||||||
::SetThreadExecutionState(ES_CONTINUOUS);
|
::SetThreadExecutionState(ES_CONTINUOUS);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
setFocus(Qt::ActiveWindowFocusReason);
|
// 这种临时增加标题栏再全屏的方案会导致收不到mousemove事件,导致setmousetrack失效
|
||||||
// mac fullscreen must show title bar
|
// mac fullscreen must show title bar
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint);
|
//setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint);
|
||||||
#endif
|
#endif
|
||||||
showToolFrom(false);
|
showToolFrom(false);
|
||||||
layout()->setContentsMargins(0, 0, 0, 0);
|
layout()->setContentsMargins(0, 0, 0, 0);
|
||||||
|
@ -411,6 +414,7 @@ void VideoForm::keyPressEvent(QKeyEvent *event)
|
||||||
&& isFullScreen()) {
|
&& isFullScreen()) {
|
||||||
switchFullScreen();
|
switchFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
//qDebug() << "keyPressEvent" << event->isAutoRepeat();
|
//qDebug() << "keyPressEvent" << event->isAutoRepeat();
|
||||||
m_inputConvert.keyEvent(event, ui->videoWidget->frameSize(), ui->videoWidget->size());
|
m_inputConvert.keyEvent(event, ui->videoWidget->frameSize(), ui->videoWidget->size());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue