mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-07-30 04:38:37 +00:00
增加全屏工具
This commit is contained in:
parent
838dc3d487
commit
0a32f0b4af
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)
|
void VideoForm::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
m_inputConvert.mouseEvent(event, ui->videoWidget->frameSize(), size());
|
m_inputConvert.mouseEvent(event, ui->videoWidget->frameSize(), size());
|
||||||
|
@ -159,6 +170,11 @@ void VideoForm::wheelEvent(QWheelEvent *event)
|
||||||
|
|
||||||
void VideoForm::keyPressEvent(QKeyEvent *event)
|
void VideoForm::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
|
if (Qt::Key_Escape == event->key()
|
||||||
|
&& !event->isAutoRepeat()
|
||||||
|
&& isFullScreen()) {
|
||||||
|
switchFullScreen();
|
||||||
|
}
|
||||||
//qDebug() << "keyPressEvent" << event->isAutoRepeat();
|
//qDebug() << "keyPressEvent" << event->isAutoRepeat();
|
||||||
m_inputConvert.keyEvent(event, ui->videoWidget->frameSize(), size());
|
m_inputConvert.keyEvent(event, ui->videoWidget->frameSize(), size());
|
||||||
}
|
}
|
||||||
|
@ -168,3 +184,8 @@ void VideoForm::keyReleaseEvent(QKeyEvent *event)
|
||||||
//qDebug() << "keyReleaseEvent" << event->isAutoRepeat();
|
//qDebug() << "keyReleaseEvent" << event->isAutoRepeat();
|
||||||
m_inputConvert.keyEvent(event, ui->videoWidget->frameSize(), size());
|
m_inputConvert.keyEvent(event, ui->videoWidget->frameSize(), size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoForm::on_fullScrcenbtn_clicked()
|
||||||
|
{
|
||||||
|
switchFullScreen();
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateShowSize(const QSize &newSize);
|
void updateShowSize(const QSize &newSize);
|
||||||
|
void switchFullScreen();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
@ -32,6 +33,9 @@ protected:
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
void keyReleaseEvent(QKeyEvent *event);
|
void keyReleaseEvent(QKeyEvent *event);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_fullScrcenbtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::videoForm *ui;
|
Ui::videoForm *ui;
|
||||||
QSize frameSize;
|
QSize frameSize;
|
||||||
|
|
|
@ -32,6 +32,44 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QYUVOpenGLWidget" name="videoWidget" native="true"/>
|
<widget class="QYUVOpenGLWidget" name="videoWidget" native="true"/>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue