本文整理汇总了C++中setHoveredPart函数的典型用法代码示例。如果您正苦于以下问题:C++ setHoveredPart函数的具体用法?C++ setHoveredPart怎么用?C++ setHoveredPart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setHoveredPart函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: theme
void Scrollbar::startTimerIfNeeded(double delay)
{
// Don't do anything for the thumb.
if (m_pressedPart == ThumbPart)
return;
// Handle the track. We halt track scrolling once the thumb is level
// with us.
if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(this)) {
theme()->invalidatePart(this, m_pressedPart);
setHoveredPart(ThumbPart);
return;
}
// We can't scroll if we've hit the beginning or end.
ScrollDirection dir = pressedPartScrollDirection();
if (dir == ScrollUp || dir == ScrollLeft) {
if (m_currentPos == 0)
return;
} else {
if (m_currentPos == maximum())
return;
}
m_scrollTimer.startOneShot(delay);
}
示例2: setPressedPart
bool Scrollbar::mouseDown(const PlatformMouseEvent& evt)
{
// Early exit for right click
if (evt.button() == RightButton)
return true; // FIXME: Handled as context menu by Qt right now. Should just avoid even calling this method on a right click though.
setPressedPart(theme()->hitTest(this, evt));
int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());
if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) {
setHoveredPart(ThumbPart);
setPressedPart(ThumbPart);
m_dragOrigin = m_currentPos;
int thumbLen = theme()->thumbLength(this);
int desiredPos = pressedPos;
// Set the pressed position to the middle of the thumb so that when we do the move, the delta
// will be from the current pixel position of the thumb to the new desired position for the thumb.
m_pressedPos = theme()->trackPosition(this) + theme()->thumbPosition(this) + thumbLen / 2;
moveThumb(desiredPos);
return true;
} else if (m_pressedPart == ThumbPart)
m_dragOrigin = m_currentPos;
m_pressedPos = pressedPos;
autoscrollPressedPart(theme()->initialAutoscrollTimerDelay());
return true;
}
示例3: theme
bool Scrollbar::mouseDown(const PlatformMouseEvent& evt)
{
ScrollbarPart pressedPart = theme().hitTest(*this, evt.position());
auto action = theme().handleMousePressEvent(*this, evt, pressedPart);
if (action == ScrollbarButtonPressAction::None)
return true;
m_scrollableArea.mouseIsDownInScrollbar(this, true);
setPressedPart(pressedPart);
int pressedPosition = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
if (action == ScrollbarButtonPressAction::CenterOnThumb) {
setHoveredPart(ThumbPart);
setPressedPart(ThumbPart);
m_dragOrigin = m_currentPos;
// Set the pressed position to the middle of the thumb so that when we do the move, the delta
// will be from the current pixel position of the thumb to the new desired position for the thumb.
m_pressedPos = theme().trackPosition(*this) + theme().thumbPosition(*this) + theme().thumbLength(*this) / 2;
moveThumb(pressedPosition);
return true;
}
m_pressedPos = pressedPosition;
if (action == ScrollbarButtonPressAction::StartDrag)
m_dragOrigin = m_currentPos;
if (action == ScrollbarButtonPressAction::Scroll)
autoscrollPressedPart(theme().initialAutoscrollTimerDelay());
return true;
}
示例4: setHoveredPart
bool Scrollbar::mouseExited()
{
if (m_scrollableArea)
m_scrollableArea->mouseExitedScrollbar(this);
setHoveredPart(NoPart);
return true;
}
示例5: moveThumb
void Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
if (m_pressedPart == ThumbPart) {
moveThumb(m_orientation == HorizontalScrollbar ?
convertFromContainingView(evt.position()).x() :
convertFromContainingView(evt.position()).y());
return;
}
if (m_pressedPart != NoPart)
m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContainingView(evt.position()).x() : convertFromContainingView(evt.position()).y();
// FIXME(sky): Cleanup this code now that part is always NoPart.
ScrollbarPart part = NoPart;
if (part != m_hoveredPart) {
if (m_pressedPart != NoPart) {
if (part == m_pressedPart) {
// The mouse is moving back over the pressed part. We
// need to start up the timer action again.
startTimerIfNeeded(autoscrollTimerDelay());
invalidatePart(m_pressedPart);
} else if (m_hoveredPart == m_pressedPart) {
// The mouse is leaving the pressed part. Kill our timer
// if needed.
stopTimerIfNeeded();
invalidatePart(m_pressedPart);
}
}
setHoveredPart(part);
}
return;
}
示例6: setHoveredPart
void Scrollbar::autoscrollPressedPart(double delay)
{
// Don't do anything for the thumb or if nothing was pressed.
if (m_pressedPart == ThumbPart || m_pressedPart == NoPart)
return;
// Handle the track.
if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbWillBeUnderMouse()) {
setHoveredPart(ThumbPart);
return;
}
// Handle the arrows and track.
if (m_scrollableArea && m_scrollableArea->userScroll(pressedPartScrollGranularity(), toScrollDelta(pressedPartScrollDirectionPhysical(), 1)).didScroll())
startTimerIfNeeded(delay);
}
示例7: moveThumb
bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
if (m_pressedPart == ThumbPart) {
if (theme()->shouldSnapBackToDragOrigin(this, evt)) {
if (m_scrollableArea)
m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
} else {
moveThumb(m_orientation == HorizontalScrollbar ?
convertFromContainingWindow(evt.pos()).x() :
convertFromContainingWindow(evt.pos()).y(), theme()->shouldDragDocumentInsteadOfThumb(this, evt));
}
return true;
}
if (m_pressedPart != NoPart)
m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());
ScrollbarPart part = theme()->hitTest(this, evt);
if (part != m_hoveredPart) {
if (m_pressedPart != NoPart) {
if (part == m_pressedPart) {
// The mouse is moving back over the pressed part. We
// need to start up the timer action again.
startTimerIfNeeded(theme()->autoscrollTimerDelay());
theme()->invalidatePart(this, m_pressedPart);
} else if (m_hoveredPart == m_pressedPart) {
// The mouse is leaving the pressed part. Kill our timer
// if needed.
stopTimerIfNeeded();
theme()->invalidatePart(this, m_pressedPart);
}
}
setHoveredPart(part);
}
return true;
}
示例8: setHoveredPart
bool Scrollbar::mouseExited()
{
setHoveredPart(NoPart);
return true;
}
示例9: setHoveredPart
void Scrollbar::mouseExited()
{
if (m_scrollableArea)
m_scrollableArea->mouseExitedScrollbar(this);
setHoveredPart(NoPart);
}