Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Sync of scrollbar values
QtWS25 Last Chance

Sync of scrollbar values

Scheduled Pinned Locked Moved Solved General and Desktop
qtableviewqscrollbarconnect
3 Posts 2 Posters 574 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    firen
    wrote on 6 Aug 2021, 14:43 last edited by firen 8 Jun 2021, 14:44
    #1

    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!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 6 Aug 2021, 14:49 last edited by mrjj 8 Jun 2021, 14:49
      #2

      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 ?

      F 1 Reply Last reply 6 Aug 2021, 15:43
      0
      • M mrjj
        6 Aug 2021, 14:49

        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 ?

        F Offline
        F Offline
        firen
        wrote on 6 Aug 2021, 15:43 last edited by
        #3

        @mrjj Thank you. Yes with an own signal + slot for the switch it is working

        1 Reply Last reply
        1

        3/3

        6 Aug 2021, 15:43

        • Login

        • Login or register to search.
        3 out of 3
        • First post
          3/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved