feat: 启动时默认在屏幕中间

启动时默认在屏幕中间

Log: 位置相关
Change-Id: Ifa7df5fe7bce04dbd38d3b20f6f3ba0775468f5a
This commit is contained in:
Zhang Yong 2021-06-16 17:19:22 +08:00
parent 3cb047e159
commit 7c66205d3d
3 changed files with 7 additions and 2 deletions

View File

@ -49,7 +49,7 @@ int main(int argc, char *argv[])
DApplication::loadDXcbPlugin(); DApplication::loadDXcbPlugin();
QScopedPointer<DApplication> app(new DApplication(argc, argv)); QScopedPointer<DApplication> app(new DApplication(argc, argv));
#else #else
QScopedPointer<DApplication> app(DApplication::globalApplication(argc,argv)); QScopedPointer<DApplication> app(DApplication::globalApplication(argc, argv));
#endif #endif
app->setOrganizationName("deepin"); app->setOrganizationName("deepin");
app->setApplicationName("deepin-ocr"); app->setApplicationName("deepin-ocr");
@ -68,6 +68,7 @@ int main(int argc, char *argv[])
app->loadTranslator(); app->loadTranslator();
OcrApplication instance; OcrApplication instance;
QDBusConnection dbus = QDBusConnection::sessionBus(); QDBusConnection dbus = QDBusConnection::sessionBus();
@ -89,7 +90,7 @@ int main(int argc, char *argv[])
// 第二次运行此应用, // 第二次运行此应用,
// 调用DBus接口处理交给第一次调用的进程 // 调用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__; qDebug() << __FUNCTION__ << __LINE__;
pOcr->openFile(QString(argv[1])); pOcr->openFile(QString(argv[1]));
//pOcr->openImage(QImage(QSize(500, 145), QImage::Format_RGB32)); //pOcr->openImage(QImage(QSize(500, 145), QImage::Format_RGB32));

View File

@ -25,7 +25,9 @@
#include <QLabel> #include <QLabel>
#include <QDBusConnection> #include <QDBusConnection>
#include <DTitlebar> #include <DTitlebar>
#include <DWidgetUtil>
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: DMainWindow(parent) : DMainWindow(parent)
@ -37,6 +39,7 @@ MainWindow::MainWindow(QWidget *parent)
this->setCentralWidget(m_mainWidget); this->setCentralWidget(m_mainWidget);
this->resize(840, 550); this->resize(840, 550);
this->setMinimumSize(840, 550); this->setMinimumSize(840, 550);
Dtk::Widget::moveToCenter(this);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()

View File

@ -27,6 +27,7 @@
class MainWidget; class MainWidget;
DWIDGET_USE_NAMESPACE DWIDGET_USE_NAMESPACE
class MainWindow : public DMainWindow class MainWindow : public DMainWindow
{ {
Q_OBJECT Q_OBJECT