完成Windows和Linux分支展示逻辑

This commit is contained in:
duanshengchao 2025-04-21 16:57:09 +08:00
parent 3916dc5515
commit 3377b15069
7 changed files with 85 additions and 95 deletions

View File

@ -234,6 +234,10 @@ void ConnectionDialog::clearErrorInfo()
void ConnectionDialog::showMask()
{
// QRect geometry = this->geometry();
// QRect frameGeometry = this->geometry();
// int nY = frameGeometry.height() - geometry.height();
// m_pMaskLayer->setGeometry(0, nY, frameGeometry.width(), frameGeometry.height());
m_pMaskLayer->setGeometry(0, 0, this->width(), this->height());
m_pMaskLayer->show();
}

View File

@ -193,7 +193,7 @@ void CustomBorderContainer::updateBorder()
m_borderLeftBottom->setGeometry(0, m_contentWidget->height() - m_borderSize, m_borderSize, m_borderSize);
m_borderRightTop->setGeometry(m_contentWidget->width() - m_borderSize, 0, m_borderSize, m_borderSize);
m_borderRightBottom->setGeometry(m_contentWidget->width() - m_borderSize, m_contentWidget->height() - m_borderSize, m_borderSize, m_borderSize);
m_borderMove->setGeometry(m_borderSize, m_borderSize, m_contentWidget->width() - m_borderSize * 2, m_borderSize * 10);
m_borderMove->setGeometry(m_borderSize, m_borderSize, m_contentWidget->width() - m_borderSize * 2, m_borderSize * 5);
}
void CustomBorderContainer::updateContentWidget()

View File

@ -116,7 +116,8 @@ void MainWindow::showMessageDialog(MessageDialogType type,const QString& strTitl
int nY = this->geometry().y() + (this->height() - m_pMessageDialog->height()) * 0.5;
m_pMessageDialog->move(nX, nY);
MaskManager::instance()->showMask(m_pMessageDialog);
if(QSysInfo::kernelType() == "linux")
MaskManager::instance()->showMask(m_pMessageDialog);
// if(type == type_question)
// m_pMessageDialog->exec();
// else
@ -164,8 +165,13 @@ void MainWindow::onActionTrigger_connect()
// centerPos -= QPoint(m_pConnectionDialog->width()/2, m_pConnectionDialog->height()/2);
// m_pConnectionDialog->move(centerPos);
MaskManager::instance()->showMask(m_pConnectionDialog);
m_pConnectionDialog->show();
if(QSysInfo::kernelType() == "linux")
{
MaskManager::instance()->showMask(m_pConnectionDialog);
m_pConnectionDialog->show();
}
else
m_pConnectionDialog->exec();
}
void MainWindow::onActionTrigger_disconnect()
{
@ -192,9 +198,13 @@ void MainWindow::onActionTrigger_addModel()
m_pModelInfoDialog->move(nX, nY);
m_pModelInfoDialog->setState(DS_New);
MaskManager::instance()->showMask(m_pModelInfoDialog);
m_pModelInfoDialog->show();
//MaskManager::instance()->hideMask(m_pModelInfoDialog);
if(QSysInfo::kernelType() == "linux")
{
MaskManager::instance()->showMask(m_pModelInfoDialog);
m_pModelInfoDialog->show();
}
else
m_pModelInfoDialog->exec();
}
void MainWindow::onActionTrigger_removeModel()
{
@ -234,8 +244,13 @@ void MainWindow::onActionTrigger_addGroup(int modelID)
m_pGroupSelectionDialog->move(nX, nY);
m_pGroupSelectionDialog->setModel(modelID);
MaskManager::instance()->showMask(m_pGroupSelectionDialog);
m_pGroupSelectionDialog->show();
if(QSysInfo::kernelType() == "linux")
{
MaskManager::instance()->showMask(m_pGroupSelectionDialog);
m_pGroupSelectionDialog->show();
}
else
m_pGroupSelectionDialog->exec();
}
void MainWindow::onSIG_errorFromDBManger(const QString& strConnectionName, const QString& error)

View File

