From 0d1ebcfe2c897825a4a2b35b6938f20949b68373 Mon Sep 17 00:00:00 2001 From: Wang Cong Date: Mon, 19 Feb 2024 15:15:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=8C=E5=B1=8F?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=BE=B9=E7=BC=98=E6=88=AA=E5=9B=BE=E6=97=A0?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 由于工具栏的定位点参考捕捉区域的左上角,因此会出现工具栏显示在屏幕外部。注意:双屏扩展两个屏幕大小不一致或者错位排布 时,此时捕捉区域是允许移动到屏幕外部,因为工具栏的定位点参考捕捉区域的左上角。目前修改为:当捕捉区域左上角移动到屏幕边缘,工具栏左对齐捕捉区域。 当捕捉区域左上角移动到屏幕外,工具栏采用上次的位置进行显示。 Log: 修复双屏时,边缘截图无菜单显示 Bug: https://pms.uniontech.com/bug-view-242535.html --- src/main_window.cpp | 11 +++++++++-- src/main_window.h | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main_window.cpp b/src/main_window.cpp index 5b0f4e85..e1061aca 100755 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -2373,8 +2373,8 @@ void MainWindow::updateToolBarPos() } } if (!toolIsInScreen) { - if (!tempScreen.isNull() || tempScreen.isEmpty()) { - qDebug() << "当前屏幕:" << tempScreen; + if (!tempScreen.isNull() /*|| tempScreen.isEmpty()*/) { + //qDebug() << "当前屏幕:" << tempScreen; if (recordY - tempScreen.y() > m_toolBar->height() + 28) { //qDebug() << "工具栏位置未在任一屏幕内,需要矫正 >>> 放捕捉区域上边 toolbarPoint: " << toolbarPoint; toolbarPoint.setY(recordY - m_toolBar->height() - TOOLBAR_Y_SPACING); @@ -2382,13 +2382,20 @@ void MainWindow::updateToolBarPos() //qDebug() << "工具栏位置未在任一屏幕内,需要矫正 >>> 放捕捉区域里面 toolbarPoint: " << toolbarPoint; toolbarPoint.setY(recordY + TOOLBAR_Y_SPACING); } + if(recordX + recordWidth - m_toolBar->width() < tempScreen.x()){ + toolbarPoint.setX(recordX); + } //qDebug() << "工具栏位置未在任一屏幕内,已矫正 >>> toolbarPoint: " << toolbarPoint; + }else{ + toolbarPoint.setX(m_toolbarLastPoint.x()); + toolbarPoint.setY(m_toolbarLastPoint.y()); } } } //qDebug() << "工具栏最新坐标 >>> toolbarPoint: " << toolbarPoint; //快捷全屏录制不需要显示工具栏 if(m_isFullScreenRecord) return; + m_toolbarLastPoint = toolbarPoint; m_toolBar->showAt(toolbarPoint); //qDebug() << "==================2================="; } diff --git a/src/main_window.h b/src/main_window.h index 73dd10a0..342dc4cc 100755 --- a/src/main_window.h +++ b/src/main_window.h @@ -1083,6 +1083,10 @@ public slots: */ bool m_isSaveClipboard = false; + /** + * @brief m_toolbarLastPoint 工具栏位置改变后,上一次工具栏的位置 + */ + QPoint m_toolbarLastPoint; }; #endif //MAINWINDOW_H