diff --git a/source/mainwindow.cpp b/source/mainwindow.cpp index e0da2ed..a29bb20 100644 --- a/source/mainwindow.cpp +++ b/source/mainwindow.cpp @@ -116,16 +116,18 @@ void MainWindow::showMessageDialog(MessageDialogType type,const QString& strTitl } m_pMessageDialog->setMessage(type, strTitle, strContent); - int nX = this->geometry().x() + (this->width() - m_pMessageDialog->width()) * 0.5; - int nY = this->geometry().y() + (this->height() - m_pMessageDialog->height()) * 0.5; - m_pMessageDialog->move(nX, nY); + int nX = (this->width() - m_pMessageDialog->width()) * 0.5; + int nY = (this->height() - m_pMessageDialog->height()) * 0.5; if(QSysInfo::kernelType() == "linux") MaskManager::instance()->showMask(m_pMessageDialog); - // if(type == type_question) - // m_pMessageDialog->exec(); - // else - // m_pMessageDialog->show(); + else + { + nX += this->geometry().x(); + nY += this->geometry().y(); + } + + m_pMessageDialog->move(nX, nY); m_pMessageDialog->exec(); } void MainWindow::hideMessageDialog() @@ -162,20 +164,26 @@ void MainWindow::onActionTrigger_connect() connect(m_pConnectionDialog, &ConnectionDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pConnectionDialog);}); } - int nX = this->geometry().x() + (this->width() - m_pConnectionDialog->width()) * 0.5; - int nY = this->geometry().y() + (this->height() - m_pConnectionDialog->height()) * 0.5; - m_pConnectionDialog->move(nX, nY); + int nX = (this->width() - m_pConnectionDialog->width()) * 0.5; + int nY = (this->height() - m_pConnectionDialog->height()) * 0.5; // QPoint centerPos = this->mapToGlobal(this->rect().center()); // centerPos -= QPoint(m_pConnectionDialog->width()/2, m_pConnectionDialog->height()/2); // m_pConnectionDialog->move(centerPos); if(QSysInfo::kernelType() == "linux") { + //因为linux下子窗口去掉了Dialog属性,所以只需要按照相对坐标计算即可(this->geometry()的x和y值在Linux的多屏环境下计算也不准) + m_pConnectionDialog->move(nX, nY); MaskManager::instance()->showMask(m_pConnectionDialog); m_pConnectionDialog->show(); } else + { + nX += this->geometry().x(); + nY += this->geometry().y(); + m_pConnectionDialog->move(nX, nY); m_pConnectionDialog->exec(); + } } void MainWindow::onActionTrigger_disconnect() { @@ -197,18 +205,24 @@ void MainWindow::onActionTrigger_addModel() connect(m_pModelInfoDialog, &ModelInfoEditDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pModelInfoDialog);}); } - int nX = this->geometry().x() + (this->width() - m_pModelInfoDialog->width()) * 0.5; - int nY = this->geometry().y() + (this->height() - m_pModelInfoDialog->height()) * 0.5; - m_pModelInfoDialog->move(nX, nY); + int nX = (this->width() - m_pModelInfoDialog->width()) * 0.5; + int nY = (this->height() - m_pModelInfoDialog->height()) * 0.5; + m_pModelInfoDialog->setState(DS_New); if(QSysInfo::kernelType() == "linux") { MaskManager::instance()->showMask(m_pModelInfoDialog); + m_pModelInfoDialog->move(nX, nY); m_pModelInfoDialog->show(); } else + { + nX += this->geometry().x(); + nY += this->geometry().y(); + m_pModelInfoDialog->move(nX, nY); m_pModelInfoDialog->exec(); + } } void MainWindow::onActionTrigger_removeModel() { @@ -243,18 +257,23 @@ void MainWindow::onActionTrigger_addGroup(int modelID) connect(m_pGroupSelectionDialog, &GroupSelectionDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pGroupSelectionDialog);}); } - int nX = this->geometry().x() + (this->width() - m_pGroupSelectionDialog->width()) * 0.5; - int nY = this->geometry().y() + (this->height() - m_pGroupSelectionDialog->height()) * 0.5; - m_pGroupSelectionDialog->move(nX, nY); + int nX = (this->width() - m_pGroupSelectionDialog->width()) * 0.5; + int nY = (this->height() - m_pGroupSelectionDialog->height()) * 0.5; m_pGroupSelectionDialog->setModel(modelID); if(QSysInfo::kernelType() == "linux") { MaskManager::instance()->showMask(m_pGroupSelectionDialog); + m_pGroupSelectionDialog->move(nX, nY); m_pGroupSelectionDialog->show(); } else + { + nX += this->geometry().x(); + nY += this->geometry().y(); + m_pGroupSelectionDialog->move(nX, nY); m_pGroupSelectionDialog->exec(); + } } void MainWindow::onSIG_errorFromDBManger(const QString& strConnectionName, const QString& error) @@ -321,15 +340,20 @@ void MainWindow::onSIG_openAttributeSelector() connect(m_pAttributeSelector, &AttributeSelector::finished, this, [=]{ MaskManager::instance()->hideMask(m_pGroupSelectionDialog);}); } - int nX = this->geometry().x() + (this->width() - m_pAttributeSelector->width()) * 0.5; - int nY = this->geometry().y() + (this->height() - m_pAttributeSelector->height()) * 0.5; - m_pAttributeSelector->move(nX, nY); + int nX = (this->width() - m_pAttributeSelector->width()) * 0.5; + int nY = (this->height() - m_pAttributeSelector->height()) * 0.5; if(QSysInfo::kernelType() == "linux") { MaskManager::instance()->showMask(m_pAttributeSelector); + m_pAttributeSelector->move(nX, nY); m_pAttributeSelector->show(); } else + { + nX += this->geometry().x(); + nY += this->geometry().y(); + m_pAttributeSelector->move(nX, nY); m_pAttributeSelector->exec(); + } } diff --git a/ui/attributeSelector.ui b/ui/attributeSelector.ui index 41977b6..f1f0059 100644 --- a/ui/attributeSelector.ui +++ b/ui/attributeSelector.ui @@ -11,7 +11,11 @@ - Form + 属性选择器 + + + + :/img/images/icon_addItem.png:/img/images/icon_addItem.png diff --git a/ui/connectionDialog.ui b/ui/connectionDialog.ui index ab5188b..dbda822 100644 --- a/ui/connectionDialog.ui +++ b/ui/connectionDialog.ui @@ -18,7 +18,24 @@ :/img/images/icon_database.png:/img/images/icon_database.png - + QTableView +{ + outline:0px; +} +QTableView::item +{ + border:0px; + background-color:transparent; +} +QTableView::item:hover +{ + background-color:transparent; +} +QTableView::item:selected +{ + color:rgb(0,0,0); + background-color:rgb(211, 241, 250); +}