提交 6af6c121 编写于 作者: 之一Yo's avatar 之一Yo

fixes #32

上级 0295d764
...@@ -12,7 +12,7 @@ Examples are available at https://github.com/zhiyiYo/PyQt-Fluent-Widgets/tree/ma ...@@ -12,7 +12,7 @@ Examples are available at https://github.com/zhiyiYo/PyQt-Fluent-Widgets/tree/ma
:license: MIT, see LICENSE for more details. :license: MIT, see LICENSE for more details.
""" """
__version__ = "0.3.4" __version__ = "0.3.5"
from .components import * from .components import *
from .common import * from .common import *
......
此差异已折叠。
...@@ -190,6 +190,7 @@ class RoundMenu(QWidget): ...@@ -190,6 +190,7 @@ class RoundMenu(QWidget):
self.hBoxLayout = QHBoxLayout(self) self.hBoxLayout = QHBoxLayout(self)
self.view = MenuActionListWidget(self) self.view = MenuActionListWidget(self)
self.ani = QPropertyAnimation(self, b'pos', self) self.ani = QPropertyAnimation(self, b'pos', self)
self.timer = QTimer(self)
self.__initWidgets() self.__initWidgets()
def __initWidgets(self): def __initWidgets(self):
...@@ -198,6 +199,10 @@ class RoundMenu(QWidget): ...@@ -198,6 +199,10 @@ class RoundMenu(QWidget):
self.setAttribute(Qt.WA_TranslucentBackground) self.setAttribute(Qt.WA_TranslucentBackground)
self.setMouseTracking(True) self.setMouseTracking(True)
self.timer.setSingleShot(True)
self.timer.setInterval(400)
self.timer.timeout.connect(self._onShowMenuTimeOut)
self.setShadowEffect() self.setShadowEffect()
self.hBoxLayout.addWidget(self.view, 1, Qt.AlignCenter) self.hBoxLayout.addWidget(self.view, 1, Qt.AlignCenter)
...@@ -413,7 +418,8 @@ class RoundMenu(QWidget): ...@@ -413,7 +418,8 @@ class RoundMenu(QWidget):
self.lastHoverItem = item self.lastHoverItem = item
self.lastHoverSubMenuItem = item self.lastHoverSubMenuItem = item
# delay 400 ms to anti-shake # delay 400 ms to anti-shake
QTimer.singleShot(400, self._onShowMenuTimeOut) self.timer.stop()
self.timer.start()
def _onShowMenuTimeOut(self): def _onShowMenuTimeOut(self):
if self.lastHoverSubMenuItem is None or not self.lastHoverItem is self.lastHoverSubMenuItem: if self.lastHoverSubMenuItem is None or not self.lastHoverItem is self.lastHoverSubMenuItem:
...@@ -458,6 +464,7 @@ class RoundMenu(QWidget): ...@@ -458,6 +464,7 @@ class RoundMenu(QWidget):
def _closeParentMenu(self): def _closeParentMenu(self):
menu = self menu = self
while menu.parentMenu: while menu.parentMenu:
menu.close()
menu = menu.parentMenu menu = menu.parentMenu
menu.close() menu.close()
......
...@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f: ...@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f:
setuptools.setup( setuptools.setup(
name="PyQt-Fluent-Widgets", name="PyQt-Fluent-Widgets",
version="0.3.4", version="0.3.5",
keywords="pyqt fluent widgets", keywords="pyqt fluent widgets",
author="zhiyiYo", author="zhiyiYo",
author_email="shokokawaii@outlook.com", author_email="shokokawaii@outlook.com",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册