diff --git a/source/attributeTableDelegate.cpp b/source/attributeTableDelegate.cpp
index 5ef1543..97dadb7 100644
--- a/source/attributeTableDelegate.cpp
+++ b/source/attributeTableDelegate.cpp
@@ -150,6 +150,11 @@ void AttributeTableDelegate::paint(QPainter* painter, const QStyleOptionViewItem
opt.palette.setColor(QPalette::Text, Qt::red);
opt.palette.setColor(QPalette::HighlightedText, Qt::red);
}
+ else
+ {
+ //确保失去焦点时高亮颜色,因为上面对于更改的内容会有特殊处理,所以不能放在qss样式中统一处理,qss样式会优先这里被执行
+ opt.palette.setColor(QPalette::HighlightedText, QColor(240, 240, 240));
+ }
//处理被选择时的背景色,注意:如果qss中有设置,会覆盖此处逻辑
if(option.state.testFlag(QStyle::State_Selected))
diff --git a/ui/connectionDialog.ui b/ui/connectionDialog.ui
index 706a21a..ca28b99 100644
--- a/ui/connectionDialog.ui
+++ b/ui/connectionDialog.ui
@@ -66,6 +66,10 @@ QTableView::item:hover
QTableView::item:selected
{
background-color: rgb(49, 91, 125);
+}
+QTableView::item:selected:!active
+{
+ color: rgb(240, 240, 240);
}
diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui
index 6de10dd..780c1bc 100644
--- a/ui/mainwindow.ui
+++ b/ui/mainwindow.ui
@@ -231,6 +231,10 @@ QTreeView::item:selected
{
background-color: rgb(49, 91, 125);
}
+QTreeView::item:selected:!active
+{
+ color: rgb(240, 240, 240);
+}
QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings
{
@@ -262,6 +266,10 @@ QListView::item:selected
{
background-color: rgb(49, 91, 125);
}
+QListView::item:selected:!active
+{
+ color: rgb(240, 240, 240);
+}