//______________________________________________ void ScrollBarData::hoverMoveEvent( QObject* object, QEvent* event ) { // try cast object to scrollbar QScrollBar* scrollBar( qobject_cast<QScrollBar*>( object ) ); if( !scrollBar || scrollBar->isSliderDown() ) return; // retrieve scrollbar option QStyleOptionSlider opt( qt_qscrollbarStyleOption( scrollBar ) ); // cast event QHoverEvent *hoverEvent = static_cast<QHoverEvent*>(event); QStyle::SubControl hoverControl = scrollBar->style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, hoverEvent->pos(), scrollBar); // update hover state updateAddLineArrow( hoverControl ); updateSubLineArrow( hoverControl ); // store position _position = hoverEvent->pos(); }
/*! \reimp */ QRect QAccessibleScrollBar::rect(int child) const { if (!scrollBar()->isVisible()) return QRect(); QStyle::SubControl subControl; switch (child) { case LineUp: subControl = QStyle ::SC_ScrollBarSubLine; break; case PageUp: subControl = QStyle::SC_ScrollBarSubPage; break; case Position: subControl = QStyle::SC_ScrollBarSlider; break; case PageDown: subControl = QStyle::SC_ScrollBarAddPage; break; case LineDown: subControl = QStyle::SC_ScrollBarAddLine; break; default: return QAccessibleAbstractSlider::rect(child); } const QStyleOptionSlider option = qt_qscrollbarStyleOption(scrollBar()); const QRect rect = scrollBar()->style()->subControlRect(QStyle::CC_ScrollBar, &option, subControl, scrollBar()); const QPoint tp = scrollBar()->mapToGlobal(QPoint(0,0)); return QRect(tp.x() + rect.x(), tp.y() + rect.y(), rect.width(), rect.height()); }
QRect HighlightScrollBarOverlay::handleRect() const { QStyleOptionSlider opt = qt_qscrollbarStyleOption(m_scrollBar); return m_scrollBar->style()->subControlRect(QStyle::CC_ScrollBar, &opt, QStyle::SC_ScrollBarSlider, m_scrollBar); }