From 878714bc12acac36ddd398f9ce1ad789b3f0c07d Mon Sep 17 00:00:00 2001 From: rankun Date: Tue, 27 Nov 2018 13:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=A8=E5=B1=8F=E5=B7=A5?= =?UTF-8?q?=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtScrcpy/videoform.cpp | 21 +++++++++++++++++++++ QtScrcpy/videoform.h | 4 ++++ QtScrcpy/videoform.ui | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/QtScrcpy/videoform.cpp b/QtScrcpy/videoform.cpp index 4b627b9..36b17cf 100644 --- a/QtScrcpy/videoform.cpp +++ b/QtScrcpy/videoform.cpp @@ -136,6 +136,17 @@ void VideoForm::updateShowSize(const QSize &newSize) } } +void VideoForm::switchFullScreen() +{ + if (isFullScreen()) { + showNormal(); + ui->rightToolWidget->show(); + } else { + ui->rightToolWidget->hide(); + showFullScreen(); + } +} + void VideoForm::mousePressEvent(QMouseEvent *event) { m_inputConvert.mouseEvent(event, ui->videoWidget->frameSize(), size()); @@ -159,6 +170,11 @@ void VideoForm::wheelEvent(QWheelEvent *event) void VideoForm::keyPressEvent(QKeyEvent *event) { + if (Qt::Key_Escape == event->key() + && !event->isAutoRepeat() + && isFullScreen()) { + switchFullScreen(); + } //qDebug() << "keyPressEvent" << event->isAutoRepeat(); m_inputConvert.keyEvent(event, ui->videoWidget->frameSize(), size()); } @@ -168,3 +184,8 @@ void VideoForm::keyReleaseEvent(QKeyEvent *event) //qDebug() << "keyReleaseEvent" << event->isAutoRepeat(); m_inputConvert.keyEvent(event, ui->videoWidget->frameSize(), size()); } + +void VideoForm::on_fullScrcenbtn_clicked() +{ + switchFullScreen(); +} diff --git a/QtScrcpy/videoform.h b/QtScrcpy/videoform.h index ee68b78..d4d79ba 100644 --- a/QtScrcpy/videoform.h +++ b/QtScrcpy/videoform.h @@ -23,6 +23,7 @@ public: private: void updateShowSize(const QSize &newSize); + void switchFullScreen(); protected: void mousePressEvent(QMouseEvent *event); @@ -32,6 +33,9 @@ protected: void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); +private slots: + void on_fullScrcenbtn_clicked(); + private: Ui::videoForm *ui; QSize frameSize; diff --git a/QtScrcpy/videoform.ui b/QtScrcpy/videoform.ui index cce5644..b1f13eb 100644 --- a/QtScrcpy/videoform.ui +++ b/QtScrcpy/videoform.ui @@ -32,6 +32,44 @@ + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + + + + F + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + +