修改子窗口显示逻辑,适配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);
|
m_pMessageDialog->setMessage(type, strTitle, strContent);
|
||||||
int nX = this->geometry().x() + (this->width() - m_pMessageDialog->width()) * 0.5;
|
int nX = (this->width() - m_pMessageDialog->width()) * 0.5;
|
||||||
int nY = this->geometry().y() + (this->height() - m_pMessageDialog->height()) * 0.5;
|
int nY = (this->height() - m_pMessageDialog->height()) * 0.5;
|
||||||
m_pMessageDialog->move(nX, nY);
|
|
||||||
|
|
||||||
if(QSysInfo::kernelType() == "linux")
|
if(QSysInfo::kernelType() == "linux")
|
||||||
MaskManager::instance()->showMask(m_pMessageDialog);
|
MaskManager::instance()->showMask(m_pMessageDialog);
|
||||||
// if(type == type_question)
|
else
|
||||||
// m_pMessageDialog->exec();
|
{
|
||||||
// else
|
nX += this->geometry().x();
|
||||||
// m_pMessageDialog->show();
|
nY += this->geometry().y();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pMessageDialog->move(nX, nY);
|
||||||
m_pMessageDialog->exec();
|
m_pMessageDialog->exec();
|
||||||
}
|
}
|
||||||
void MainWindow::hideMessageDialog()
|
void MainWindow::hideMessageDialog()
|
||||||
|
|
@ -162,20 +164,26 @@ void MainWindow::onActionTrigger_connect()
|
||||||
connect(m_pConnectionDialog, &ConnectionDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pConnectionDialog);});
|
connect(m_pConnectionDialog, &ConnectionDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pConnectionDialog);});
|
||||||
}
|
}
|
||||||
|
|
||||||
int nX = this->geometry().x() + (this->width() - m_pConnectionDialog->width()) * 0.5;
|
int nX = (this->width() - m_pConnectionDialog->width()) * 0.5;
|
||||||
int nY = this->geometry().y() + (this->height() - m_pConnectionDialog->height()) * 0.5;
|
int nY = (this->height() - m_pConnectionDialog->height()) * 0.5;
|
||||||
m_pConnectionDialog->move(nX, nY);
|
|
||||||
// QPoint centerPos = this->mapToGlobal(this->rect().center());
|
// QPoint centerPos = this->mapToGlobal(this->rect().center());
|
||||||
// centerPos -= QPoint(m_pConnectionDialog->width()/2, m_pConnectionDialog->height()/2);
|
// centerPos -= QPoint(m_pConnectionDialog->width()/2, m_pConnectionDialog->height()/2);
|
||||||
// m_pConnectionDialog->move(centerPos);
|
// m_pConnectionDialog->move(centerPos);
|
||||||
|
|
||||||
if(QSysInfo::kernelType() == "linux")
|
if(QSysInfo::kernelType() == "linux")
|
||||||
{
|
{
|
||||||
|
//因为linux下子窗口去掉了Dialog属性,所以只需要按照相对坐标计算即可(this->geometry()的x和y值在Linux的多屏环境下计算也不准)
|
||||||
|
m_pConnectionDialog->move(nX, nY);
|
||||||
MaskManager::instance()->showMask(m_pConnectionDialog);
|
MaskManager::instance()->showMask(m_pConnectionDialog);
|
||||||
m_pConnectionDialog->show();
|
m_pConnectionDialog->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
nX += this->geometry().x();
|
||||||
|
nY += this->geometry().y();
|
||||||
|
m_pConnectionDialog->move(nX, nY);
|
||||||
m_pConnectionDialog->exec();
|
m_pConnectionDialog->exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void MainWindow::onActionTrigger_disconnect()
|
void MainWindow::onActionTrigger_disconnect()
|
||||||
{
|
{
|
||||||
|
|
@ -197,18 +205,24 @@ void MainWindow::onActionTrigger_addModel()
|
||||||
connect(m_pModelInfoDialog, &ModelInfoEditDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pModelInfoDialog);});
|
connect(m_pModelInfoDialog, &ModelInfoEditDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pModelInfoDialog);});
|
||||||
}
|
}
|
||||||
|
|
||||||
int nX = this->geometry().x() + (this->width() - m_pModelInfoDialog->width()) * 0.5;
|
int nX = (this->width() - m_pModelInfoDialog->width()) * 0.5;
|
||||||
int nY = this->geometry().y() + (this->height() - m_pModelInfoDialog->height()) * 0.5;
|
int nY = (this->height() - m_pModelInfoDialog->height()) * 0.5;
|
||||||
m_pModelInfoDialog->move(nX, nY);
|
|
||||||
m_pModelInfoDialog->setState(DS_New);
|
m_pModelInfoDialog->setState(DS_New);
|
||||||
|
|
||||||
if(QSysInfo::kernelType() == "linux")
|
if(QSysInfo::kernelType() == "linux")
|
||||||
{
|
{
|
||||||
MaskManager::instance()->showMask(m_pModelInfoDialog);
|
MaskManager::instance()->showMask(m_pModelInfoDialog);
|
||||||
|
m_pModelInfoDialog->move(nX, nY);
|
||||||
m_pModelInfoDialog->show();
|
m_pModelInfoDialog->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
nX += this->geometry().x();
|
||||||
|
nY += this->geometry().y();
|
||||||
|
m_pModelInfoDialog->move(nX, nY);
|
||||||
m_pModelInfoDialog->exec();
|
m_pModelInfoDialog->exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void MainWindow::onActionTrigger_removeModel()
|
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);});
|
connect(m_pGroupSelectionDialog, &GroupSelectionDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pGroupSelectionDialog);});
|
||||||
}
|
}
|
||||||
|
|
||||||
int nX = this->geometry().x() + (this->width() - m_pGroupSelectionDialog->width()) * 0.5;
|
int nX = (this->width() - m_pGroupSelectionDialog->width()) * 0.5;
|
||||||
int nY = this->geometry().y() + (this->height() - m_pGroupSelectionDialog->height()) * 0.5;
|
int nY = (this->height() - m_pGroupSelectionDialog->height()) * 0.5;
|
||||||
m_pGroupSelectionDialog->move(nX, nY);
|
|
||||||
m_pGroupSelectionDialog->setModel(modelID);
|
m_pGroupSelectionDialog->setModel(modelID);
|
||||||
|
|
||||||
if(QSysInfo::kernelType() == "linux")
|
if(QSysInfo::kernelType() == "linux")
|
||||||
{
|
{
|
||||||
MaskManager::instance()->showMask(m_pGroupSelectionDialog);
|
MaskManager::instance()->showMask(m_pGroupSelectionDialog);
|
||||||
|
m_pGroupSelectionDialog->move(nX, nY);
|
||||||
m_pGroupSelectionDialog->show();
|
m_pGroupSelectionDialog->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
nX += this->geometry().x();
|
||||||
|
nY += this->geometry().y();
|
||||||
|
m_pGroupSelectionDialog->move(nX, nY);
|
||||||
m_pGroupSelectionDialog->exec();
|
m_pGroupSelectionDialog->exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onSIG_errorFromDBManger(const QString& strConnectionName, const QString& error)
|
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);});
|
connect(m_pAttributeSelector, &AttributeSelector::finished, this, [=]{ MaskManager::instance()->hideMask(m_pGroupSelectionDialog);});
|
||||||
}
|
}
|
||||||
|
|
||||||
int nX = this->geometry().x() + (this->width() - m_pAttributeSelector->width()) * 0.5;
|
int nX = (this->width() - m_pAttributeSelector->width()) * 0.5;
|
||||||
int nY = this->geometry().y() + (this->height() - m_pAttributeSelector->height()) * 0.5;
|
int nY = (this->height() - m_pAttributeSelector->height()) * 0.5;
|
||||||
m_pAttributeSelector->move(nX, nY);
|
|
||||||
|
|
||||||
if(QSysInfo::kernelType() == "linux")
|
if(QSysInfo::kernelType() == "linux")
|
||||||
{
|
{
|
||||||
MaskManager::instance()->showMask(m_pAttributeSelector);
|
MaskManager::instance()->showMask(m_pAttributeSelector);
|
||||||
|
m_pAttributeSelector->move(nX, nY);
|
||||||
m_pAttributeSelector->show();
|
m_pAttributeSelector->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
nX += this->geometry().x();
|
||||||
|
nY += this->geometry().y();
|
||||||
|
m_pAttributeSelector->move(nX, nY);
|
||||||
m_pAttributeSelector->exec();
|
m_pAttributeSelector->exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,11 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<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>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,24 @@
|
||||||
<normaloff>:/img/images/icon_database.png</normaloff>:/img/images/icon_database.png</iconset>
|
<normaloff>:/img/images/icon_database.png</normaloff>:/img/images/icon_database.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<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>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue