fix: 修复bug84917
Description: 设置第一次居中,第二次打开不再居中 Log: 与窗口有关 Bug: https://pms.uniontech.com/zentao/bug-view-84917.html Change-Id: I49fdf12ffb981edb1408e27ac1a3de31cb2dd4a1
This commit is contained in:
parent
19c54859da
commit
2036239a4f
|
@ -27,7 +27,6 @@
|
|||
#include <QDBusConnection>
|
||||
|
||||
#include <DTitlebar>
|
||||
#include <DWidgetUtil>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: DMainWindow(parent)
|
||||
|
@ -39,7 +38,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
this->setCentralWidget(m_mainWidget);
|
||||
this->resize(840, 550);
|
||||
this->setMinimumSize(840, 550);
|
||||
Dtk::Widget::moveToCenter(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -56,6 +54,6 @@ bool MainWindow::openFile(const QString &filePaths)
|
|||
|
||||
bool MainWindow::openImage(const QImage &image, const QString &name)
|
||||
{
|
||||
m_mainWidget->openImage(image,name);
|
||||
m_mainWidget->openImage(image, name);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "ocrapplication.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <DWidgetUtil>
|
||||
|
||||
OcrApplication::OcrApplication(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
@ -30,11 +30,17 @@ OcrApplication::OcrApplication(QObject *parent) : QObject(parent)
|
|||
|
||||
bool OcrApplication::openFile(QString filePath)
|
||||
{
|
||||
|
||||
|
||||
qDebug() << __FUNCTION__ << __LINE__ << filePath;
|
||||
MainWindow *win = new MainWindow();
|
||||
win->openFile(filePath);
|
||||
win->resize(800, 600);
|
||||
win->show();
|
||||
//第一次启动才居中
|
||||
if (m_loadingCount == 0) {
|
||||
Dtk::Widget::moveToCenter(win);
|
||||
m_loadingCount++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -43,16 +49,24 @@ void OcrApplication::openImage(QImage image)
|
|||
qDebug() << __FUNCTION__ << __LINE__ << image.size();
|
||||
MainWindow *win = new MainWindow();
|
||||
win->openImage(image);
|
||||
win->resize(800, 600);
|
||||
win->show();
|
||||
//第一次启动才居中
|
||||
if (m_loadingCount == 0) {
|
||||
Dtk::Widget::moveToCenter(win);
|
||||
m_loadingCount++;
|
||||
}
|
||||
}
|
||||
|
||||
void OcrApplication::openImageAndName(QImage image, QString imageName)
|
||||
{
|
||||
qDebug() << __FUNCTION__ << __LINE__ << image.size();
|
||||
MainWindow *win = new MainWindow();
|
||||
win->openImage(image,imageName);
|
||||
win->resize(800, 600);
|
||||
win->openImage(image, imageName);
|
||||
win->show();
|
||||
//第一次启动才居中
|
||||
if (m_loadingCount == 0) {
|
||||
Dtk::Widget::moveToCenter(win);
|
||||
m_loadingCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,13 +37,15 @@ public:
|
|||
|
||||
Q_INVOKABLE void openImage(QImage image);
|
||||
|
||||
Q_INVOKABLE void openImageAndName( QImage image, QString imageName);
|
||||
Q_INVOKABLE void openImageAndName(QImage image, QString imageName);
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
int m_loadingCount{0};//启动次数
|
||||
};
|
||||
|
||||
#endif // OCRAPPLICATION_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user