提交 8f5a99a5 编写于 作者: 之一Yo's avatar 之一Yo

修复切换主题后开光按钮样式没有跟着改变的问题

上级 b0341b99
NavigationPanel { NavigationPanel[menu=true] {
background-color: rgba(32, 32, 32, --bgOpacity); background-color: rgb(32, 32, 32);
border: 1px solid rgba(57, 57, 57, --bgOpacity); border: 1px solid rgb(57, 57, 57);
border-top-right-radius: 7px;
border-bottom-right-radius: 7px;
}
NavigationPanel[menu=false] {
background-color: transparent;
border: 1px solid transparent;
border-top-right-radius: 7px; border-top-right-radius: 7px;
border-bottom-right-radius: 7px; border-bottom-right-radius: 7px;
} }
......
NavigationPanel { NavigationPanel[menu=true] {
background-color: rgba(243, 243, 243, --bgOpacity); background-color: rgb(243, 243, 243);
border: 1px solid rgba(229, 229, 229, --bgOpacity); border: 1px solid rgb(229, 229, 229);
border-top-right-radius: 7px;
border-bottom-right-radius: 7px;
}
NavigationPanel[menu=false] {
background-color: transparent;
border: 1px solid transparent;
border-top-right-radius: 7px; border-top-right-radius: 7px;
border-bottom-right-radius: 7px; border-bottom-right-radius: 7px;
} }
......
此差异已折叠。
...@@ -43,10 +43,7 @@ def setStyleSheet(widget, file, theme=Theme.AUTO): ...@@ -43,10 +43,7 @@ def setStyleSheet(widget, file, theme=Theme.AUTO):
theme: Theme theme: Theme
the theme of style sheet the theme of style sheet
""" """
# register widget fluentWidgets[widget] = file
if widget not in fluentWidgets:
fluentWidgets[widget] = file
widget.setStyleSheet(getStyleSheet(file, theme)) widget.setStyleSheet(getStyleSheet(file, theme))
......
...@@ -4,7 +4,7 @@ from typing import Dict, Union ...@@ -4,7 +4,7 @@ from typing import Dict, Union
from PyQt5.QtCore import Qt, QPropertyAnimation, QRect, QSize, QEvent, QEasingCurve from PyQt5.QtCore import Qt, QPropertyAnimation, QRect, QSize, QEvent, QEasingCurve
from PyQt5.QtGui import QResizeEvent, QIcon from PyQt5.QtGui import QResizeEvent, QIcon
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QFrame from PyQt5.QtWidgets import QWidget, QVBoxLayout, QFrame, QApplication
from .navigation_widget import NavigationButton, MenuButton, NavigationWidget, NavigationSeparator from .navigation_widget import NavigationButton, MenuButton, NavigationWidget, NavigationSeparator
from ..widgets.scroll_area import ScrollArea from ..widgets.scroll_area import ScrollArea
...@@ -44,7 +44,6 @@ class NavigationPanel(QFrame): ...@@ -44,7 +44,6 @@ class NavigationPanel(QFrame):
self.scrollLayout = NavigationItemLayout(self.scrollWidget) self.scrollLayout = NavigationItemLayout(self.scrollWidget)
self.items = {} # type: Dict[str, NavigationWidget] self.items = {} # type: Dict[str, NavigationWidget]
self._bgOpacity = 0
self.expandAni = QPropertyAnimation(self, b'geometry', self) self.expandAni = QPropertyAnimation(self, b'geometry', self)
self.isMinimalEnabled = isMinimalEnabled self.isMinimalEnabled = isMinimalEnabled
...@@ -71,6 +70,7 @@ class NavigationPanel(QFrame): ...@@ -71,6 +70,7 @@ class NavigationPanel(QFrame):
self.menuButton.clicked.connect(self.toggle) self.menuButton.clicked.connect(self.toggle)
self.expandAni.finished.connect(self._onExpandAniFinished) self.expandAni.finished.connect(self._onExpandAniFinished)
self.setProperty('menu', False)
self.scrollWidget.setObjectName('scrollWidget') self.scrollWidget.setObjectName('scrollWidget')
setStyleSheet(self, 'navigation_interface') setStyleSheet(self, 'navigation_interface')
self.__initLayout() self.__initLayout()
...@@ -191,7 +191,8 @@ class NavigationPanel(QFrame): ...@@ -191,7 +191,8 @@ class NavigationPanel(QFrame):
if self.window().width() > 1007 and not self.isMinimalEnabled: if self.window().width() > 1007 and not self.isMinimalEnabled:
self.displayMode = NavigationDisplayMode.EXPAND self.displayMode = NavigationDisplayMode.EXPAND
else: else:
self.setStyleSheet(getStyleSheet('navigation_interface').replace('--bgOpacity', '1')) self.setProperty('menu', True)
self.setStyle(QApplication.style())
self.displayMode = NavigationDisplayMode.MENU self.displayMode = NavigationDisplayMode.MENU
if not self._parent.isWindow(): if not self._parent.isWindow():
pos = self.parent().pos() pos = self.parent().pos()
...@@ -283,9 +284,12 @@ class NavigationPanel(QFrame): ...@@ -283,9 +284,12 @@ class NavigationPanel(QFrame):
s = getStyleSheet('navigation_interface') s = getStyleSheet('navigation_interface')
if self.displayMode == NavigationDisplayMode.MINIMAL: if self.displayMode == NavigationDisplayMode.MINIMAL:
self.hide() self.hide()
self.setStyleSheet(s.replace('--bgOpacity', '0')) self.setProperty('menu', False)
self.setStyle(QApplication.style())
elif self.displayMode == NavigationDisplayMode.COMPACT: elif self.displayMode == NavigationDisplayMode.COMPACT:
self.setStyleSheet(s.replace('--bgOpacity', '0')) self.setProperty('menu', False)
self.setStyle(QApplication.style())
for item in self.items.values(): for item in self.items.values():
item.setCompacted(True) item.setCompacted(True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册