From 7c66205d3dd2dd1d8b109edaab932af32ba95b8c Mon Sep 17 00:00:00 2001 From: Zhang Yong Date: Wed, 16 Jun 2021 17:19:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=AF=E5=8A=A8=E6=97=B6=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=9C=A8=E5=B1=8F=E5=B9=95=E4=B8=AD=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 启动时默认在屏幕中间 Log: 位置相关 Change-Id: Ifa7df5fe7bce04dbd38d3b20f6f3ba0775468f5a --- src/main.cpp | 5 +++-- src/mainwindow.cpp | 3 +++ src/mainwindow.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 79067a5..11c93dd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) DApplication::loadDXcbPlugin(); QScopedPointer app(new DApplication(argc, argv)); #else - QScopedPointer app(DApplication::globalApplication(argc,argv)); + QScopedPointer app(DApplication::globalApplication(argc, argv)); #endif app->setOrganizationName("deepin"); app->setApplicationName("deepin-ocr"); @@ -68,6 +68,7 @@ int main(int argc, char *argv[]) app->loadTranslator(); + OcrApplication instance; QDBusConnection dbus = QDBusConnection::sessionBus(); @@ -89,7 +90,7 @@ int main(int argc, char *argv[]) // 第二次运行此应用, // 调用DBus接口,处理交给第一次调用的进程 // 本进程退退出 - OcrInterface *pOcr = new OcrInterface("com.deepin.Ocr","/com/deepin/Ocr", QDBusConnection::sessionBus(), &instance); + OcrInterface *pOcr = new OcrInterface("com.deepin.Ocr", "/com/deepin/Ocr", QDBusConnection::sessionBus(), &instance); qDebug() << __FUNCTION__ << __LINE__; pOcr->openFile(QString(argv[1])); //pOcr->openImage(QImage(QSize(500, 145), QImage::Format_RGB32)); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 617b96a..440a1b6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -25,7 +25,9 @@ #include #include + #include +#include MainWindow::MainWindow(QWidget *parent) : DMainWindow(parent) @@ -37,6 +39,7 @@ MainWindow::MainWindow(QWidget *parent) this->setCentralWidget(m_mainWidget); this->resize(840, 550); this->setMinimumSize(840, 550); + Dtk::Widget::moveToCenter(this); } MainWindow::~MainWindow() diff --git a/src/mainwindow.h b/src/mainwindow.h index 0f910b3..446db05 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -27,6 +27,7 @@ class MainWidget; DWIDGET_USE_NAMESPACE + class MainWindow : public DMainWindow { Q_OBJECT