Sync of scrollbar values
-
Hi,
I have two views where always only one is visible (stackedLayout).
I have to connect the slidervalues of both views which is in general easy done with:connect(m_viewOriginal->horizontalScrollBar(), &QScrollBar::valueChanged, m_viewTranspose->verticalScrollBar(), &QScrollBar::setValue); connect(m_viewTranspose->horizontalScrollBar(), &QScrollBar::valueChanged, m_viewOriginal->verticalScrollBar(), &QScrollBar::setValue); connect(m_viewOriginal->verticalScrollBar(), &QScrollBar::valueChanged, m_viewTranspose->horizontalScrollBar(), &QScrollBar::setValue); connect(m_viewTranspose->verticalScrollBar(), &QScrollBar::valueChanged, m_viewOriginal->horizontalScrollBar(), &QScrollBar::setValue);
My problem is, that after the first switch to the hidden view, the slidervalue of the former visible view is not applied to the now visible view (slider is at start position). After that first time it is working correctly.
Has someone a hint what I have to do?
I dont understand in general, why it is not working because the connection is correct in general. Why do I have to show it at least one time, that it is working?
Thank you!
-
Hi
Before a widget is shown, it's not always fully "enabled" or will ignore events since it's hidden.
Did you try setting the value directly/manually for the hidden one and see if that stick ?