mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 19:44:59 +00:00
增加全屏工具
This commit is contained in:
parent
8a045ab4b8
commit
878714bc12
3 changed files with 63 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -32,6 +32,44 @@
|
|||
<item>
|
||||
<widget class="QYUVOpenGLWidget" name="videoWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="rightToolWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="fullScrcenbtn">
|
||||
<property name="text">
|
||||
<string>F</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
|
Loading…
Add table
Reference in a new issue