+void DolphinColumnViewContainer::slotAssureVisibleActiveColumn()
+{
+ const int viewportWidth = viewport()->width();
+ const int x = activeColumn()->x();
+
+ // When a column that is partly visible on the left side gets activated,
+ // it is useful to also assure that the previous column is partly visible.
+ // This allows the user to scroll to the first column without using the
+ // scrollbar and drag & drop operations to invisible columns.
+ const int previousColumnGap = 3 * style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, verticalScrollBar());
+
+ const int width = activeColumn()->maximumWidth();
+ if (x + width > viewportWidth) {
+ const int newContentX = m_contentX - x - width + viewportWidth;
+ if (isRightToLeft()) {
+ m_animation->setFrameRange(m_contentX, newContentX + previousColumnGap);
+ } else {
+ m_animation->setFrameRange(-m_contentX, -newContentX);
+ }
+ if (m_animation->state() != QTimeLine::Running) {
+ m_animation->start();
+ }
+ } else if (x < 0) {
+ const int newContentX = m_contentX - x;
+ if (isRightToLeft()) {
+ m_animation->setFrameRange(m_contentX, newContentX);
+ } else {
+ m_animation->setFrameRange(-m_contentX, -newContentX - previousColumnGap);
+ }
+ if (m_animation->state() != QTimeLine::Running) {
+ m_animation->start();
+ }
+ }
+}
+
+void DolphinColumnViewContainer::assureVisibleActiveColumn()
+{
+ m_assureVisibleActiveColumnTimer->start();
+}
+