Skip to content

Commit

Permalink
fix: ocr disappears in treeland
Browse files Browse the repository at this point in the history
As title.

Log: Fix ocr disappearing in treeland.
Bug: https://pms.uniontech.com/bug-view-283631.html
  • Loading branch information
rb-union authored and deepin-bot[bot] committed Dec 24, 2024
1 parent 0c837df commit 4d5d91d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3230,12 +3230,13 @@ void MainWindow::changeShotToolEvent(const QString &func)
if (m_isDirectStartOcr) {
delayTime = 100;
}
// QTimer::singleShot(delayTime, this, [=] { saveScreenShot(); });

// TODO: 在treeland里暂时是走handleCapture去执行保存图片,后续会和原逻辑统一
if (Utils::isTreelandMode)
if (Utils::isTreelandMode) {
QTimer::singleShot(delayTime, this, [=] { onFinishClicked(); });

} else {
QTimer::singleShot(delayTime, this, [=] { saveScreenShot(); });
}
} else if (func == "pinScreenshots") {
m_functionType = status::pinscreenshots;
m_pinInterface = new PinScreenShotsInterface(
Expand Down Expand Up @@ -6634,6 +6635,16 @@ void MainWindow::handleCaptureFinish()
if (m_sideBar)
m_sideBar->hide();

// check if trigger ocr.
if (m_ocrInterface) {
if (m_saveIndex == SaveToClipboard) {
// TODO: use temporary path
m_ocrInterface->openImageAndName(result, saveBasePath);
} else {
m_ocrInterface->openImageAndName(result, saveBasePath);
}
}

} else {
qApp->exit(-1);
}
Expand Down

0 comments on commit 4d5d91d

Please sign in to comment.