Comments (1)
@xianyongjian080402
我刚才更新了 ToolTip
的代码,现在它是顶层窗口了,拉取更新后,你可以使用下述代码实现一个带工具提示的滑动条:
# coding:utf-8
from PyQt5.QtCore import Qt, pyqtSignal, QPoint, QSize
from PyQt5.QtGui import QMouseEvent
from PyQt5.QtWidgets import QSlider
from tool_tip import ToolTip
class Slider(QSlider):
""" A slider which can be clicked """
clicked = pyqtSignal()
def __init__(self, orient, parent=None):
super().__init__(orient, parent=parent)
self._toolTip = ToolTip('0', self)
def mousePressEvent(self, e: QMouseEvent):
super().mousePressEvent(e)
if self.orientation() == Qt.Horizontal:
value = int(e.pos().x() / self.width() * self.maximum())
else:
value = int((self.height()-e.pos().y()) /
self.height() * self.maximum())
self.setValue(value)
self.clicked.emit()
def mouseMoveEvent(self, e):
super().mouseMoveEvent(e)
self._toolTip.setText(str(self.value()))
if self.isSliderDown():
pos = self.mapToGlobal(QPoint())
pos.setX(pos.x() + e.x() - 13)
self._toolTip.adjustPos(pos, QSize(26, 26))
self._toolTip.show()
但是把滑动条把手移到最左端之后终端会报警:
UpdateLayeredWindowIndirect failed for ptDst=(857, 464), size=(68x61), dirty=(66x70 1, -2) (参数错误。)
暂时没想到解决办法,所以我没把这个滑动条一起提交了
from pyqt-fluent-widgets.
Related Issues (20)
- 请问如何自定义侧边导航栏的字体颜色呢? HOT 2
- [Bug]: design icon按钮中 `LayoutDirection` 属性设置为`Qt.RightToLeft`,预期符合预期,但.py中通过代码设置,无法将图标设置在按钮右边
- [Feature Require] `Fluent Window` 添加主题相关
- [Bug]: 打开折叠后子页面闪退问题
- (enhancement) add a position argument in the StateToolTip function
- [Bug]: 点击ComboBox闪退问题 HOT 3
- [Bug]: FluentIcon does not change color when used in Action inside CommandBar HOT 1
- [bug]: PySide 6.7.0 AttributeError: 'PySide6.QtCore.QEvent' object has no attribute 'propertyName' HOT 5
- Calendar widget is very slow to show and hide, can you improve it HOT 2
- [Bug]: pyside6打包后打开各种报错, HOT 5
- ExpandGroupSettingCard 每个widget的高度只能定吗? HOT 2
- [Bug]: TransparentDropDownPushButton二级菜单显示位置错误 HOT 3
- [Bug]: `setCustomStyleSheet`无法自定义`PrimarySplitPushButton`的样式 HOT 2
- [Bug]: Incorrect theme change HOT 1
- pyside6更新到6.7.0后,阴影效果出现问题 HOT 1
- [Bug]: 无边框对话框打开的一瞬间会显示最大,最小,关闭按钮 HOT 4
- [Bug]: BreadcrumbBar popItem method crash
- PySide6版本没有VideoWidget HOT 2
- [Bug]: 视频播放器播放白屏 HOT 20
- [Bug]: PRO版,ToolBox初始化后里面的内容改变大小会导致显示不完全
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyqt-fluent-widgets.