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. Qtimer on tabs of QTabWidget... not updating?

Qtimer on tabs of QTabWidget... not updating?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 899 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.
  • D Offline
    D Offline
    David Jacobson
    wrote on last edited by
    #1

    Hello,

    I'm using a simple QTimer to update some visual widgets potentially on multiple tabs / forms on a QTabWidget. I assume the QTimer should continue to run and update the widgets even when the tab is not the actively displayed tab. Am I assuming wrong? Does the tab being set to inactive (selecting a different tab) somehow pause of deactivate the QTimer? ...or keep it from updating widgets? A separate QTimer is instantiated as a member with each separately constructed tab form class, so, I'm pretty confident there are separate instances of QTimer per tab.

    Simple QTimer setup code below is launched by a push button on each tab form. Any insight is greatly appreciated.

    	# Start input processing timer
    	self.timerTagXformData = QTimer(self)
    	self.timerTagXformData.timeout.connect(txform.processInputFile)
    	self.timerTagXformData.start(self._PROCESS_INPUT_DATA_INTERVAL_MILLI)
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      QTimer continues to run regardless of the widgets.
      however, the widget/object having the slot must remain allocated.
      so txform.processInputFile must live when you switch to other tab. I assume it
      a tab(Widget) ?
      However, if Widget is not shown, any updates might not have effect before switching to the
      tab.
      Try to set a break point in processInputFile to veryfy its still called even if on other tab.

      D 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        QTimer continues to run regardless of the widgets.
        however, the widget/object having the slot must remain allocated.
        so txform.processInputFile must live when you switch to other tab. I assume it
        a tab(Widget) ?
        However, if Widget is not shown, any updates might not have effect before switching to the
        tab.
        Try to set a break point in processInputFile to veryfy its still called even if on other tab.

        D Offline
        D Offline
        David Jacobson
        wrote on last edited by
        #3

        @mrjj Thank you for confirming! I will debug this and confirm. I suspect I am simply witnessing a delay in updating the widgets when a tab is reselected and made active, and the background QTimer is fine and continuously running. I will follow-up asap.

        mrjjM 1 Reply Last reply
        0
        • D David Jacobson

          @mrjj Thank you for confirming! I will debug this and confirm. I suspect I am simply witnessing a delay in updating the widgets when a tab is reselected and made active, and the background QTimer is fine and continuously running. I will follow-up asap.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @David-Jacobson
          Hi
          On fix could be to to hook to
          http://doc.qt.io/qt-5/qtabwidget.html#currentChanged
          and do a manual update() to ensure that last Timer change is drawn.
          I assume the timers alters the data and Page is ok as soon as timer fires again so
          the issue is seen when switching to tab in between timer firing ?

          D 1 Reply Last reply
          0
          • mrjjM mrjj

            @David-Jacobson
            Hi
            On fix could be to to hook to
            http://doc.qt.io/qt-5/qtabwidget.html#currentChanged
            and do a manual update() to ensure that last Timer change is drawn.
            I assume the timers alters the data and Page is ok as soon as timer fires again so
            the issue is seen when switching to tab in between timer firing ?

            D Offline
            D Offline
            David Jacobson
            wrote on last edited by
            #5

            @mrjj said in Qtimer on tabs of QTabWidget... not updating?:

            he timers alters the data and Page is ok as soo

            Yep, I'm pretty sure that's what is happening too... confirming with my user that it is just a delay and not something more serious. These are"delayed" widget updates on a timer interval anyways (when active), so, I suspect the switching between multiple tabs that all happen to have started background QTimers might be emphasizing the widget update delay to the user.

            mrjjM 1 Reply Last reply
            0
            • D David Jacobson

              @mrjj said in Qtimer on tabs of QTabWidget... not updating?:

              he timers alters the data and Page is ok as soo

              Yep, I'm pretty sure that's what is happening too... confirming with my user that it is just a delay and not something more serious. These are"delayed" widget updates on a timer interval anyways (when active), so, I suspect the switching between multiple tabs that all happen to have started background QTimers might be emphasizing the widget update delay to the user.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @David-Jacobson
              Hi
              Well if a widget is not shown
              http://doc.qt.io/qt-5/qwidget.html#visible-prop
              returns false, there is really no reason to redraw on screen as
              its just wasted efforts. ( as doc talks about)
              I think this is what you are seeing.

              1 Reply Last reply
              2

              • Login

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