We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好 最近看了这个项目 感觉非常不错 就是能否添加 在鼠标按下 hollow_handle_slider 中的 时 在上方显示百分比 (类似于 tool_tip
The text was updated successfully, but these errors were encountered:
@xianyongjian080402 我刚才更新了 ToolTip 的代码,现在它是顶层窗口了,拉取更新后,你可以使用下述代码实现一个带工具提示的滑动条:
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) (参数错误。)
暂时没想到解决办法,所以我没把这个滑动条一起提交了
Sorry, something went wrong.
No branches or pull requests
你好 最近看了这个项目 感觉非常不错 就是能否添加 在鼠标按下 hollow_handle_slider 中的
时 在上方显示百分比 (类似于 tool_tip
The text was updated successfully, but these errors were encountered: