fix: 解决bug85086
Description: 检测到图片为空,则不启动 Log: 与程序启动有关 Bug: https://pms.uniontech.com/zentao/bug-view-85086.html Change-Id: Icd4a7b78328e2568a239e03dd44f77fb841795ba
This commit is contained in:
parent
902758fd49
commit
203c55548f
|
@ -286,14 +286,19 @@ void MainWidget::initShortcut()
|
|||
|
||||
}
|
||||
|
||||
void MainWidget::openImage(const QString &path)
|
||||
bool MainWidget::openImage(const QString &path)
|
||||
{
|
||||
bool bRet = false;
|
||||
if (m_imageview) {
|
||||
QImage img(path);
|
||||
if (!img.isNull()) {
|
||||
m_imgName = path;
|
||||
openImage(img, m_imgName);
|
||||
bRet = true;
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void MainWidget::openImage(const QImage &img, const QString &name)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
//初始化快捷键
|
||||
void initShortcut();
|
||||
|
||||
void openImage(const QString &path);
|
||||
bool openImage(const QString &path);
|
||||
void openImage(const QImage &img, const QString &name = "");
|
||||
|
||||
void loadHtml(const QString &html);
|
||||
|
|
|
@ -48,8 +48,8 @@ MainWindow::~MainWindow()
|
|||
|
||||
bool MainWindow::openFile(const QString &filePaths)
|
||||
{
|
||||
m_mainWidget->openImage(filePaths);
|
||||
return true;
|
||||
//更改打开判断文件是否是图片文件
|
||||
return m_mainWidget->openImage(filePaths);;
|
||||
}
|
||||
|
||||
bool MainWindow::openImage(const QImage &image, const QString &name)
|
||||
|
|
|
@ -30,22 +30,26 @@ OcrApplication::OcrApplication(QObject *parent) : QObject(parent)
|
|||
|
||||
bool OcrApplication::openFile(QString filePath)
|
||||
{
|
||||
|
||||
|
||||
qDebug() << __FUNCTION__ << __LINE__ << filePath;
|
||||
MainWindow *win = new MainWindow();
|
||||
win->openFile(filePath);
|
||||
//增加判断,空图片不会启动
|
||||
bool bRet = win->openFile(filePath);
|
||||
if (bRet) {
|
||||
win->show();
|
||||
//第一次启动才居中
|
||||
if (m_loadingCount == 0) {
|
||||
Dtk::Widget::moveToCenter(win);
|
||||
m_loadingCount++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void OcrApplication::openImage(QImage image)
|
||||
{
|
||||
//增加判断,空图片不会启动
|
||||
if (!image.isNull() && image.width() >= 1) {
|
||||
qDebug() << __FUNCTION__ << __LINE__ << image.size();
|
||||
MainWindow *win = new MainWindow();
|
||||
win->openImage(image);
|
||||
|
@ -56,10 +60,12 @@ void OcrApplication::openImage(QImage image)
|
|||
m_loadingCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OcrApplication::openImageAndName(QImage image, QString imageName)
|
||||
{
|
||||
qDebug() << __FUNCTION__ << __LINE__ << image.size();
|
||||
//增加判断,空图片不会启动
|
||||
if (!image.isNull() && image.width() >= 1) {
|
||||
MainWindow *win = new MainWindow();
|
||||
win->openImage(image, imageName);
|
||||
win->show();
|
||||
|
@ -69,4 +75,5 @@ void OcrApplication::openImageAndName(QImage image, QString imageName)
|
|||
m_loadingCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user