@ -54,29 +54,18 @@ void MaskManager::showMask(QWidget* requester)
else
{
QWidget* widget = m_activeRequests.last();
const QMetaObject* meta = widget->metaObject();
int methodIndex = meta->indexOfMethod("showMask()");
if(methodIndex != -1)
if(widget->windowFlags().testFlag(Qt::Dialog))
{
//QMetaMethod method = meta->method(methodIndex);
QMetaObject::invokeMethod(widget, "showMask", Qt::AutoConnection);
const QMetaObject* meta = widget->metaObject();
int methodIndex = meta->indexOfMethod("showMask()");
if(methodIndex != -1)
{
//QMetaMethod method = meta->method(methodIndex);
QMetaObject::invokeMethod(widget, "showMask", Qt::AutoConnection);
}
}
/*if(widget->parentWidget() == m_mainWindow && widget->isVisible() && !widget->isModal())
{
// qDebug() << "Child Dialog Order:";
// foreach (QObject* child, m_mainWindow->children())
// {
// if(qobject_cast<QDialog*>(child) || qobject_cast<QWidget*>(child))
// qDebug() << child->objectName();
// }
widget->stackUnder(m_maskLayer);
//widget->lower();
//强制刷新
//m_mainWindow->update();
//QApplication::processEvents();
}*/
else
widget->lower();
}
m_activeRequests.appendUnique(requester);
@ -91,11 +80,15 @@ void MaskManager::hideMask(QWidget* requester)
else
{
QWidget* widget = m_activeRequests.last();
const QMetaObject* meta = widget->metaObject();
int methodIndex = meta->indexOfMethod("hideMask()");
if(methodIndex != -1)
QMetaObject::invokeMethod(widget, "hideMask", Qt::AutoConnection);
widget->setFocus();
if(widget->windowFlags().testFlag(Qt::Dialog))
{
const QMetaObject* meta = widget->metaObject();
int methodIndex = meta->indexOfMethod("hideMask()");
if(methodIndex != -1)
QMetaObject::invokeMethod(widget, "hideMask", Qt::AutoConnection);
}
else
widget->raise();
}
//qDebug() << "remove requester: " << requester->objectName() << "requester count: " << m_activeRequests.size();

View File

@ -18,29 +18,7 @@
<normaloff>:/img/images/icon_hierarchy.png</normaloff>:/img/images/icon_hierarchy.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">QListView
{
outline:0px;
border-left:1px solid rgb(235,235,235);
border-right:1px solid rgb(235,235,235);
border-top:1px solid rgb(0,0,0);
border-bottom:1px solid rgb(0,0,0);
}
QListView::item
{
border:0px;
padding-left:5px;
padding-top:1px;
padding-bottom:1px;
}
QListView::item:hover
{
background-color: rgb(240, 248, 255);
}
QListView::item:selected
{
background-color:rgb(211, 241, 250);
}</string>
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
@ -96,7 +74,11 @@ background-color:rgb(211, 241, 250);
</layout>
</item>
<item>
<widget class="QListWidget" name="sourceList"/>
<widget class="QListWidget" name="sourceList">
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
@ -182,7 +164,11 @@ QPushButton:pressed
</layout>
</item>
<item>
<widget class="QListWidget" name="selectedList"/>
<widget class="QListWidget" name="selectedList">
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -32,12 +32,6 @@ QPushButton:pressed
background-color:rgba(70,130,180,50);
}
QPlainTextEdit
{
border:1px solid rgb(235,235,235);
border-bottom:1px solid rgb(0,0,0);
}
QComboBox QAbstractItemView
{
outline: 0px; /* 去除选中虚线框 */
@ -125,6 +119,26 @@ QTreeView::item:selected
color:rgb(0,0,0);
background-color:rgb(211, 241, 250);
}
QListView
{
outline:0px;
}
QListView::item
{
border:0px;
padding-left:5px;
padding-top:1px;
padding-bottom:1px;
}
QListView::item:hover
{
background-color: rgb(240, 248, 255);
}
QListView::item:selected
{
background-color:rgb(211, 241, 250);
}
</string>
</property>
<widget class="QWidget" name="centralwidget">

View File

@ -18,29 +18,7 @@
<normaloff>:/img/images/icon_addTable.png</normaloff>:/img/images/icon_addTable.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">QListView
{
outline:0px;
border-left:1px solid rgb(235,235,235);
border-right:1px solid rgb(235,235,235);
border-top:1px solid rgb(0,0,0);
border-bottom:1px solid rgb(0,0,0);
}
QListView::item
{
border:0px;
padding-left:5px;
padding-top:1px;
padding-bottom:1px;
}
QListView::item:hover
{
background-color: rgb(240, 248, 255);
}
QListView::item:selected
{
background-color:rgb(211, 241, 250);
}</string>
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
@ -84,13 +62,13 @@ background-color:rgb(211, 241, 250);
<widget class="QLabel" name="label_modelType">
<property name="minimumSize">
<size>
<width>61</width>
<width>71</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>61</width>
<width>71</width>
<height>21</height>
</size>
</property>
@ -103,13 +81,13 @@ background-color:rgb(211, 241, 250);
<widget class="QLabel" name="label_modelName">
<property name="minimumSize">
<size>
<width>61</width>
<width>71</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>61</width>
<width>71</width>
<height>21</height>
</size>
</property>
@ -141,13 +119,13 @@ background-color:rgb(211, 241, 250);
<widget class="QLabel" name="label_modelComment">
<property name="minimumSize">
<size>
<width>61</width>
<width>71</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>61</width>
<width>71</width>
<height>21</height>
</size>
</property>