fix: 关闭识别界面崩溃
Description: 点击识别界面的关闭按钮,识别界面奔溃 Log: 与主窗口有关 Change-Id: I0961360eb7a49d6bd5b34895f388cb390e32f26d
This commit is contained in:
parent
53be5d7f64
commit
3cb047e159
|
@ -76,10 +76,6 @@ MainWidget::~MainWidget()
|
||||||
m_tipIconLabel->deleteLater();
|
m_tipIconLabel->deleteLater();
|
||||||
m_tipIconLabel = nullptr;
|
m_tipIconLabel = nullptr;
|
||||||
}
|
}
|
||||||
if (m_currentImg) {
|
|
||||||
delete m_currentImg;
|
|
||||||
m_currentImg = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,29 +250,20 @@ void MainWidget::loadingUi()
|
||||||
|
|
||||||
void MainWidget::openImage(const QString &path)
|
void MainWidget::openImage(const QString &path)
|
||||||
{
|
{
|
||||||
createLoadingUi();
|
|
||||||
if (m_imageview) {
|
if (m_imageview) {
|
||||||
QImage img(path);
|
QImage img(path);
|
||||||
m_imageview->openFilterImage(img);
|
m_imageview->openFilterImage(img);
|
||||||
m_imageview->fitWindow();
|
m_imageview->fitWindow();
|
||||||
m_imgName = path;
|
m_imgName = path;
|
||||||
|
openImage(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_loadImagethread) {
|
|
||||||
m_loadImagethread = QThread::create([ = ]() {
|
|
||||||
QMutexLocker locker(&m_mutex);
|
|
||||||
m_result = TessOcrUtils::instance()->getRecogitionResult(path, ResultType::RESULT_STRING);
|
|
||||||
emit sigResult(m_result.result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(m_loadImagethread, &QThread::finished, m_loadImagethread, &QObject::deleteLater);
|
|
||||||
m_loadImagethread->start();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::openImage(const QImage &img)
|
void MainWidget::openImage(const QImage &img)
|
||||||
{
|
{
|
||||||
|
createLoadingUi();
|
||||||
if (m_imageview) {
|
if (m_imageview) {
|
||||||
m_imageview->openFilterImage(img);
|
m_imageview->openFilterImage(img);
|
||||||
m_imageview->fitWindow();
|
m_imageview->fitWindow();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user