修改子窗口显示逻辑,适配Linux下的多屏环境
This commit is contained in:
parent
8ba8353a3b
commit
c2e8300d36
|
|
@ -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,21 +164,27 @@ 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()
|
||||
{
|
||||
if(m_pDBStrutureView)
|
||||
|
|
@ -197,19 +205,25 @@ 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()
|
||||
{
|
||||
if(m_pDBStrutureView)
|
||||
|
|
@ -243,19 +257,24 @@ 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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,11 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>属性选择器</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resource/PowerModeler.qrc">
|
||||
<normaloff>:/img/images/icon_addItem.png</normaloff>:/img/images/icon_addItem.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
|
|
|
|||
|
|
@ -18,7 +18,24 @@
|
|||
<normaloff>:/img/images/icon_database.png</normaloff>:/img/images/icon_database.png</iconset>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
<string notr="true">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);
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
|
|
|
|||
Loading…
Reference in New Issue