void vogleditor_QTimelineView::wheelEvent(QWheelEvent *event) { if (event->modifiers() & Qt::ControlModifier) { float oldZoom=m_zoom; int oldScroll=m_scroll; if (event->angleDelta().y()>0) m_zoom=m_zoom*(1.2f); else m_zoom=m_zoom/(1.2f); m_zoom = qMax(m_zoom, 1.0f); if ((long int)m_zoom*((long int)width())+(long int)m_gap*2+(long int)width() > 2147483647) { m_zoom=oldZoom; return; } //Update the scrolol range in scroll bars before updating the scroll position. emit(scrollRangeChanged(0, (int)((double)m_zoom*(double)width()-width()))); //Keep time line stationary under the mouse (using the oldScroll in case m_scroll was changes when updating the limits): scrollToPx(((double)(oldScroll+event->x())/(double)oldZoom)*(double)m_zoom-event->x()); }else { scrollToPx(m_scroll-event->angleDelta().y()/3); } }
void GuiScrollBar::setScrollRange(size_t range) { dynamic_cast<MyGUI::ScrollBar*>(getMyGUIWidget())->setScrollRange(range); emit scrollRangeChanged(range); }
void vogleditor_QTimelineView::resetZoom() { m_zoom=1; emit(scrollRangeChanged(0, 0)); }