From 59124e4b0ad21a36f6ea341ceb6e3cad7aec8aff Mon Sep 17 00:00:00 2001 From: Jeremy Bullock Date: Aug 09 2017 03:52:43 +0000 Subject: Merge pull request #1335 from shun-iwasawa/fix_scroll_xsheet Fix Function Editor to be scrolled synchronously with Xsheet --- diff --git a/toonz/sources/toonzqt/spreadsheetviewer.cpp b/toonz/sources/toonzqt/spreadsheetviewer.cpp index 1274772..aae6779 100644 --- a/toonz/sources/toonzqt/spreadsheetviewer.cpp +++ b/toonz/sources/toonzqt/spreadsheetviewer.cpp @@ -94,13 +94,18 @@ void adjustScrollbar(QScrollBar *scrollBar, int add); void FrameScroller::onScroll(const CellPositionRatio &ratio) { QPoint offset = orientation()->positionRatioToXY(ratio); + // scroll area should be resized before moving down the scroll bar. + // SpreadsheetViewer::onPrepareToScrollOffset() will be invoked immediately + // since the receiver is in the same thread. + // when moving up the scroll bar, resizing will be done in + // SpreadsheetViewer::onVSliderChanged(). + if (offset.x() > 0 || offset.y() > 0) emit prepareToScrollOffset(offset); if (offset.x()) adjustScrollbar(m_scrollArea->horizontalScrollBar(), offset.x()); if (offset.y()) adjustScrollbar(m_scrollArea->verticalScrollBar(), offset.y()); - - emit prepareToScrollOffset(offset); } + void adjustScrollbar(QScrollBar *scrollBar, int add) { scrollBar->setValue(scrollBar->value() + add); }