滚动时的滚动条事件?
我需要一个事件来检测用户是否将滚动条位置移动到另一个位置。
换句话说,如果用户确实向上/向下滚动,是否可以捕获信号以便我知道滚动已更改其位置?
我认为这并不重要,但我引用的滚动条位于 QGraphicsView 内部。
问候。
编辑:
QGraphicsView
用于在屏幕中显示项目,如果这些项目太大,它会显示我引用的滚动条。我需要的是知道用户何时更改这些滚动条的位置。
I need an event for detecting if an user has moved the scrollbar position to another one.
In other words, if the user does scroll up/down, would it be possible to catch a signal so I can know the scroll has been changed its position?
I think it's not important, but the scrollbar I refer to is inside a QGraphicsView
.
Regards.
Edit:
QGraphicsView
is for displaying items in the screen, and if those items are too big it shows the scrollbars I refer to. What I need is to know when the user changes the position of those scrollbars.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
滑块有一个
sliderMoved(int value)
信号,其中 value 是滑块的新位置。Sliders have a
sliderMoved(int value)
signal, where value is the new position of slider.如果您需要在滚动条位置更改时收到通知,则需要子类化
QGraphicsView
并重新实现QWidget::mouseMoveEvent(QMouseEvent*)
。为此,您还需要启用鼠标跟踪。 这里是 Qt 4.7 QGraphicsView 参考。If you need to get notified when the scroll bar position is changed, you need to subclass the
QGraphicsView
and reimplement theQWidget::mouseMoveEvent(QMouseEvent*)
. For this you also need to enable mouse tracking. Here is Qt 4.7 QGraphicsView reference.